ExamYard Lectures

Binary shifts and bit manipulation

A Level Computer Science 9618 · Chapter 4, Processor fundamentals · 6-minute lecture

The teaching part (1 min) is free to watch. A free account opens the whole lecture: 2 worked examples, 5 practice questions, 1 real past-paper question with the answer explained, the mistakes that lose marks, the full-marks tip, a one-card summary and a quick quiz.

What this lecture covers

  1. Multiplying by sliding
  2. Logical shifts
Read the transcript of the teaching part

Last time

Before we start: last time, in Memory, buffers, embedded systems and control, you learned these points. Here they are again on one card. Keep them in mind, because today builds on them.

Multiplying by sliding

In denary, to multiply by ten you add a zero: slide every digit one place left. Binary works the same way, with two. Slide the bits left to multiply by two, and right to divide by two. And with AND, OR and XOR you can switch single bits on, off or over, which is how real programs control hardware.

Logical shifts

A logical left shift moves every bit left. The left bit drops off, and a zero enters on the right. A logical right shift moves every bit right. The right bit drops off, and a zero enters on the left. Each place shifted left multiplies by two, provided no ones fall off the left end.

Chapter 4: Processor fundamentals

Also for A Level Computer Science 9618

Which topics come up most in A Level Computer Science 9618 past papers, counted from every paper since 2004: Paper 1 topic frequency, Paper 2 topic frequency.