Skip to main content

Compiler Construction MCQs with Answers

Practice important Compiler Construction MCQs with answers and explanations.

Multiple Choice Questions

Q221: The algorithm used to convert RE to DFA is called ________.
  • A: Huffman’s Construction
  • B: Hopcroft’s Minimization
  • C: Thompson’s Construction
  • D: Regex Compiler
View Answer
C

Q222: Hopcroft’s algorithm is used to ________.
  • A: Build NFAs
  • B: Minimize states in DFA
  • C: Simulate parser
  • D: Remove ε-moves
View Answer
B

Q223: In C++, what data structure is used to represent transition tables of FA?
  • A: Linked List
  • B: 2D Array
  • C: Hash Map
  • D: Tree
View Answer
B

Q224: Which character represents the empty string in regular expressions?
  • A: e
  • B: ε
  • C: null
  • D: space
View Answer
B

Q225: What is the result of applying the Kleene star (*) to a regular expression R?
  • A: R or R² only
  • B: One occurrence of R
  • C: Any number of repetitions of R including none
  • D: Only one repetition
View Answer
C

Q226: The notation [a-z] in regular expressions means ________.
  • A: All lowercase characters from a to z
  • B: A single digit
  • C: A single symbol
  • D: A wildcard for uppercase characters
View Answer
A

Q227: The expression [^ab] matches ________.
  • A: Only 'a' or 'b'
  • B: Any character except 'a' and 'b'
  • C: Only capital A and B
  • D: Nothing
View Answer
B

Q228: Which of the following is an example of a valid identifier in most programming languages?
  • A: 123abc
  • B: _abc123
  • C: abc!23
  • D: #abc
View Answer
B

Q229: Which regular expression denotes an identifier?
  • A: [a-zA-Z]+
  • B: [a-zA-Z_][a-zA-Z0-9_]*
  • C: [0-9]+[a-zA-Z]
  • D: [a-z]*[0-9]*
View Answer
B

Q230: Which of the following strings is matched by the RE (ab)*?
  • A: ab
  • B: abab
  • C:
  • D: All of these
View Answer
D

Test Your Knowledge

Take a timed quiz on Compiler Construction

🚀 Start Quiz Now