SLIDE 1
CSZone.co.uk
Click to reveal · Arrow keys also work
OCR J277 · Component 1 · Topic 1.2.4d

Binary Shifts

Left Shifts · Right Shifts · Multiplying and Dividing in Binary · Issues with Shifts · Exam Practice

CSZone OCR GCSE Computer Science J277
Learning Objectives

By the end of this video you will be able to...

Explain what is meant by a binary shift
Perform a left binary shift and state its effect — multiplying by a power of 2
Perform a right binary shift and state its effect — dividing by a power of 2
Explain the issues that can occur when shifting binary digits, including the loss of data
Apply all of this to exam-style questions
⚡ Builds on the place value method from 1.2.4a — the same 8-bit columns: 128, 64, 32, 16, 8, 4, 2, 1
Binary Shifts

What is a binary shift?

DEFINITION
A binary shift moves every bit in a binary number a number of places to the left or to the right.
A left shift moves all the bits towards the most significant (leftmost) end of the register.
A right shift moves all the bits towards the least significant (rightmost) end of the register.
⚡ Whichever direction the bits move, the spaces left empty at the other end are filled with 0s.
Left Shifts

A left shift multiplies the number

RULE
Shifting a binary number left by one or more places multiplies it by a power of 2.
←1 place = ×2
Shift left by 1 place doubles the value.
←2 places = ×4
Shift left by 2 places quadruples the value.
←3 places = ×8
Shift left by 3 places multiplies the value by 8.
Worked Example — Left Shift

Shifting 00001101 (13) left

1286432168421
Start = 1300001101
←1 place00011010
= 00011010 = 26  (13 × 2 = 26 ✓) — a new 0 fills the right
←2 places00110100
= 00110100 = 52  (13 × 4 = 52 ✓)
←3 places01101000
= 01101000 = 104  (13 × 8 = 104 ✓)
Right Shifts

A right shift divides the number

RULE
Shifting a binary number right by one or more places divides it by a power of 2.
→1 place = ÷2
Shift right by 1 place halves the value.
→2 places = ÷4
Shift right by 2 places divides the value by 4.
→3 places = ÷8
Shift right by 3 places divides the value by 8.
Worked Example — Right Shift

Shifting 01101000 (104) right

1286432168421
Start = 10401101000
→1 place00110100
= 00110100 = 52  (104 ÷ 2 = 52 ✓) — a new 0 fills the left
→2 places00011010
= 00011010 = 26  (104 ÷ 4 = 26 ✓)
→3 places00001101
= 00001101 = 13  (104 ÷ 8 = 13 ✓)
Issues with Shifts

What happens to bits at the edge?

THE PROBLEM
A register only has a fixed number of bits (e.g. 8). When a shift moves bits off the end of the register, those bits are permanently lost.
Left shift: bits fall off the left (most significant) end. Losing a significant bit makes the result much smaller than expected.
Right shift: bits fall off the right (least significant) end. The result is rounded down, and the shift cannot be reversed to get the original number back.
⚡ Both directions still fill the empty spaces with 0 — but it's the bits pushed off the opposite end that cause the problem.
Data Loss — Left Shift

Shifting 11000000 (192) left by 1

2561286432168421
11000000
←1 place11000000
The leading 1 (worth 256) is pushed off the end and lost.
RESULT
Only 8 bits remain: 10000000 = 128. We expected 192 × 2 = 384, but only 128 is stored.
⚡ The multiply-by-2 rule breaks down when a significant bit is shifted off the register.
Data Loss — Right Shift

Shifting 00000111 (7) right by 1

1286432168421lost
00000111
→1 place00000111
The trailing 1 (worth 1) is pushed off the right end and lost.
RESULT
Remaining 8 bits: 00000011 = 3. We expected 7 ÷ 2 = 3.5, but binary can't store fractions — the result is rounded down to 3.
⚡ Check it can't be reversed: shifting 00000011 (3) left by 1 gives 6, not 7.
Exam Technique

Identifying a shift from before and after

EXAM-STYLE TASK
A question may give a binary number before and after a shift, and ask you to state the direction and number of places shifted.
1286432168421
Before = 300000011
After = 2400011000
Direction: the bits have moved towards the most significant end — this is a left shift.
PLACES
3 → 24 is ×8, and ×8 = 2³, so this is a shift left by 3 places. Exam answer: "Left shift, 3 places".
Exam Practice

Exam-Style Questions — Binary Shifts

Question 1 · 2 marks
Shift the binary number 00001011 left by 2 places. Give your answer in binary and state the effect on the denary value.
ANS
00101100 — denary value is multiplied by 4 (11 × 4 = 44)
Question 2 · 2 marks
Shift the binary number 11100000 right by 3 places. Give your answer in binary and denary.
ANS
00011100 = 28 (224 ÷ 8 = 28, no bits lost)
Common Mistakes

Four mistakes that cost marks in the exam

1
Forgetting to fill empty places with 0. After any shift, the spaces left behind must be filled with 0 — never left blank.
2
Mixing up the direction. Left shift = multiply (value gets bigger). Right shift = divide (value gets smaller).
3
Assuming ×2ⁿ / ÷2ⁿ always holds exactly. If a bit is shifted off the end of the register, it is lost — the result will not be exactly the expected multiple or fraction.
4
Getting the number of places wrong. Shift by 1 place = ×2 or ÷2. Shift by n places = ×2ⁿ or ÷2ⁿ — not ×2 multiplied by n.
Summary

1.2.4d — Binary Shifts

LEFT SHIFT
Multiplies by a power of 2. n places = ×2ⁿ. New 0s fill in on the right.
RIGHT SHIFT
Divides by a power of 2. n places = ÷2ⁿ. New 0s fill in on the left.
DATA LOSS
Bits shifted off the end of the register are permanently lost — left shift loses significant bits, right shift loses precision.
EXAM SKILL
Compare before/after binary to identify direction and number of places shifted.
⚡ Exam phrasing: "Shifting left by n places multiplies the value by 2ⁿ; shifting right by n places divides the value by 2ⁿ. Bits shifted beyond the register are lost."
CSZone.co.uk

That's 1.2.4d done.

Next up: 1.2.4e — Character Encoding

Full quiz, instantly marked worksheet and slides at CSZone.co.uk