Skip to main content

Compiler Construction MCQs with Answers

Practice important Compiler Construction MCQs with answers and explanations.

Multiple Choice Questions

Q161: Which symbol may require lookahead to distinguish between assignment and comparison?
  • A: !
  • B: =
  • C: &
  • D: +
View Answer
B

Q162: Which of the following is a string token?
  • A: error
  • B: 123
  • C: ==
  • D: ++
View Answer
A

Q163: The scanner reads the source code and generates _______.
  • A: objects
  • B: errors
  • C: tokens
  • D: instructions
View Answer
C

Q164: Scanner is also known as ________.
  • A: optimizer
  • B: lexer
  • C: parser
  • D: compiler
View Answer
B

Q165: Which token type does `maxsize` belong to?
  • A: Keyword
  • B: Identifier
  • C: Operator
  • D: Symbol
View Answer
B

Q166: The scanner ignores ______ between tokens.
  • A: operators
  • B: characters
  • C: blanks
  • D: errors
View Answer
C

Q167: In lexical analysis, the program is treated as a stream of ______.
  • A: tokens
  • B: variables
  • C: characters
  • D: identifiers
View Answer
C

Q168: A lexical analyzer classifies substrings according to their ______.
  • A: value
  • B: role
  • C: position
  • D: size
View Answer
B

Q169: “==” is an example of which kind of token?
  • A: Identifier
  • B: Boolean operator
  • C: String
  • D: Float
View Answer
B

Q170: What is the role of `readId()` in Lexer?
  • A: Read a float
  • B: Read a keyword
  • C: Read an identifier
  • D: Read an operator
View Answer
C

Test Your Knowledge

Take a timed quiz on Compiler Construction

🚀 Start Quiz Now