Skip to main content

Compiler Construction MCQs with Answers

Practice important Compiler Construction MCQs with answers and explanations.

Multiple Choice Questions

Q931: A main problem with attribute grammars is ________.
  • A: Storage management for short-lived attributes
  • B: Excessive parsing time
  • C: Too many syntax errors
  • D: Lack of formal grammar
View Answer
A

Q932: The variation of attribute grammars used in many compilers is called ________.
  • A: Ad-hoc analysis
  • B: Static analysis
  • C: Dynamic evaluation
  • D: Context-free analysis
View Answer
A

Q933: In rule-based evaluators, actions are associated with ________.
  • A: Grammar productions
  • B: Tokens
  • C: Parsing tables
  • D: Symbol tables
View Answer
A

Q934: Code snippets associated with grammar productions execute at ________ time.
  • A: Parse
  • B: Compile
  • C: Link
  • D: Run
View Answer
A

Q935: In bottom-up shift-reduce parsers, actions are performed during ________.
  • A: Each reduction
  • B: Each shift
  • C: Each scan
  • D: Each parse
View Answer
A

Q936: In LR(1) parser, after popping stack during reduction, the parser pushes ________.
  • A: A and Goto[s,A]
  • B: ฮฒ and token
  • C: Only token
  • D: Only A
View Answer
A

Q937: When Action[s,token] is "shift i", the parser ________.
  • A: Pushes token and i onto stack
  • B: Pops stack
  • C: Reduces
  • D: Calls scanner again
View Answer
A

Q938: The code snippet for the production Number โ†’ Sign List assigns Number.val as ________.
  • A: โ€“ Sign.val ร— List.val
  • B: Sign.val + List.val
  • C: Sign.val โ€“ List.val
  • D: Sign.val ร— List.val
View Answer
A

Q939: For Sign โ†’ +, Sign.val is assigned ________.
  • A: 1
  • B: โ€“1
  • C: 0
  • D: 2
View Answer
A

Q940: For Sign โ†’ โ€“, Sign.val is assigned ________.
  • A: โ€“1
  • B: 1
  • C: 0
  • D: 2
View Answer
A

Test Your Knowledge

Take a timed quiz on Compiler Construction

๐Ÿš€ Start Quiz Now