Photo AI
Last Updated Sep 27, 2025
Revision notes with simplified explanations to understand Bitwise Manipulation & Masks quickly and effectively.
454+ students studying
Bitwise manipulation involves working directly with the binary representation of data. This is often used in low-level programming tasks, such as optimising performance or controlling hardware. Masks are specific binary patterns applied using bitwise operators to isolate, modify, or combine certain bits within binary data. Understanding bitwise operations and how to apply masks is essential for efficient programming and problem-solving in Computer Science.
Bitwise operators perform operations on individual bits of binary numbers.
Example:
1101 (13)
& 1011 (11)
------
1001 (9)
Example:
1101 (13)
| 1010 (10)
------
1111 (15)
Example:
1101 (13)
^ 1010 (10)
------
0111 (7)
Shifts move all bits in a binary number to the left or right.
Example:
0011 << 2 = 1100
Example:
1100 >> 2 = 0011
A mask is a binary pattern used with bitwise operators to manipulate specific bits in another binary number.
Example 1: Using an AND Mask to Isolate Bits Isolate the last 4 bits of the number 10111011 using an AND mask.
Operation:
10111011
& 00001111
----------
00001011
Result:
1011 (decimal 11).
Example 2: Using an OR Mask to Set Bits Set the last 3 bits of 10100000 to 1.
Operation:
10100000
| 00000111
----------
10100111
Result:
10100111.
Example 3: Using an XOR Mask to Toggle Bits Toggle the last 4 bits of 11110000.
Operation:
11110000
^ 00001111
----------
11111111
Result:
11111111.
Example 4: Left Shift Perform a left shift of 2 positions on 00001101.
Operation:
00001101 << 2 = 00110100
Result:
00110100 (decimal 52).
Example 5: Right Shift Perform a right shift of 3 positions on 10110000.
Operation:
10110000 >> 3 = 00010110
Result:
00010110 (decimal 22).
Enhance your understanding with flashcards, quizzes, and exams—designed to help you grasp key concepts, reinforce learning, and master any topic with confidence!
90 flashcards
Flashcards on Bitwise Manipulation & Masks
Revise key concepts with interactive flashcards.
Try Computer Science Flashcards9 quizzes
Quizzes on Bitwise Manipulation & Masks
Test your knowledge with fun and engaging quizzes.
Try Computer Science Quizzes29 questions
Exam questions on Bitwise Manipulation & Masks
Boost your confidence with real exam questions.
Try Computer Science Questions27 exams created
Exam Builder on Bitwise Manipulation & Masks
Create custom exams across topics for better practice!
Try Computer Science exam builder12 papers
Past Papers on Bitwise Manipulation & Masks
Practice past papers to reinforce exam experience.
Try Computer Science Past PapersDiscover More Revision Notes Related to Bitwise Manipulation & Masks to Deepen Your Understanding and Improve Your Mastery
Join 500,000+ A-Level students using SimpleStudy...
Join Thousands of A-Level Students Using SimpleStudy to Learn Smarter, Stay Organized, and Boost Their Grades with Confidence!
Report Improved Results
Recommend to friends
Students Supported
Questions answered