Learn in your language
Skip to content
IGCSE · Cambridge (CIE) · 0265

Binary arithmetic, shifts and two’s complement

Add fixed-width positive binary numbers, explain overflow, compare logical and cyclic shifts, and encode signed values in eight-bit two’s complement.

Cambridge IGCSE Computer Science 0265 · 2029 syllabus · Version 1 · 1

Mapped to the Cambridge IGCSE Computer Science 0265 syllabus for exams in 2029. These original explanations and self-checks are independent study support, not Cambridge papers, official marks or grades. Practical programming is taught with worked code and trace tasks; an executable Python workspace and timed digital-exam simulation are not yet available.

Before you begin

  • Use the 2029 syllabus for this course. Cambridge specifies Python 3.10 or higher for programming and digital exams for both components. The syllabus currently identifies this route for 2029 only; confirm later-year availability with Cambridge and your school.

Work on paper. Try each question before revealing help, and explain why your method works.

Quick readiness check

Before binary arithmetic, shifts and two’s complement, which statement is the safest starting point?

What you will learn

  • Add two positive 8-bit binary integers and detect overflow
  • Perform and explain logical and cyclic shifts
  • Convert signed values to and from 8-bit two’s complement

Fixed-width arithmetic can overflow

Binary addition follows the same column method as denary, but each column uses base 2. In an 8-bit positive value, a carry beyond the leftmost bit cannot be stored. That is overflow: the stored result no longer represents the true sum.

Hexadecimal gives a shorter, more readable way to write a long binary pattern. It is useful in contexts such as memory addresses and colour codes, where each hex digit maps neatly to four bits.

Shifts move bits in different ways

A logical left or right shift moves every bit a chosen number of places and fills the vacated positions with zero. Bits shifted beyond the fixed-width boundary are lost. A left shift often multiplies an unsigned value by two per place if no overflow occurs; a right shift divides by two, discarding remainders.

A cyclic shift wraps the bits that leave one end around to the other end. It preserves all eight bits but changes their positions. For two’s complement, use the required eight-bit pattern and interpret the leftmost bit as the sign: values range from −128 to 127.

Pause and explain

Which habit best checks your understanding of binary arithmetic, shifts and two’s complement?

Put the idea to work

Worked example

Represent −13 in eight-bit two’s complement.

Show the worked solution
  1. Write +13 as 00001101.
  2. Invert every bit to get 11110010.
  3. Add one: 11110011.

Answer −13 is 11110011 in 8-bit two’s complement.

Try a topic test

Choose Easy, Normal or Difficult. Save your answers and open worked review after finishing.

Test this topic →

From guided practice to a new situation

Write your answer and reasoning first. Use a hint only if you are stuck. The model solution is for self-checking; your written work is not automatically marked.

1 · Guided

Add 11110000 and 00110000 as positive 8-bit binary integers. State whether overflow occurs.

Give me a hint

Add columns from the right and keep track of the ninth carry.

Compare my reasoning
  1. The mathematical sum is 1 0010 0000.
  2. Only eight result bits fit: 00100000.
  3. The carry beyond bit 7 means the positive 8-bit result overflowed.

The stored 8-bit result is 00100000 and overflow occurs.

Look for these in your work

  • Columns added
  • Stored width respected
  • Overflow identified
2 · Independent

Apply a logical right shift of two places to 10110110. Give the result and explain the lost bits.

Give me a hint

Move every bit two places right; fill the left with zeros.

Compare my reasoning
  1. The two rightmost bits, 10, leave the byte.
  2. Shift the remaining bits right and add two zeros at the left.
  3. The eight-bit result is 00101101.

00101101; the two discarded bits are lost.

Look for these in your work

  • Shift direction correct
  • Zeros inserted
  • Discarded bits stated
3 · Transfer

A device rotates the byte 10010001 one place to the left. Show the output and compare it with a logical left shift.

Give me a hint

A cyclic shift moves the outgoing leftmost bit to the opposite end.

Compare my reasoning
  1. The leftmost 1 leaves the first position.
  2. Move the remaining seven bits left.
  3. Wrap the 1 into the rightmost position: 00100011. A logical shift would insert 0 instead.

Cyclic: 00100011; logical: 00100010.

Look for these in your work

  • Outgoing bit tracked
  • Cyclic result correct
  • Logical difference explained

Common mistakes

  • Ignoring a carry beyond bit 7 when deciding whether overflow occurred.
  • Assuming a logical shift rotates discarded bits back in.
  • Negating a two’s-complement value without inverting and adding one.
Recall without your notes

What can you explain now?

After an 8-bit logical left shift, what fills the rightmost position?

Compare with the explanation

0

Logical shifts fill the vacated position with zero; cyclic shifts wrap bits.

After trying it yourself, choose your next review. This is your self-assessment.

Your review choice appears on Today. Sign in to sync it across devices.

Make it stick

What distinguishes overflow, logical shifts, cyclic shifts and the sign bit in two’s complement?

If you needed the solution, close it and solve the problem again from a blank page. A correct answer is stronger when you can explain the reason for each step.

Keep learning Computer Science

Course scope and assessment

All 11 syllabus topics link to 33 original lessons. Each lesson includes worked teaching, a check with explanation and guided, independent and application practice. This is mapped teaching, not evidence of exam readiness, teacher approval or a Cambridge grade. Cambridge specifies two externally assessed digital exams; StudyForA does not yet provide full timed digital-paper simulations or an executable Python 3.10+ workspace for practical programming. The currently published syllabus is for 2029; later-year coverage is not claimed.

StudyForA · Learn with understanding

Original teaching content and links to official sources. Check your exam year and qualification before using a resource.