Skip to main content
AP CSP course

C10 · Topic 2.1 · 40 minutes · DAT-1.A, DAT-1.B, DAT-1.C

Binary values and representation limits

By the end you can:

  • Convert unsigned binary using place values.
  • Calculate a fixed-width range.
  • Explain overflow under an explicit convention.

Start here; no earlier topic is required.

Bit
A binary digit,0 or 1.
Sampling
Taking measurements of a continuous quantity at selected times.

Understand

Unsigned positional binary uses place values 1,2,4,8 and successive powers of 2. Add the places containing 1 to decode a value; leading zeros do not change it. With n bits there are 2ⁿpatterns and unsigned values 0 through 2ⁿ−1.

A fixed-width representation cannot encode every integer. When a result exceeds its range, behaviour depends on the stated system convention. Here overflow is reported rather than silently wrapping. One extra bit doubles the number of patterns; it does not merely add one more value or remove every possible overflow.

Worked example

Encode 45 in six bits, then test the endpoints.

  1. 45=32+8+4+1, so the pattern is 101101.
  2. Six bits give 64 patterns and a maximum of 63, encoded 111111.
  3. 64 requires 1000000(seven bits); the stated six-bit model reports overflow.

Explore each concept

Choose a concept, change its inputs and follow the explanation. Each example models the stated rule or scenario; completing it is practice rather than evidence of mastery.

  • Analog versus digital
  • Sample intervals and rounding
  • Bits, bytes and conventions
  • Fixed-width versus AP integer model
Open this example on its own

Change it · step through · explain

Change an input, predict what will happen, then advance one step. Read why the state changes, reset and experiment. This fixed teaching model does not save progress or award XP.

Ready · Make a prediction

Ready to explore: Sampling, precision and bit interpretation
  1. ExploresamplingWaiting
  2. Sampling interval1Waiting
  3. Stored precisionwholeWaiting

Ready to explore: Sampling, precision and bit interpretation

Why: Change an input, predict the first effect, then advance one step.

Try this: Change one input or choose another listed case. Predict the effect, reset and compare the states and governing rule.

Step through and experiment

Change it · step through · explain

Change an input, predict what will happen, then advance one step. Read why the state changes, reset and experiment. This fixed teaching model does not save progress or award XP.

Ready · Make a prediction

Ready to experiment
  1. Input 145Waiting
  2. Input 26Waiting

Ready to experiment

Why: Predict the first change, then advance one step.

Try this: Try 63 and 64, then change the width.

Check a misconception

Claim: Adding one bit adds one representable value.

Every old pattern can be prefixed by 0 or 1, doubling the number of patterns.

Guided practice

Decode 010110 and state why the leading 0 does not change it.

Work with a partner. Make a prediction, compare your reasoning, then identify the rule that supports your answer.

Independent transfer

A width changes from 5 to 6 bits. Give both unsigned maxima and the pattern-count change.

Exit check

Why must an overflow prediction name the convention?

Write your reasoning before comparing with a classmate. If your teacher assigned this task, submit it through My classes to save your work and receive feedback.

Check yourself

  1. Question 1 of 2What unsigned value is 11001?

    Select one answer.

  2. Question 2 of 2Which width can hold unsigned 70?

    Select one answer.

Your practice so far

Check an answer to see its rationale.

Teacher guidance and scoring