Encode a Value and Check the Range
Construct unsigned four-bit numbers and reject an out-of-range value.
Supplied materials
- Paper and pencil; an adult may read aloud. No device, account or purchase is needed.
Learn the idea
Encoding reverses decoding: choose which place values sum to the desired number. For unsigned four-bit values the places are 8, 4, 2 and 1. Start with the largest place and record 1 if you can include it without exceeding the remaining value. Otherwise record 0. Keep all four positions.
Encode 10: include 8, leaving 2; skip 4; include 2, leaving 0; skip 1. The code is 1010. The largest code 1111 represents 8 + 4 + 2 + 1 = 15. A value of 16 cannot be represented in these four unsigned places; we reject it rather than silently dropping a digit.
- Write columns place, included? and amount still needed.
- Encode 10 using places 8, 4, 2, 1.
- Decode your result to verify it adds back to 10.
- Test the lower endpoint 0 and upper endpoint 15, then reject 16.
See the method in action
10 → 1010 → 8 + 2 = 10. Endpoints: 0 → 0000; 15 → 1111. Input 16 is out of range under this fixed four-bit contract.
Check your reasoning
Your answer is temporary and is not saved to an account. Download your current answer before leaving or reloading. Written work on paper or in another app stays in your own file.
See the answer and explanation
1001
9 = 8 + 1, so include the 8 and 1 places and skip 4 and 2: 1001.
Take it further
Change the width to five unsigned bits with places 16, 8, 4, 2, 1. Expected encoding of 16: 10000; largest value: 31.
Nothing here is saved to an account or sent to a teacher. The answer download includes your current choice and any checked feedback.
Check the subject sources
These LifeStarter passages, scenarios and exercises are authored for this Academy with AI assistance and review. External resources keep their publishers’ terms. A grade label suggests a starting level; it does not establish alignment with your school’s complete requirements.