← 🚀 Code Optimisation & Data-Flow
Subtopic 1 of 7

9.1Local optimisations

Constant folding (3*4 → 12), constant propagation, algebraic simplification (x*1, x+0), strength reduction (x*2 → x+x, x/8 → x>>3), dead-code elimination.

  • x = 3 * 4 constant folding → x = 12
  • y = x + 2 propagate x = 12 → y = 12 + 2 → fold → y = 14
  • z = y * 1 algebraic: z = y

Result: x = 12; y = 14; z = y

Previous year questions: Code Optimisation & Data-Flow (3)

PYQs are grouped by topic, so this is the full set for Code Optimisation & Data-Flow; try the ones that match this subtopic. Open all 3 on the topic page.