Skip to main content

Compiler Construction MCQs with Answers

Practice important Compiler Construction MCQs with answers and explanations.

Multiple Choice Questions

Q341: What happens when an unexpected character is found in input?
  • A: An error is printed silently
  • B: Line number is ignored
  • C: Error is printed with line number
  • D: Scanner terminates abruptly
View Answer
C

Q342: What type of lexical analyzer is being developed using Flex in this example?
  • A: Python lexical analyzer
  • B: C++ lexical analyzer
  • C: Java lexical analyzer
  • D: C lexer
View Answer
B

Q343: Which character in Flex input increases line number on newline?
  • A: ' '
  • B: '\t'
  • C: '\n'
  • D: '\r'
View Answer
C

Q344: Which of these symbols is NOT defined in the given Flex rules?
  • A: '@'
  • B: ';'
  • C: '('
  • D: '['
View Answer
A

Q345: The token 'try' in C++ is returned as ______.
  • A: TRY
  • B: CATCH
  • C: EXCEPTION
  • D: CHECK
View Answer
A

Q346: The function skip_until_eol() skips characters until it finds what?
  • A: EOF
  • B: Newline
  • C: Tab
  • D: Space
View Answer
B

Q347: The token returned by '++' is equivalent to what kind of operator?
  • A: Arithmetic
  • B: Relational
  • C: Increment
  • D: Logical
View Answer
C

Q348: Which header is included in the Flex scanner code for character processing?
  • A:
  • B:
  • C:
  • D:
View Answer
C

Q349: The function yywrap() in Flex is used to ______.
  • A: Wrap code into functions
  • B: End input processing
  • C: Handle errors
  • D: Scan again after wrapping
View Answer
B

Q350: In Flex, what is the purpose of the '%' section?
  • A: Define rules
  • B: Import libraries
  • C: Define macros
  • D: Separate sections
View Answer
D

Test Your Knowledge

Take a timed quiz on Compiler Construction

🚀 Start Quiz Now