Compiler Construction MCQs with Answers
Practice important Compiler Construction MCQs with answers and explanations.
Multiple Choice Questions
Q191: The regular expression a|b generates the strings ______.
- A: a only
- B: b only
- C: a and b
- D: ab
View Answer
C
Q192: Finite Automaton consists of ______.
- A: Only accepting states
- B: Only start state
- C: A set of states, transitions, and input alphabet
- D: Only input alphabet
View Answer
C
Q193: Which is an invalid regular expression extension?
- A: R+
- B: R?
- C: R^
- D: R*
View Answer
C
Q194: Regular expressions are useful for ______ in compiler design.
- A: Parsing
- B: Optimization
- C: Token generation
- D: Code generation
View Answer
C
Q195: The FA that accepts only '1' will reject ______.
- A: 1
- B: 11
- C: 0
- D: Empty string
View Answer
C
Q196: In formal language theory, ε represents _______.
- A: Concatenation
- B: Empty string
- C: Error
- D: Alphabet
View Answer
B
Q197: What will be the result of L(a|ε)b?
- A: Only 'b'
- B: Only 'ab'
- C: 'ab' and 'b'
- D: Only 'a'
View Answer
C
Q198: Which regular expression matches a positive integer?
- A: [a-z]+
- B: digit digit*
- C: [a-zA-Z_][a-zA-Z0-9_]*
- D: [a-z]{2,}
View Answer
B
Q199: The expression digit digit* accepts ______.
- A: Single character only
- B: Any alphabet
- C: All integers
- D: Only even numbers
View Answer
C
Q200: The token class for "if" in programming is ______.
- A: Identifier
- B: Keyword
- C: Operator
- D: Integer
View Answer
B