Compiler Construction MCQs with Answers
Practice important Compiler Construction MCQs with answers and explanations.
Multiple Choice Questions
Q1041: In the translation of the while statement, which label indicates the start of the loop?
- A: L1
- B: L2
- C: L3
- D: Lnext
View Answer
A
Q1042: What is the main difficulty in generating three-address code in one pass?
- A: Unknown jump targets at generation time
- B: Memory overflow
- C: Parsing errors
- D: Incorrect variable names
View Answer
A
Q1043: Which grammar rule uses the production E โ ( E1 )?
- A: Parenthesized boolean expression
- B: Negation
- C: Relational operation
- D: Logical OR
View Answer
D
Q1044: What is the effect of the syntax-directed translation on E โ true?
- A: Generates a goto to E.true
- B: Generates a goto to E.false
- C: No code generated
- D: Generates a false branch
View Answer
A
Q1045: Fill in the blank: In bottom-up parsing, the attribute quad stores the _______.
- A: Index of the next quadruple
- B: Number of true labels
- C: Current code line number
- D: Operator precedence
View Answer
A
Q1046: Which of the following is NOT part of boolean expression grammar?
- A: E โ id relop id
- B: E โ for loop
- C: E โ not E
- D: E โ true
View Answer
B
Q1047: What is the purpose of the gen() function in code generation?
- A: Generates intermediate code or instructions
- B: Parses input
- C: Handles errors
- D: Allocates memory
View Answer
A
Q1048: Fill in the blank: In syntax-directed translation, "||" denotes _______.
- A: String concatenation
- B: Logical OR
- C: Bitwise OR
- D: Arithmetic OR
View Answer
B
Q1049: What happens to E1.falselist in the production E โ E1 or M E2?
- A: It is backpatched to M.quad
- B: It is merged with E2.truelist
- C: It is assigned to E.truelist
- D: It is ignored
View Answer
A
Q1050: In the example while statement translation, what does Lnext represent?
- A: Next statement after the loop
- B: Loop start label
- C: False branch label
- D: True branch label
View Answer
A