Phase III
Logic and Flow
Making a program compute, decide, and repeat.
Operators compute values, branches select work, and loops repeat it. This phase traces the exact evaluation rules behind each one. It covers division toward zero, signed remainder, compound assignment, short-circuit order, fixed-width shifts, boolean branch conditions, switch statements and expressions, loop invariants, and off-by-one boundaries.
When you finish this phase you can
- Predict integer division and remainder, including negative operands, from the truncation rule and identity
- Explain the implicit cast and single left-side evaluation in compound assignment
- Predict overflow, shift-distance masking, sign extension and zero filling
- Write boolean branches with explicit braces and ordered conditions
- Distinguish a switch statement from a switch expression and use yield in a block arm
- Trace for, while and do-while execution and state an invariant and stopping condition
- 3.1OperatorsUse operators to calculate values, compare them, combine conditions, and work with bits.Bitwise operatorsShort circuit evaluation
- 3.2ConditionalsUse if and switch to make a program choose what to do.switch
- 3.3Loops and Jump StatementsUse for, while, and do-while loops, and trace when each loop stops.Loops