Binary and precise execution
State representation and execution conventions before tracing
- Place value Integer weights are powers of two from the right. Fractional weights are successive halves. Only 0 and 1 are binary digits
- Conversion Sum weighted bits to read a numeral. Repeated division by two yields bits in reverse order; handle zero explicitly
- Control flow Assignment is sequential. IF chooses a branch; FOR visits its inclusive range; WHILE tests before each body execution
- Correctness and termination Trace to find errors, explain what each update preserves, and justify that a finite loop ends. Passing sample tests alone is not a general proof
Worked example
Convert decimal 43 to binary, recording each place and checking the result
- \(\displaystyle 43-32=11\)The weight-32 digit is 1
- \(\displaystyle 11<16,\quad11-8=3\)The weight-16 digit is 0 and the weight-8 digit is 1
- \(\displaystyle 3<4,\quad3-2=1,\quad1-1=0\)The remaining digits at weights 4, 2 and 1 are 0, 1 and 1
- \(\displaystyle (101011)_2=32+8+2+1=43\)Keep the zero places and check the weighted sum
Common mistakes
Difficulty levels
Questions about this topic
Does a WHILE loop always run once?+
No. Its condition may already be false at entry
Is independent coding automatically assessed?+
No. Generated activity checks supplied calculations and traces. Your own pseudocode, implementation and correctness arguments have ungraded tasks and models
Can I use a calculator?+
No. This topic is practised without a calculator
Which year level and chapter is this?+
Year 12, VCE Units 3 & 4, Specialist Mathematics, chapter 6: Differential equations and rectilinear motion