Compiler Construction MCQs with Answers
Practice important Compiler Construction MCQs with answers and explanations.
Multiple Choice Questions
Q331: Which keyword returns the token 'AUTO' in Flex?
- A: automatic
- B: auto
- C: autotype
- D: automate
View Answer
B
Q332: What does the Flex rule '[a-zA-Z_][a-zA-Z_0-9]*' identify?
- A: Constants
- B: Strings
- C: Identifiers
- D: Numbers
View Answer
C
Q333: What kind of token is returned for numeric literals like 123 or 045?
- A: INTEGER
- B: FLOAT
- C: STRING
- D: CHAR
View Answer
A
Q334: How is a floating-point literal like 3.14E+10 recognized in Flex?
- A: Using floatsuffix
- B: Using exppart
- C: Using intsuffix
- D: Using chartext
View Answer
B
Q335: In Flex, what does the rule for '++' return?
- A: PLUS
- B: PLUSPLUS
- C: INCREMENT
- D: ADDITION
View Answer
B
Q336: Which of the following is a valid string literal token rule in Flex?
- A: ["string"]
- B: \"string\"
- C: ‘string’
- D: ''string''
View Answer
B
Q337: The token 'class' in C++ is returned by which rule in Flex?
- A: class
- B: [Cc]lass
- C:
- D: CLASS_NAME
View Answer
A
Q338: In Flex, the rule for 'return' maps to which token?
- A: RET
- B: RETURN
- C: EXIT
- D: END
View Answer
B
Q339: The purpose of the check_identifier function is to ______.
- A: Check if a string is a reserved keyword
- B: Check identifier length
- C: Validate syntax
- D: Check variable types
View Answer
A
Q340: Which keyword in C++ represents a logical OR?
- A: ||
- B: or
- C: and
- D: either
View Answer
B