Skip to main content

Compiler Construction MCQs with Answers

Practice important Compiler Construction MCQs with answers and explanations.

Multiple Choice Questions

Q911: The string โ€œโ€“1โ€ can be derived from the grammar as:
  • A: Number โ†’ Sign List โ†’ โ€“ Bit โ†’ โ€“ 1
  • B: Number โ†’ List Sign โ†’ โ€“ Bit โ†’ โ€“ 1
  • C: Number โ†’ Bit Sign โ†’ โ€“ Bit โ†’ โ€“ 1
  • D: Number โ†’ Sign Bit โ†’ โ€“ Bit โ†’ โ€“ 1
View Answer
A

Q912: Attributes associated with nodes in parse tree are called ________.
  • A: Synthesized and inherited attributes
  • B: Terminal and non-terminal
  • C: Left and right attributes
  • D: Syntactic and semantic attributes
View Answer
A

Q913: Synthesized attributes flow ________ in the parse tree.
  • A: Bottom-up
  • B: Top-down
  • C: Sideways
  • D: Random
View Answer
A

Q914: Inherited attributes flow ________ in the parse tree.
  • A: Top-down and laterally
  • B: Bottom-up
  • C: Only top-down
  • D: Only laterally
View Answer
A

Q915: In the SBN attributed grammar, Sign.neg is true if Sign is ________.
  • A: โ€“
  • B: +
  • C: 0
  • D: 1
View Answer
A

Q916: For the production List0 โ†’ List1 Bit, List1.pos is assigned as ________.
  • A: List0.pos + 1
  • B: List0.pos โ€“ 1
  • C: List0.pos
  • D: Bit.pos
View Answer
A

Q917: Bit.val for bit '1' is computed as ________.
  • A: 2^Bit.pos
  • B: 1
  • C: 0
  • D: Bit.pos
View Answer
A

Q918: The decimal value of the signed binary number โ€œ-101โ€ is ________.
  • A: โ€“5
  • B: 5
  • C: โ€“7
  • D: 7
View Answer
A

Q919: The inherited attribute in the attributed parse tree example is ________.
  • A: pos
  • B: val
  • C: neg
  • D: Number.val
View Answer
A

Q920: The synthesized attribute in the attributed parse tree example is ________.
  • A: val
  • B: pos
  • C: neg
  • D: Sign.neg
View Answer
A

Test Your Knowledge

Take a timed quiz on Compiler Construction

๐Ÿš€ Start Quiz Now