Liveness Analysis questions

Q45

GATE CS 2026 CS-2Optimization and Data FlowMCQ2 marks−2/3 if wrong
Consider the control flow graph given below.

Which one of the following options is the set of live variables at the exit point of each basic block?
Question figure
Show answer without attempting

Answer: A

Q13

GATE CS 2025 CS-1Optimization and Data FlowMCQ1 mark−1/3 if wrong
Which ONE of the following techniques used in compiler code optimization uses live variable analysis?
Show answer without attempting

Answer: B

Q37

GATE CS 2023 CSOptimization and Data FlowMCQ2 marks−2/3 if wrong
Consider the control flow graph shown.

Which one of the following choices correctly lists the set of live variables at the exit point of each basic block?
Question figure
Show answer without attempting

Answer: D

Q38

GATE CS 2021 CS-2Optimization and Data FlowMCQ2 marks−2/3 if wrong
For a statement SS in a program, in the context of liveness analysis, the following sets are defined:

<br>USE(S):the set of variables used in S<br>IN(S):the set of variables that are live at the entry of S<br>OUT(S):the set of variables that are live at the exit of S<br>\begin{array}{rll}<br>\text{USE}(S) & : & \text{the set of variables used in } S \\<br>\text{IN}(S) & : & \text{the set of variables that are live at the entry of } S \\<br>\text{OUT}(S) & : & \text{the set of variables that are live at the exit of } S<br>\end{array}

Consider a basic block that consists of two statements, S1S_1 followed by S2S_2.
Which one of the following statements is correct?
Show answer without attempting

Answer: A

Q46

GATE CS 2015 CS-1Optimization and Data FlowMCQ2 marks−2/3 if wrong
A variable xx is said to be live at a statement SiS_i in a program if the following three conditions hold simultaneously:

i. There exists a statement SjS_j that uses xx
ii. There is a path from SiS_i to SjS_j in the flow graph corresponding to the program
iii. The path has no intervening assignment to xx including at SiS_i and SjS_j

(Control flow graph: block 1: p=q+rp = q + r, s=p+qs = p + q, u=s∗vu = s * v; block 2: v=r+uv = r + u; block 3: q=s∗uq = s * u; block 4: q=v+rq = v + r; edges 1→2, 1→3, 2→4, 3→4, 4→1.)

The variables which are live both at the statement in basic block 2 and at the statement in basic block 3 of the above control flow graph are
Question figure
Show answer without attempting

Answer: C

0/50 correct0 marks

Related topics in Optimization and Data Flow