Compiler Construction MCQs with Answers
Practice important Compiler Construction MCQs with answers and explanations.
Multiple Choice Questions
Q1061: Fill in the blank: The nextquad() function returns the _______.
- A: Index of the next quadruple
- B: Number of true labels
- C: Current code line number
- D: Number of variables
View Answer
A
Q1062: What are the two attributes propagated up the parse tree in boolean expressions?
- A: truelist and falselist
- B: variable list and label list
- C: operator list and operand list
- D: jump list and label list
View Answer
A
Q1063: Which production handles the 'or' operation in boolean expressions?
- A: E → E1 or M E2
- B: E → E1 and M E2
- C: E → not E1
- D: E → id1 relop id2
View Answer
A
Q1064: What is the purpose of the marker non-terminal M in syntax-directed translation?
- A: Records the nextquad index
- B: Generates a label
- C: Deletes a list
- D: Emits a jump
View Answer
A
Q1065: Which of the following quadruples corresponds to a conditional jump?
- A: 100: if a < b goto _
- B: 101: goto _
- C: 105: goto _
- D: 103: goto _
View Answer
A
Q1066: Fill in the blank: The backpatch(p, i) function _______.
- A: Assigns target i to all quadruples in list p
- B: Merges p and i
- C: Deletes list p
- D: Generates a new quadruple
View Answer
A
Q1067: What happens to the quadruple 101: goto _ after backpatch({101},102)?
- A: It is patched to goto 102
- B: It remains unchanged
- C: It is deleted
- D: It is merged with 102
View Answer
A
Q1068: Which attribute stores the quad index at which E2 begins in E → E1 or M E2?
- A: M.quad
- B: E.truelist
- C: E.falselist
- D: E1.truelist
View Answer
A
Q1069: Fill in the blank: The two lists used to track jump targets in boolean expressions are _______.
- A: truelist and falselist
- B: variablelist and labellist
- C: operandlist and operatorlist
- D: jumplist and calllist
View Answer
A
Q1070: In bottom-up parsing, the list E.falselist stores the quadruple indices of jumps for which condition?
- A: False condition
- B: True condition
- C: No condition
- D: All conditions
View Answer
A