Computer-Science-A-level-Ocr
-
3-3-networks8 主题
-
3-2-databases7 主题
-
3-1-compression-encryption-and-hashing4 主题
-
2-5-object-oriented-languages7 主题
-
2-4-types-of-programming-language4 主题
-
2-3-software-development5 主题
-
2-2-applications-generation6 主题
-
2-1-systems-software8 主题
-
1-3-input-output-and-storage2 主题
-
1-2-types-of-processor3 主题
-
1-1-structure-and-function-of-the-processor1 主题
-
structuring-your-responses3 主题
-
the-exam-papers2 主题
-
8-2-algorithms-for-the-main-data-structures4 主题
-
8-1-algorithms10 主题
-
7-2-computational-methods11 主题
-
7-1-programming-techniques14 主题
-
capturing-selecting-managing-and-exchanging-data
-
entity-relationship-diagrams
-
data-normalisation
-
relational-databases
-
hashing
-
symmetric-vs-asymmetric-encryption
-
run-length-encoding-and-dictionary-coding
-
lossy-and-lossless-compression
-
polymorphism-oop
-
encapsulation-oop
-
inheritance-oop
-
attributes-oop
-
methods-oop
-
objects-oop
-
capturing-selecting-managing-and-exchanging-data
-
6-5-thinking-concurrently2 主题
-
6-4-thinking-logically2 主题
-
6-3-thinking-procedurally3 主题
-
6-2-thinking-ahead1 主题
-
6-1-thinking-abstractly3 主题
-
5-2-moral-and-ethical-issues9 主题
-
5-1-computing-related-legislation4 主题
-
4-3-boolean-algebra5 主题
-
4-2-data-structures10 主题
-
4-1-data-types9 主题
-
3-4-web-technologies16 主题
-
environmental-effects
-
automated-decision-making
-
computers-in-the-workforce
-
layout-colour-paradigms-and-character-sets
-
piracy-and-offensive-communications
-
analysing-personal-information
-
monitoring-behaviour
-
censorship-and-the-internet
-
artificial-intelligence
-
the-regulation-of-investigatory-powers-act-2000
-
the-copyright-design-and-patents-act-1988
-
the-computer-misuse-act-1990
-
the-data-protection-act-1998
-
adder-circuits
-
flip-flop-circuits
-
simplifying-boolean-algebra
-
environmental-effects
bitwise-manipulation-and-masks
What are Logical Shifts?
-
Logical shifts are the process of moving the bits in a binary number to the left or right by a specified number of places
-
Bitwise manipulation uses logical operators like AND, OR, XOR, and NOT to manipulate binary numbers
Logical Shifts
-
Logical binary shifts are operations performed on binary numbers where all the bits in the number are moved left or right by a specified number of positions
-
These shifts are commonly used in computer programming and digital systems
-
There are two types of logical binary shifts: Left and Right
Example left shift
The following number is shifted by two places to the left.

Original number: 00001110 = 14
Left shift (2) result: 00111000 = 56
Each left shift has doubled the number:
-
Original value = 14
-
Left shift 1 – Doubled the number to 28
-
Left shift 2 – Doubled the number to 56
Example right shift
The following number is shifted by three places to the right.

Original number: 11001000 = 200
Right shift (3) result: 00011001 = 25
Each right shift has halved the number:
-
Original value = 200
-
Right shift 1 – Halved the number to 100
-
Right shift 2 – Halved the number to 50
-
Right shift 3 – Halved the number to 25
Bitwise Manipulation
What is a mask?
-
A mask is a binary number used in bitwise operations to isolate, modify, or test specific bits in another binary value
-
Think of a mask as a filter: it lets certain bits through and blocks others, depending on the bitwise operation being used
Why use a mask?
-
To extract certain bits from a binary number (e.g. the lower 4 bits)
-
To set specific bits to 1
-
To clear specific bits (set them to 0)
-
To toggle (flip) specific bits
Bitwise AND operation
If both bits are 1 in the binary number and the mask, the result will be 1. Otherwise, the result will be 0.
|
Description |
128 |
64 |
32 |
16 |
8 |
4 |
2 |
1 |
|---|---|---|---|---|---|---|---|---|
|
Binary |
1 |
0 |
1 |
1 |
1 |
0 |
0 |
1 |
|
Mask |
0 |
0 |
1 |
1 |
0 |
0 |
0 |
0 |
|
Result |
0 |
0 |
1 |
1 |
0 |
0 |
0 |
0 |
Bitwise OR operation
If either bit is 1 in the binary number or the mask, the result will be 1. Otherwise, the result will be 0.
|
Description |
128 |
64 |
32 |
16 |
8 |
4 |
2 |
1 |
|---|---|---|---|---|---|---|---|---|
|
Binary |
1 |
1 |
0 |
0 |
1 |
0 |
1 |
0 |
|
Mask |
0 |
1 |
1 |
1 |
0 |
0 |
0 |
0 |
|
Result |
1 |
1 |
1 |
1 |
1 |
0 |
1 |
0 |
Bitwise XOR operation
If only 1 of the bits is 1 in the binary number or the mask, the result will be 1. Otherwise, the result will be 0.
|
Description |
128 |
64 |
32 |
16 |
8 |
4 |
2 |
1 |
|---|---|---|---|---|---|---|---|---|
|
Binary |
1 |
0 |
1 |
0 |
1 |
0 |
1 |
0 |
|
Mask |
0 |
0 |
1 |
1 |
0 |
0 |
0 |
0 |
|
Result |
1 |
0 |
0 |
1 |
1 |
0 |
1 |
0 |
Responses