Skip to main content

Compiler Construction MCQs with Answers

Practice important Compiler Construction MCQs with answers and explanations.

Multiple Choice Questions

Q181: The regular expression a|b denotes which of the following?
  • A: Strings containing only 'a'
  • B: Strings containing 'a' or 'b'
  • C: Strings containing only 'b'
  • D: Strings containing 'ab'
View Answer
B

Q182: What does the regular expression (ab)* accept?
  • A: Only 'ab'
  • B: Any number of 'ab' repetitions
  • C: Only 'a'
  • D: Only 'b'
View Answer
B

Q183: Which of the following denotes zero or more repetitions of a regular expression R?
  • A: R+
  • B: R?
  • C: R*
  • D: R/
View Answer
C

Q184: The expression [a-z] matches _______.
  • A: All capital letters
  • B: All numbers
  • C: Lowercase letters from a to z
  • D: Only vowels
View Answer
C

Q185: The notation [^ab] matches _______.
  • A: Only 'a' or 'b'
  • B: Nothing but 'a' or 'b'
  • C: Everything except 'a' and 'b'
  • D: Only lowercase letters
View Answer
C

Q186: In programming languages, which token is matched by the expression [a-zA-Z_][a-zA-Z0-9_]*?
  • A: Keyword
  • B: Integer
  • C: Identifier
  • D: String
View Answer
C

Q187: The acceptor for regular languages is implemented using _______.
  • A: Context-free grammar
  • B: Finite Automata
  • C: Pushdown Automata
  • D: Turing Machine
View Answer
B

Q188: Which component checks if a string belongs to the language defined by a regular expression?
  • A: Generator
  • B: Compiler
  • C: Acceptor
  • D: Translator
View Answer
C

Q189: The FA accepts a string if the transition from start state ends at _______.
  • A: Dead state
  • B: Error state
  • C: Any state
  • D: Accepting state
View Answer
D

Q190: The number 123 is matched by which regular expression?
  • A: digit digit*
  • B: [a-z]*
  • C: [a-zA-Z_]
  • D: R+
View Answer
A

Test Your Knowledge

Take a timed quiz on Compiler Construction

🚀 Start Quiz Now