Questions: Control Flow Graphs

3 questions to test your understanding

Score: 0 / 3
Question 1 Multiple Choice

Which of the following best defines a basic block in a control flow graph?

AAny single three-address instruction in the intermediate representation.
BA maximal sequence of consecutive instructions with exactly one entry point (no jumps into the middle) and one exit point (execution falls through or branches only at the end).
CAny loop body identified by a back edge in the CFG.
DA set of instructions that all access the same variable.
Question 2 True / False

In a CFG, a conditional branch instruction (such as an if-else) always produces exactly two outgoing edges from the basic block that contains it.

TTrue
FFalse
Question 3 Short Answer

A naive approach to optimization would operate instruction-by-instruction across the whole program. Why do compiler writers instead build a CFG and work with basic blocks as the unit of analysis?

Think about your answer, then reveal below.