← Computer Science

Logical shifts and two's complement

Two more 8-bit skills for Paper 1. A logical shift moves every bit left or right to multiply or divide. Two's complement lets a byte hold negative numbers as well as positive ones.

Slide 1 / 4

Logical left shift

Logical left shift by 2 places 22 00010110 every bit moves 2 places left 88 01011000 0s fill in on the right 22 × 4 = 88
  • In a logical left shift, every bit moves left by the number of places given.
  • Zeros fill the empty places on the right. Bits pushed off the left end are lost.
  • Each place shifted multiplies the number by 2. Two places multiplies by 4, three places by 8.
  • If a 1 is pushed off the left end, the answer is wrong. 11000000 (192) shifted left once gives 10000000 (128), not 384.

Check you've got it

0/4

1. The 8-bit number 00001100 (12) is given a logical left shift of 2 places. What is the result?

2. A positive 8-bit number is given a logical right shift of 3 places. No 1s are lost. What happens to its value?

3. What is −45 in 8-bit two's complement?

4. What is the denary value of the 8-bit two's complement number 10000001?

Practise exam-style questions on this

Type your answer, see your mark against the mark scheme in seconds. Free, 5 a day.

Start practising →

Teaching this topic?

Mark your whole class's answers and see who's stuck, for £19 a month.

See the class plan →

Free revision content. Multiple-choice answers are marked instantly. Written answers are marked by AI on /free-mark. Independent, not endorsed by Cambridge International.