Skip to main content

Compiler Construction MCQs with Answers

Practice important Compiler Construction MCQs with answers and explanations.

Chapter: 37
Q1001:
In the expression a = b * -c + b * -c, the first temporary variable t1 is assigned to ______.
A. b
B. -c
C. t1 = –c
D. t1 = b
Correct Answer: C
Chapter: 37
Q1002:
In the parse of a = b * -c + b * -c, t2 is assigned the value of ______.
A. b * t1
B. t1 + t4
C. b * -c
D. t4 = b * t3
Correct Answer: A
Chapter: 37
Q1003:
The temporary t3 in the three-address code represents the value of ______.
A. –c
B. b * c
C. b * t1
D. t2 + t4
Correct Answer: A
Chapter: 37
Q1004:
In the statement a = t5, t5 holds the value of ______.
A. t2 + t4
B. b * c
C. –c
D. b * t1
Correct Answer: A
Chapter: 37
Q1005:
A quadruple in three-address code consists of ______ fields.
A. 2
B. 3
C. 4
D. 5
Correct Answer: C
Chapter: 37
Q1006:
The four fields in a quadruple are: operator, two operands, and ______.
A. source
B. destination
C. opcode
D. label
Correct Answer: B
Chapter: 37
Q1007:
In three-address code, the index of the array element acts as the ______.
A. operator
B. destination
C. quadruple number
D. operand
Correct Answer: C
Chapter: 37
Q1008:
Which data structure can be used to overcome the maximum size limitation of arrays of quads?
A. linked list
B. stack
C. queue
D. tree
Correct Answer: A
Chapter: 37
Q1009:
The syntax-directed translation scheme for flow-of-control statements includes which of the following?
A. if-then-else
B. while-do
C. if-then
D. All of the above
Correct Answer: D
Chapter: 37
Q1010:
In the three-address code for if c < d then x = y + z else x = y – z, the label L1 points to the statement
A. x = y + z
B. x = y – z
C. goto L2
D. nop
Correct Answer: A
Chapter: 37
Q1011:
In the code fragment: "if c < d goto L1; goto L2", which label is jumped to if c is not less than d?
A. L1
B. L2
C. L3
D. None
Correct Answer: B
Chapter: 37
Q1012:
The function newlabel() in syntax-directed translation returns ______.
A. a new temporary variable
B. a new operator
C. a new symbolic label
D. a new quadruple
Correct Answer: C
Chapter: 37
Q1013:
The "nop" statement in three-address code stands for ______.
A. no operation
B. new operation
C. next operation
D. not operation
Correct Answer: A
Chapter: 37
Q1014:
Which is NOT a valid flow-of-control statement in most procedural programming languages?
A. for
B. switch
C. repeat-until
D. copy
Correct Answer: D
Chapter: 37
Q1015:
In three-address code, the operand "-" in t5 – t4 t3 represents a ______ operation.
A. multiplication
B. subtraction
C. addition
D. division
Correct Answer: B
Chapter: 37
Q1016:
In the syntax-directed translation of flow control, which statement checks a boolean expression?
A. if E then S1
B. while E do S1
C. both A and B
D. none
Correct Answer: C
Chapter: 38
Q1017:
Which of the following is a type of three-address statement?
A. Assignment statement
B. Copy statement
C. Unconditional jump
D. All of the above
Correct Answer: D
Chapter: 38
Q1018:
In three-address statements, the operation in x = y op z is called ______.
A. unary operator
B. binary operator
C. logical operator
D. relational operator
Correct Answer: B
Chapter: 38
Q1019:
The statement x = y is an example of a ______ statement.
A. assignment
B. copy
C. conditional jump
D. unconditional jump
Correct Answer: B
Chapter: 38
Q1020:
What does the statement "goto L" do in three-address code?
A. Executes the next statement
B. Jumps to the statement labeled L
C. Jumps to the next instruction
D. Ends the program
Correct Answer: B

Test Your Knowledge

Take a timed quiz on Compiler Construction

🚀 Start Quiz Now