Questions: Partial Evaluation and Program Specialization

5 questions to test your understanding

Score: 0 / 5
Question 1 Multiple Choice

A partial evaluator is given an interpreter for a small language and a specific program written in that language. The program text is treated as a static (known) input. What does the output of the partial evaluator represent?

AAn optimized version of the interpreter with dead code eliminated
BA compiled version of the specific program — the interpreter's dispatch logic has been specialized away
CA new interpreter that runs the same program faster by caching results
DA proof that the interpreter correctly implements the language semantics
Question 2 Multiple Choice

A partial evaluator is applied to a generic image-processing function with a static kernel size of 3×3. Instead of a compact specialized function, the output is thousands of lines of unrolled code. What phenomenon explains this?

AThe partial evaluator made a logic error and must be rerun
BCode explosion — aggressive unfolding of a small static input produced an oversized residual program
CThe function contained dynamic inputs that were incorrectly treated as static
DBinding-time analysis failed to classify any variables, so all code was duplicated
Question 3 True / False

Partial evaluation generalizes constant folding and dead code elimination by propagating known values through the entire program structure, including across function call boundaries.

TTrue
FFalse
Question 4 True / False

Partial evaluation typically produces a smaller, faster program than the original, making it a universally applicable optimization.

TTrue
FFalse
Question 5 Short Answer

Explain what binding-time analysis does in partial evaluation and why it is necessary.

Think about your answer, then reveal below.