Skip to main content

Compiler Construction MCQs with Answers

Practice important Compiler Construction MCQs with answers and explanations.

Multiple Choice Questions

Q1071: Which of the following best describes the meaning of backpatching?
  • A: Updating incomplete jump instructions with correct target addresses
  • B: Generating code for expressions
  • C: Parsing boolean expressions
  • D: Deleting quadruples
View Answer
A

Q1072: Fill in the blank: The quadruple 100: if a < b goto _ is generated during the reduction of _______.
  • A: a < b
  • B: E1 or M E2
  • C: E1 and M E2
  • D: not E1
View Answer
A

Q1073: What is the nextquad value used for in syntax-directed translation?
  • A: To mark the position for the next quadruple to be generated
  • B: To count the number of variables
  • C: To store the current token
  • D: To count errors
View Answer
A

Q1074: In the semantic rule E → E1 and M E2, what is the source of E.truelist?
  • A: E2.truelist
  • B: E1.truelist
  • C: M.quad
  • D: E.falselist
View Answer
B

Q1075: Fill in the blank: The last goto statements in the boolean expression evaluation will have their targets _______.
  • A: backpatched later
  • B: generated first
  • C: merged
  • D: ignored
View Answer
A

Q1076: Which of the following is NOT a synthesized attribute in the example?
  • A: truelist
  • B: labellist
  • C: falselist
  • D: quad indices
View Answer
B

Q1077: Fill in the blank: The attribute M.quad stores the _______.
  • A: Index of the first quadruple of E2
  • B: Label of the current token
  • C: Position of the parser
  • D: Index of last quadruple
View Answer
A

Q1078: In the production S → if E then M1 S1 N else M2 S2, the semantic action backpatches E.truelist to ________.
  • A: M1.quad
  • B: M2.quad
  • C: N.nextlist
  • D: S1.nextlist
View Answer
A

Q1079: What does the semantic action N → ε do in flow-of-control translation?
  • A: Initializes N.nextlist with nextQuad()
  • B: Backpatches E.falselist
  • C: Emits a conditional jump
  • D: Ends the statement
View Answer
A

Q1080: In the semantic action S → while M1 E do M2 S1, what does backpatch(S1.nextlist, M1.quad) achieve?
  • A: It patches the nextlist of S1 to the beginning of the loop
  • B: It ends the loop
  • C: It jumps to the exit point
  • D: It initializes M1.quad
View Answer
A

Test Your Knowledge

Take a timed quiz on Compiler Construction

🚀 Start Quiz Now