Compiler Construction MCQs with Answers
Practice important Compiler Construction MCQs with answers and explanations.
Multiple Choice Questions
Q201: Which of these is not a token category?
- A: Identifiers
- B: Keywords
- C: Integers
- D: Parsers
View Answer
D
Q202: The RE (a|b)* accepts ______.
- A: Strings with one a only
- B: Strings with one b only
- C: Strings with a’s and b’s in any combination
- D: Strings without a and b
View Answer
C
Q203: The finite automaton that accepts any number of 1s followed by a single 0 will reject ______.
- A: 1110
- B: 1101
- C: 11110
- D: 10
View Answer
B
Q204: The language consisting of all Java programs is built over which alphabet?
- A: ASCII
- B: Binary
- C: Hexadecimal
- D: Unicode
View Answer
A
Q205: ______ is used to group sub-expressions in regular expressions.
- A: |
- B: ( )
- C: *
- D: +
View Answer
B
Q206: In the RE a*, how many times can 'a' appear in a string?
- A: Exactly once
- B: Zero or more times
- C: Only twice
- D: Only in pairs
View Answer
B
Q207: In regular expressions, what does R? represent?
- A: Zero or one R
- B: One or more R
- C: Exactly one R
- D: Infinite R
View Answer
A
Q208: The RE ab means that string must start with a and be followed by ______.
- A: Any string
- B: a
- C: b
- D: another ab
View Answer
B
Q209: Which is an example of a valid identifier in C++?
- A: 123name
- B: _name
- C: main@
- D: __init__
View Answer
D
Q210: In REs, which symbol is used for alternation (either-or)?
- A: +
- B: |
- C: *
- D: ?
View Answer
B