Cambridge 9618 Data Representation: Binary, Bitwise Operations, Two’s Complement & File Size | Hannan Class 7
- H1: Binary Data Representation Explained: Addition, Overflow, Shifts, Bitwise Operations, Two’s Complement and File Size
- H2: Why Binary Data Representation Matters in Computer Science
- H2: Understanding Bits, Bit Patterns and Binary Place Values
- H3: How Many Values Can n Bits Represent?
- H3: Why the Maximum Unsigned Value Is 2ⁿ − 1
- H2: How Binary Addition Works
- H3: Binary Carry Rules and Overflow Errors
- H2: Binary Shifts Explained
- H3: Logical Left Shift: Multiplying by Powers of Two
- H3: Logical Right Shift: Dividing by Powers of Two
- H3: Logical vs Arithmetic Right Shift
- H2: Bitwise Operations and Binary Masks
- H3: AND: Checking and Clearing Bits
- H3: OR: Setting Bits to 1
- H3: XOR: Toggling and Inverting Bits
- H2: Representing Negative Numbers with Two’s Complement
- H3: How to Convert a Positive Binary Number into a Negative Number
- H2: Digital Audio: Sampling Rate and Sampling Resolution
- H2: Calculating Audio and Video File Sizes
- H2: Common Exam Mistakes and How to Avoid Them
- H2: Conclusion
-
Binary Data Representation Explained: Addition, Overflow, Shifts, Bitwise Operations, Two’s Complement and File Size
Binary can look intimidating when you first meet a screen full of zeros and ones. Yet beneath that intimidating surface, most binary questions follow a surprisingly small collection of rules. Once you understand place values, bit capacity, addition, overflow, shifts, masks, and two’s complement, many exam questions stop feeling like unrelated problems and start looking like variations of the same idea. That is exactly what the lesson behind this guide demonstrates: binary is not about memorizing endless patterns; it is about understanding what happens to individual bits and why. Pasted text
This topic is particularly important for students studying computer science because binary connects abstract mathematics to real computer hardware. Registers have limited sizes. Bits can be shifted. A processor can use logical operations to manipulate individual values. Digital sound and video ultimately become collections of bits whose storage requirements can be calculated mathematically. Even something as simple as turning an LED on or off in an embedded system can eventually come down to changing a particular bit from 0 to 1 or from 1 to 0.
There is also an exam technique hiding inside all of this. A student may understand a concept but still lose marks by skipping working, forgetting a carry, confusing bits with bytes, using
2¹⁶when a calculation requires a 16-bit sampling resolution, or treating a logical shift as though it automatically preserves a negative sign. The lesson repeatedly emphasizes understanding the operation before attempting the arithmetic. That approach is useful because binary questions often contain tiny details that completely change the answer.Think of binary as a row of switches. Every switch has a position, and every position has a value. Once you know which switches are on and what those positions are worth, you can reconstruct the number. From there, addition, shifting, masking, signed values, audio sampling and multimedia calculations become extensions of the same fundamental principle.
-
📚 Class Slides: If you’re studying this topic for an upcoming lesson or exam, use the class slides alongside this guide. The slides provide the original lesson material, diagrams, worked binary examples, and key concepts covered in class, while the explanations below expand on those ideas step by step. [View/Download the Class Slides Here – INSERT CLASS SLIDES LINK]
-
Why Binary Data Representation Matters in Computer Science
Computers work with binary states, conventionally represented by 0 and 1. At the hardware level, these states provide a practical way of representing information electronically. But the important idea for a student is not simply that "computers use binary." You need to understand what becomes possible when multiple bits are combined.
One bit gives two possible patterns:
0
1Two bits give four:
00
01
10
11Three bits provide eight possible combinations, ranging from
000through111. The pattern is predictable because every additional bit doubles the number of possible combinations.That relationship is:
Number of possible combinations = 2ⁿ
where n represents the number of bits.
The lesson uses this relationship repeatedly, beginning with one-, two- and three-bit systems before connecting it to larger register sizes. Pasted text The same principle scales beautifully. Eight bits provide 256 possible patterns. Sixteen bits provide 65,536 possible patterns. With 64 bits, the number becomes enormous.
This matters because a computer does not have an infinitely large box in which to store a number. A register has a defined word size, meaning that only a certain number of bits can be stored. If the hardware is working with an 8-bit value, for example, there are eight available positions. A calculation that requires a ninth position can therefore create an overflow condition.
This is where binary stops being merely a number-conversion exercise. The number of bits determines what the machine can represent. It influences maximum values, overflow, signed-number ranges, masking operations and even how arithmetic behaves.
A useful mental picture is a row of eight lockers. You can rearrange what is inside those lockers, but you cannot magically create locker number nine. If an operation produces something that requires a ninth locker, you have a capacity problem. That simple idea explains binary overflow remarkably well.
Understanding Bits, Bit Patterns and Binary Place Values
Binary uses powers of two as place values. In ordinary denary numbers, moving one position to the left multiplies the place value by ten. Binary follows the same positional principle, except its base is 2 rather than 10.
For an 8-bit unsigned binary number, the place values are:
Bit position 7 6 5 4 3 2 1 0 Place value 128 64 32 16 8 4 2 1 Consider:
00101101
To convert it into denary, identify the positions containing 1:
0×128 + 0×64 + 1×32 + 0×16 + 1×8 + 1×4 + 0×2 + 1×1That becomes:
32 + 8 + 4 + 1 = 45
So:
00101101₂ = 45₁₀
This place-value method is also an excellent way to check binary arithmetic. The lesson explicitly discusses converting the original binary numbers and the resulting sum into denary to confirm whether an addition has been performed correctly. Pasted text If binary number A represents 20 and binary number B represents 12, their binary sum should represent 32. If it does not, something went wrong.
Notice how closely this resembles denary mathematics. The symbols are different, but the underlying positional logic is familiar. A
1does not have one universal value. Its value depends on where it appears.That becomes especially important when studying binary shifts. Moving a bit one place to the left changes its place value. A bit worth 32 can become worth 64. Move it again and it can become worth 128. Nothing magical happened to the bit itself; its position changed, and therefore its value changed.
How Many Values Can n Bits Represent?
The formula 2ⁿ tells us how many different patterns can be constructed using n bits. This is one of the most useful formulas in binary data representation because it allows you to reason about capacity without writing every possible combination.
Take three bits:
2³ = 8
The patterns are:
000
001
010
011
100
101
110
111There are eight combinations.
A common mistake appears immediately, though. Students sometimes see eight combinations and assume the highest represented unsigned value must therefore be eight. It is not.
The values begin at 0.
So the eight possible unsigned values are:
0, 1, 2, 3, 4, 5, 6 and 7
The lesson spends time clarifying precisely this distinction: the number of possible combinations is not the same as the highest value represented. Pasted text
For eight bits:
2⁸ = 256 combinations
Those combinations can represent unsigned values from:
0 to 255
For sixteen bits:
2¹⁶ = 65,536 combinations
So the unsigned range is:
0 to 65,535
You can think of it like numbered seats in a theatre. If there are 256 seats but numbering starts at seat 0, the final seat number is 255. You still have 256 seats; the label on the last one simply reflects where counting began.
This distinction becomes crucial when answering questions about overflow. An 8-bit unsigned register cannot store 256 merely because
2⁸ = 256. It has 256 patterns, and pattern zero is already being used to represent zero. Therefore its largest unsigned value is 255.Why the Maximum Unsigned Value Is 2ⁿ − 1
The maximum unsigned value that can be represented with n bits is:
2ⁿ − 1
Why subtract one?
Because counting starts at zero.
For three bits:
2³ − 1 = 7
The largest binary pattern is:
111
Its denary value is:
4 + 2 + 1 = 7
For eight bits:
2⁸ − 1 = 255
The maximum pattern is:
11111111
which represents:
128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255
This gives you a powerful shortcut during exams. If a question tells you an unsigned 8-bit register is being used, you should immediately associate it with the range 0–255. If the result of an arithmetic operation is greater than 255, it cannot be represented correctly in that fixed-width unsigned register.
Suppose you add:
200 + 100 = 300
Both 200 and 100 individually fit within an unsigned 8-bit value. Their result does not.
That distinction matters. Overflow is not necessarily caused because one of the input values is already invalid. Two completely valid values can produce a result outside the representable range.
The lesson uses essentially this reasoning when discussing an 8-bit register and a result of 300. Pasted text Instead of blindly performing a long binary addition, you can sometimes predict an overflow before touching the bits. If you already know the register's maximum is 255 and the mathematical answer is 300, you know the operation requires more capacity.
How Binary Addition Works
Binary addition uses the same column-by-column strategy you learned for ordinary arithmetic, but there are only two digits to work with. The fundamental combinations are therefore much easier to memorize.
Calculation Result Carry 0 + 0 0 0 0 + 1 1 0 1 + 0 1 0 1 + 1 0 1 The final rule causes most of the confusion:
1 + 1 = 10₂
That does not mean one plus one somehow became "ten" in ordinary denary arithmetic.
10₂is the binary representation of denary 2.The
0remains in the current column while the1is carried into the next column. The lesson explains this by emphasizing that an individual binary position can hold only one bit. You cannot place10into a single bit position, so one part stays and the other is carried. Pasted textConsider:
0101 + 0011 ------ 1000Working from right to left:
1 + 1 = 10→ write 0, carry 1.Next column:
0 + 1 + carried 1 = 10→ write 0, carry 1.Next:
1 + 0 + carried 1 = 10→ write 0, carry 1.Finally:
0 + 0 + carried 1 = 1.So:
0101 + 0011 = 1000
In denary:
5 + 3 = 8
That gives you an immediate checking method. Convert the two inputs to denary, add them, then convert or evaluate the binary result. If both paths produce the same value, your binary arithmetic is likely correct.
The real danger appears when the final carry has nowhere to go.
Binary Carry Rules and Overflow Errors
An overflow occurs when the result of an operation cannot be represented within the available number of bits.
Imagine an 8-bit register. It has exactly eight positions:
_ _ _ _ _ _ _ _If addition produces:
1 00000000you now need nine bits.
Where does that leftmost
1go?In a fixed 8-bit result, there is no ninth position available to store it. That is the central hardware idea emphasized in the lesson: the register has a fixed capacity, so an extra bit cannot simply be squeezed into the existing positions. Pasted text
The unsigned range provides another way to detect the same problem:
Maximum 8-bit unsigned value = 255
Therefore:
200 + 100 = 300
requires a value outside the 0–255 range.
Overflow is sometimes misunderstood as "the computer did the addition incorrectly." A better interpretation is that the mathematical result requires more bits than the chosen representation provides.
Picture an eight-seat minibus with nine passengers waiting. The ninth passenger does not make the other eight seats larger. The vehicle simply lacks sufficient capacity. A register behaves similarly: its width places a hard limit on the bit pattern it can hold.
This is why exam questions may ask you to identify, explain, or predict overflow. Do not merely say "the answer is too big." Connect your explanation to the bit width:
The result requires more bits than are available in the register.
That language demonstrates the underlying computer-science concept rather than merely describing the symptom.
Binary Shifts Explained
A binary shift moves bits left or right within a register. It looks simple—and mechanically, it is—but shifts become far more useful when you connect movement to place value.
Suppose we have:
00100000
The
1currently occupies the 32 position.Shift everything one place left:
01000000
The
1now occupies the 64 position.The number has doubled.
That gives us the core rule:
One left shift multiplies an unsigned value by 2, provided no significant bit is lost through the fixed register boundary.
Likewise, shifting right moves a bit toward smaller place values.
01000000represents 64.Shift right:
00100000Now it represents 32.
The value has been divided by two.
The source lesson emphasizes exactly this connection between movement and place value, explaining that multiple shifts correspond to powers of two. Pasted text Once that relationship clicks, shift questions become much easier because you can predict the mathematical result before moving a single bit.
Logical Left Shift: Multiplying by Powers of Two
A logical left shift moves every bit toward the left and introduces zeros into the empty positions on the right.
One left shift corresponds to:
× 2
Two left shifts correspond to:
× 2² = × 4
Three left shifts correspond to:
× 2³ = × 8
In general:
n left shifts → multiply by 2ⁿ
For example, suppose:
00000101 = 5
Shift left once:
00001010 = 10
Shift left again:
00010100 = 20
We started at 5 and shifted two places:
5 × 2² = 5 × 4 = 20
There is, however, an important qualification: fixed register size matters.
If bits fall off the left side, information may be lost. Therefore the multiplication shortcut works cleanly only when the result remains representable in the available width.
This connects shifts directly back to overflow. Binary concepts are rarely isolated islands. Register width affects addition, unsigned ranges, signed numbers and shifting alike.
An exam question might ask for both the resulting binary pattern and its denary value. In that case, do not stop after shifting. Rewrite the bits carefully, check which zeros enter, identify any bits that disappear, and then calculate the new denary value using place values.
Logical Right Shift: Dividing by Powers of Two
A logical right shift performs the opposite movement. Every bit moves toward a lower place value, and zeros enter from the left.
For positive unsigned integers:
One right shift ≈ divide by 2
Two right shifts ≈ divide by 4
Three right shifts ≈ divide by 8
More generally:
n right shifts → divide by 2ⁿ
Take:
00111000
Its denary value is:
32 + 16 + 8 = 56
Shift right once:
00011100
That equals:
16 + 8 + 4 = 28
So:
56 ÷ 2 = 28
Shift right once more:
00001110
which represents 14.
Therefore:
56 ÷ 4 = 14
The lesson repeatedly connects right shifting with division and left shifting with multiplication. Pasted text This is worth memorizing, but understanding why makes it far harder to forget. Every movement right reduces a bit's place value by a factor of two.
There is another subtle issue. If a right shift removes a
1from the least significant end, integer information can be discarded. So binary shifting behaves naturally with whole-number arithmetic rather than magically preserving fractions.The bigger complication arrives when the binary pattern represents a negative signed number. A logical shift introduces zeros from the left, which can destroy the sign. That is why computer science distinguishes a logical right shift from an arithmetic right shift.
Logical vs Arithmetic Right Shift
Logical and arithmetic shifts may appear almost identical on paper, but their treatment of the sign makes them fundamentally different for signed binary values.
A logical right shift inserts zeros on the left.
An arithmetic right shift preserves the sign by replicating the sign bit on the left.
Suppose a two’s complement number begins with
1. That leading1indicates a negative value. If you logically shift right and insert0, the new most significant bit becomes zero. You may accidentally transform the interpretation from negative to positive.An arithmetic right shift avoids that problem by filling the new positions using the original sign bit.
The lesson gives special attention to this distinction, showing that a logical right shift can destroy the sign whereas an arithmetic right shift preserves it. Pasted text It also connects a two-place arithmetic shift to division by four because:
2² = 4
So a value such as −32 shifted arithmetically right by two places should correspond to:
−32 ÷ 4 = −8
That gives you another excellent exam-checking technique. Do the bit manipulation, but also predict the expected mathematical result. If the arithmetic shift produces a pattern that does not represent approximately the expected signed value, inspect your sign extension.
A useful memory phrase is:
Logical shift moves the pattern; arithmetic right shift protects the sign.
That one distinction can prevent several common mistakes.
Bitwise Operations and Binary Masks
Bitwise operations are where binary begins to feel less like school arithmetic and more like actual computer control.
Suppose a hardware register contains eight bits, and each bit controls a different output. One bit might control an LED, another a motor, another an alarm and another a relay. You want to change one output without disturbing everything else.
Rewriting the entire register would be risky.
Instead, you can use a binary mask.
The lesson uses embedded systems to make this idea concrete, describing hardware such as washing machines, coffee machines, cars and other processor-controlled systems. Pasted text A bit can represent an output state: perhaps
1means an LED is on while0means it is off.A mask gives you selective control.
The three operations to remember are:
Operation Typical masking purpose AND Check or clear selected bits OR Set selected bits to 1 XOR Toggle selected bits This table is tiny, but it represents one of the most useful pieces of knowledge in the entire topic.
Why?
Because exam questions often describe the desired outcome in ordinary language:
"Clear bits 2 and 3."
"Set bit 0."
"Check whether bit 7 is set."
"Toggle selected bits."
Your first task is to translate that language into the correct logical operation.
AND: Checking and Clearing Bits
The AND operation produces 1 only when both corresponding inputs are 1.
Its truth table is:
A B A AND B 0 0 0 0 1 0 1 0 0 1 1 1 This makes AND ideal for clearing bits.
If you AND any bit with 0:
0 AND 0 = 0
1 AND 0 = 0
Either way, the result is zero.
So a zero in the mask acts like an eraser.
What if you do not want to change a bit?
AND it with 1:
0 AND 1 = 0
1 AND 1 = 1
The original value survives.
Imagine:
Register: 10110110 Mask: 11110000 ----------------- Result: 10110000The first four bits are preserved because they are ANDed with
1. The final four are cleared because they are ANDed with0.The lesson applies exactly this idea when discussing clearing part of a register while leaving other bits untouched. Pasted text
AND is also useful for checking a bit. To inspect a particular position, create a mask with
1in the position you want and zeros elsewhere. The unwanted bits are blocked, while the selected bit can pass through if it is set.So when you see words such as check, test, or clear, AND should immediately enter your mind.
OR: Setting Bits to 1
The OR operation outputs 1 when at least one of its inputs is 1.
A B A OR B 0 0 0 0 1 1 1 0 1 1 1 1 Notice something useful.
If you OR a bit with 1:
0 OR 1 = 1
1 OR 1 = 1
Whatever the original value was, the result becomes 1.
That means OR can force a selected bit to 1.
Meanwhile:
0 OR 0 = 0
1 OR 0 = 1
ORing with zero leaves the original bit unchanged.
So the masking rule becomes wonderfully simple:
Use 1 where you want to set a bit. Use 0 where you want to preserve it.
For example:
Register: 10110100 Mask: 00000001 ----------------- Result: 10110101Only the final bit changes.
The lesson explicitly distinguishes this from checking or clearing: if the task is to force/set a bit to one, OR is the appropriate operation. Pasted text
A good mental image is that OR is an injector. A
1in the mask injects a one into the result. A zero keeps its hands off the existing value.That gives you a compact exam memory rule:
AND clears. OR sets. XOR toggles.
XOR: Toggling and Inverting Bits
XOR, or exclusive OR, is particularly useful because it outputs 1 when the two corresponding inputs are different.
A B A XOR B 0 0 0 0 1 1 1 0 1 1 1 0 Look at what happens when a bit is XORed with 1:
0 XOR 1 = 1
1 XOR 1 = 0
The bit flips.
Now XOR it with zero:
0 XOR 0 = 0
1 XOR 0 = 1
The bit stays unchanged.
Therefore:
Mask 1 = toggle this bit.
Mask 0 = leave this bit alone.
That makes XOR ideal for something like an on/off button. Suppose a bit represents whether an LED is active. If the LED is off, XOR can turn it on. If it is already on, applying the same XOR mask can turn it off.
The source lesson uses precisely this type of hardware analogy, explaining how XOR can invert selected outputs without disturbing other positions. Pasted text
For example:
Register: 10110100 Mask: 00001111 ----------------- Result: 10111011The upper four bits remain untouched while the lower four are inverted.
This is why the word toggle is such a strong clue in an exam question. If you read "toggle," "flip," "invert selected bits," or "change 1 to 0 and 0 to 1," think XOR.
Representing Negative Numbers with Two’s Complement
Unsigned binary is straightforward because every bit contributes a positive place value. But computers also need to represent negative integers.
A common method is two’s complement.
In an 8-bit two’s complement system, the most significant bit carries negative significance. The place values can be viewed as:
Bit 7 6 5 4 3 2 1 0 Value -128 64 32 16 8 4 2 1 This gives the 8-bit signed range:
−128 to +127
That asymmetry often surprises students. There is one more negative value than positive value because zero occupies one of the available patterns.
Two’s complement is powerful because it allows computer hardware to perform signed arithmetic using convenient binary mechanisms. From an exam perspective, however, you need to be comfortable converting a positive number into its negative representation.
The lesson demonstrates this using examples such as −5 and later asks for an 8-bit representation related to −45. Pasted text The process is consistent:
- Write the positive number in the required number of bits.
- Invert every bit.
- Add 1.
-
The final step is extremely important. Forgetting the
+1produces the one's complement, not the required two’s complement representation.This is one reason showing working matters. If you make a tiny arithmetic mistake at the final stage, an examiner may still be able to award credit for earlier correct steps.
How to Convert a Positive Binary Number into a Negative Number
Let's convert +45 into −45 using 8-bit two’s complement.
First convert 45 into binary:
45 = 32 + 8 + 4 + 1
Therefore:
00101101
Now invert every bit:
0 → 1
1 → 0So:
00101101
becomes:
11010010
Now add 1:
11010010 + 1 ---------- 11010011Therefore:
−45 = 11010011 in 8-bit two’s complement.
The source lesson arrives at this same pattern during its worked discussion. Pasted text
The safest way to remember the procedure is:
positive binary → flip → add one
Do not skip the first stage by attempting to "guess" the negative pattern. Guessing works until it does not, and exam questions are designed to reward a reproducible method.
There is also a useful way to check the answer using signed place values:
11010011means:
−128 + 64 + 16 + 2 + 1
which equals:
−45
So the conversion checks out.
The biggest exam trap here is stopping after inversion. If you invert
00101101and write11010010, you are one step short. The lesson specifically stresses remembering that final addition. Pasted textDigital Audio: Sampling Rate and Sampling Resolution
Digital audio brings binary data representation into the real world. A physical sound wave is analogue—it varies continuously. To store that sound digitally, the system takes measurements, or samples, of the signal.
Two terms matter enormously:
Sampling rate tells you how many samples are taken per second.
Sampling resolution, often called bit depth, tells you how many bits are used to represent the amplitude of each sample.
The source lesson explicitly distinguishes these definitions and then asks what happens when both are increased. Pasted text
Increasing the sampling rate means the system measures the sound more frequently. Imagine trying to draw the shape of a roller coaster while looking at only five points along the track. You would get a rough impression. Give yourself hundreds of measurement points and you can reconstruct the shape far more accurately.
Sampling resolution affects the precision with which each measurement can be represented. More bits provide more possible amplitude levels.
For example:
8 bits → 2⁸ = 256 possible levels
16 bits → 2¹⁶ = 65,536 possible levels
Higher settings can therefore improve the accuracy of digital representation, but there is a cost: more data must be stored and transmitted.
That affects file size and bandwidth.
The lesson also discusses lossy compression and emphasizes that a good explanation should go beyond merely saying "it makes the file smaller." Pasted text The principle of lossy audio compression is that some data is permanently discarded, often exploiting perceptual characteristics so that less perceptually important information can be removed or represented less precisely.
For exams, therefore, connect each variable to both quality and storage rather than treating them as isolated definitions.
Calculating Audio and Video File Sizes
File-size calculations become much easier when you stop treating them as giant formulas to memorize and instead ask:
How much data is generated for each unit, and how many units are there?
For uncompressed audio, a useful relationship is:
File size in bits = sampling rate × sampling resolution × duration × number of channels
Suppose you have:
- 44,100 samples per second
- 16 bits per sample
- 3 minutes
- Stereo audio
-
Use the memory rule: AND checks or clears, OR sets, XOR toggles. With AND, zero can clear a selected bit. With OR, one can force a selected bit to one. With XOR, one flips the selected bit.
5. What is the formula for calculating an uncompressed audio file size?
A useful formula is:
File size in bits = sampling rate × sampling resolution × duration in seconds × number of channels
For stereo, use two channels. Divide the resulting number of bits by 8 to convert it to bytes.
First convert minutes to seconds:
3 × 60 = 180 seconds
Stereo means two channels, so:
44,100 × 16 × 180 × 2
The lesson highlights two classic mistakes here. First, 16-bit resolution means multiply by 16, not by
2¹⁶. Second, stereo requires accounting for two channels, whereas mono has one. Pasted textOnce you obtain bits, divide by 8 to obtain bytes.
If binary storage units are required:
1 KiB = 1024 bytes
1 MiB = 1024 KiB
The same logic applies to uncompressed video.
For a frame:
bits per frame = width × height × colour depth
Then:
total bits = bits per frame × frames per second × duration
If a video has a resolution of
1920 × 1080, 24-bit colour, runs at 30 frames per second and lasts 10 seconds:1920 × 1080 × 24 × 30 × 10
gives the raw number of bits before converting into bytes and larger units.
The lesson follows this same staged approach: calculate data per frame, account for the number of frames, convert bits to bytes, and then convert into larger units as required. Pasted text
Do not rush these questions. Write the units beside your calculations. Units act like road signs: they tell you whether you are still working with bits, have reached bytes, or need another conversion.
Common Exam Mistakes and How to Avoid Them
Binary questions are full of small traps, but most of them are predictable. The first is confusing number of combinations with maximum unsigned value. Eight bits provide 256 combinations, but the maximum unsigned value is 255 because zero is included.
Another common mistake is mishandling binary carries. Remember that:
1 + 1 = 10₂
Write zero and carry one.
Overflow also needs a precise explanation. Instead of vaguely saying "the number is too large," explain that the result requires more bits than the fixed-size register can store.
Shifts create another cluster of errors. A left shift generally corresponds to multiplication by powers of two, while a right shift corresponds to division by powers of two, subject to the limits and interpretation of the representation. For signed values, do not confuse a logical right shift with an arithmetic right shift. The arithmetic version preserves the sign by extending the sign bit.
Then there are masking questions:
AND → check/clear
OR → set
XOR → toggle
If you can recall those three associations, a large portion of bitwise-operation questions become easier.
Two’s complement brings one particularly expensive mistake: students invert the bits and forget to add one. The lesson specifically warns about showing working and remembering this final step. Pasted text
Multimedia calculations have their own traps. 16-bit sampling resolution means 16 bits per sample, not
2¹⁶bits per sample. Sampling rate measured in hertz refers to samples per second, so durations expressed in minutes need conversion. Stereo introduces two channels. And when converting from bits to bytes, divide by 8.A strong exam habit is to ask four questions before calculating:
What am I given? What units are they in? What am I being asked to find? What conversions are required?
That ten-second check can save several marks.
Conclusion
Binary data representation becomes much more manageable when you see the connections between its different topics. Bit width determines capacity. Place value determines numerical value. Addition can create overflow. Shifts change place values. AND, OR and XOR selectively manipulate bits. Two’s complement allows negative integers to be represented. Sampling converts analogue sound into digital measurements, and file-size calculations tell us how much binary data multimedia requires.
Those ideas are not separate chapters floating around independently. They are different applications of one underlying concept: computers represent and manipulate information using finite patterns of bits.
For exam preparation, understanding should come before memorization. Know why an 8-bit unsigned value stops at 255. Know why a left shift can double a value. Know why AND with zero clears a bit, why OR with one sets it, and why XOR with one flips it. Know why an arithmetic right shift needs to preserve a signed value's most significant bit. And when calculating multimedia storage, track the units rather than blindly multiplying numbers.
The lesson script also reinforces an especially valuable examination habit: show your working. Pasted text Binary problems often contain several stages, and a correct method can matter even when a later arithmetic slip occurs.
Once these patterns become familiar, binary stops looking like a wall of zeros and ones. It becomes a language with a small grammar—and once you know that grammar, you can read what the bits are doing.
FAQs
1. What is the maximum unsigned number that can be stored in 8 bits?
An 8-bit value provides 2⁸ = 256 possible combinations. Because the range begins at zero, the maximum unsigned value is 2⁸ − 1 = 255. Therefore an unsigned 8-bit register represents values from 0 to 255.
2. What causes binary overflow?
Overflow occurs when the result of an operation requires more bits than the available register can store. For example, an unsigned 8-bit register can represent a maximum of 255, so a result of 300 cannot be represented correctly within those eight bits.
3. What is the difference between logical and arithmetic right shifts?
A logical right shift inserts zeros from the left. An arithmetic right shift preserves the sign of a signed two’s complement value by extending the sign bit. This distinction is especially important when shifting negative numbers.
4. How do I remember AND, OR and XOR masks?
Author Bio
Cambridge Computer Science Tutor Author Bio
Ahmed Elmalla is a Computer Science educator, Certified Cambridge International AS & A Level Computer Science (9618) teacher, and software engineer with over 20 years of teaching, software engineering, and international tutoring experience. He specializes in AP Computer Science A (Java) and Cambridge IGCSE (0478) and AS & A Level Computer Science (9618), helping students build strong programming, computational thinking, and exam-solving skills. Through his Learn with Kemo platform, he has mentored students from around the world using practical, exam-focused instruction tailored to each learner's needs. His lessons combine real-world software engineering experience with personalized one-to-one tutoring, making complex Java and Computer Science concepts easier to understand. Ahmed is passionate about helping students gain confidence, improve academic performance, and achieve outstanding results in international Computer Science examinations.
LinkedIn: https://www.linkedin.com/in/akelmalla
WhatsApp: https://wa.me/60194028484
.png)
.png)
.png)


