Logical left shift

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

Logical left shift

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. After a logical left shift, what fills the empty place on the right?
A A 1
B A 0
2. Which direction does every bit move in a logical left shift?
A One place to the right
B One place to the left
3. What happens to the leftmost bit when you do a logical left shift?
A It falls off the end and is lost
B It moves round to the right end
4. What is 00000101 after one logical left shift in 8 bits?
A 00001010
B 00000010
5. What is 11000011 after one logical left shift in 8 bits?
A 10000110
B 10000111

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
100000101 << 1 = 00001010 A00010111 << 1 = 00101110
211000011 << 1 = 10000110 B10110001 << 1 = 01100010
3Zeros come in on the right: after a left shift, the empty right-hand place is filled with 0. CA logical left shift by one place: every bit moves one place left and a 0 fills the empty right end.
4Bits shifted off the left end are lost: the leftmost bit is dropped and cannot be recovered. DThe empty place on the right was filled with 1. A logical left shift always fills it with 0, so the answer should be 01100110.
500000101 << 1 = 10000010 EThis is a right shift result. In a left shift the bits move left and a 0 fills the right end, so the answer should be 00001010.
600110011 << 1 = 01100111 FThe leftmost 1 falls off the end and is lost, and a 0 enters on the right.

Definitions

logical left shift

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
Logical ____ shift: 00000101 -> 00001010
2.
00000101 __ 1 = 00001010
3.
11000011 << 1 = 1000011_
4.
00000011 << _ = 00001100
5.
10000001 << 1 = ________

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A Register: 0000101
B Shift left by 1 place
C Drop the leftmost bit: 0
D Add 0 on the right
E Result: 00001010
Question 2
A x = 00000011
B x = x >> 1
C # bits move one place left
D # 0 enters on the right
E # x is now 00000110
Question 3
A Start: 00010110
B Shift left 1 place
C Leftmost bit 0 goes to right
D New right bit is 0
E Result: 00101100
Question 4
A Start: 11000001
B Shift left 1 place
C Leftmost 1 is dropped
D New right bit is 1
E Result: 10000010
Question 5
A n = 00000100
B n = n << 2
C print(n)
D # shifted left by 1, 00001000

Answer Key

Logical left shift
Section A: Quick Questions
Q1
B — A 0
Q2
B — One place to the left
Q3
A — It falls off the end and is lost
Q4
A — 00001010
Q5
A — 10000110
Section B: Match the Pairs
Q1
00000101 << 1 = 00001010 → A logical left shift by one place: every bit moves one place left and a 0 fills the empty right end.
Q2
11000011 << 1 = 10000110 → The leftmost 1 falls off the end and is lost, and a 0 enters on the right.
Q3
Zeros come in on the right: after a left shift, the empty right-hand place is filled with 0. → 00010111 << 1 = 00101110
Q4
Bits shifted off the left end are lost: the leftmost bit is dropped and cannot be recovered. → 10110001 << 1 = 01100010
Q5
00000101 << 1 = 10000010 → This is a right shift result. In a left shift the bits move left and a 0 fills the right end, so the answer should be 00001010.
Q6
00110011 << 1 = 01100111 → The empty place on the right was filled with 1. A logical left shift always fills it with 0, so the answer should be 01100110.
Section C: Definitions
Q1
logical left shift — Moves every bit one place left. The leftmost bit falls off and is lost, and a 0 fills the empty place on the right. In 8 bits, 00000101 becomes 00001010.
Section D: Fill in the Blanks
Q1
Logical left shift: 00000101 -> 00001010
Q2
00000101 << 1 = 00001010
Q3
11000011 << 1 = 10000110
Q4
00000011 << 2 = 00001100
Q5
10000001 << 1 = 00000010
Section E: Spot the Error
Q1
A — An 8-bit register holds exactly 8 bits. 0000101 has only 7 bits. The register should be 00000101.
Q2
B — << is the left shift operator. >> shifts right. The line should be x = x << 1.
Q3
C — In a logical left shift the leftmost bit is dropped and lost. It does not wrap round to the right. The line should say the leftmost bit 0 is dropped.
Q4
D — A logical left shift always fills the empty right-hand place with 0, never 1. The line should say the new right bit is 0.
Q5
B — Shifting 00000100 left by 1 place gives 00001000. << 2 would shift two places and give 00010000. The line should be n = n << 1.