Skip to main content

Compiler Construction MCQs with Answers

Practice important Compiler Construction MCQs with answers and explanations.

Multiple Choice Questions

Q1081: In flow-of-control translation, the statement S → begin L end results in S.nextlist being equal to ________.
  • A: L.nextlist
  • B: S1.nextlist
  • C: S2.nextlist
  • D: S.nextlist
View Answer
B

Q1082: In the statement S → L1 ; M S, the semantic action backpatch(L1.nextlist, M.quad) means:
  • A: It links the nextlist of L1 to the quad at M
  • B: It starts a new statement
  • C: It clears the nextlist
  • D: It merges two nextlists
View Answer
A

Q1083: The list-handling procedure used in backpatching maintains lists of ________.
  • A: quadruple indices
  • B: instruction addresses
  • C: variable names
  • D: constant values
View Answer
A

Q1084: Which of the following is NOT a valid flow-of-control statement according to the grammar?
  • A: if E then S else S
  • B: for E do S
  • C: while E do S
  • D: break statement
View Answer
D

Q1085: The nextQuad() function is used to:
  • A: return the index of the next quadruple
  • B: generate the next instruction
  • C: emit a goto statement
  • D: patch backpatch lists
View Answer
A

Q1086: In the example if a < b or c < d and e < f then x = y+z else x = y-z, the E.truelist is ________.
  • A: [100,104]
  • B: [101,105]
  • C: [103,105]
  • D: [102,106]
View Answer
A

Q1087: In the example, the quadruple 100 corresponds to:
  • A: if a < b goto _
  • B: if c < d goto _
  • C: if e < f goto _
  • D: goto _
View Answer
A

Q1088: In the example, the semantic action backpatch([100,104],106) connects which part of the code?
  • A: The true lists of E to the start of then-part
  • B: The false lists of E to the else-part
  • C: The nextlist of S to the end
  • D: Initialization of M.quad
View Answer
A

Q1089: The goto statement emitted by N → ε is used to:
  • A: Unconditionally jump to the next instruction
  • B: Conditional jump
  • C: Initialize loop counter
  • D: Merge nextlists
View Answer
A

Q1090: In YACC semantic actions, %union is used to:
  • A: Define multiple attribute types
  • B: Store variables
  • C: Generate quadruples
  • D: Parse tokens
View Answer
A

Test Your Knowledge

Take a timed quiz on Compiler Construction

🚀 Start Quiz Now