Skip to main content

Compiler Construction MCQs with Answers

Practice important Compiler Construction MCQs with answers and explanations.

Multiple Choice Questions

Q1021: The expression "if x relop y goto L" executes the statement with label L if ______ is true.
  • A: x relop y
  • B: y relop x
  • C: x = y
  • D: y = x
View Answer
A

Q1022: Indexed assignment in the form x = y[i] means:
  • A: set x to value at location y
  • B: set x to value at location i
  • C: set x to value in location i memory units beyond y
  • D: set x to value in location y plus i
View Answer
C

Q1023: The statement x[i] = y means:
  • A: set x[i] to y
  • B: set contents of location i beyond x to y
  • C: set y to x[i]
  • D: set x to y
View Answer
B

Q1024: In syntax-directed translation, the attribute E.true represents:
  • A: label for true evaluation
  • B: label for false evaluation
  • C: next statement label
  • D: start label
View Answer
A

Q1025: For the statement if a < b then goto E.true else goto E.false, which statement is executed when a is less than b?
  • A: goto E.true
  • B: goto E.false
  • C: next instruction
  • D: error
View Answer
A

Q1026: In syntax-directed translation for S → if E then S1 else S2, which attribute is used for S1.next?
  • A: S.next
  • B: E.true
  • C: E.false
  • D: newlabel()
View Answer
A

Q1027: In the while loop syntax-directed translation, S.begin represents:
  • A: the start label of the loop
  • B: the exit label
  • C: the true label
  • D: the false label
View Answer
A

Q1028: The function newlabel() in syntax-directed translation is used to:
  • A: create a new temporary variable
  • B: create a new symbolic label
  • C: generate a new operator
  • D: generate a new operand
View Answer
B

Q1029: The statement gen('goto' S.next) in syntax-directed translation generates code for:
  • A: unconditional jump
  • B: conditional jump
  • C: assignment
  • D: label definition
View Answer
A

Q1030: The code for a while loop in syntax-directed translation includes which of the following?
  • A: loop start label
  • B: boolean expression code
  • C: jump back to loop start
  • D: all of the above
View Answer
D

Test Your Knowledge

Take a timed quiz on Compiler Construction

🚀 Start Quiz Now