Photo AI

Convert the number -120 into 8 bit two's complement. - Scottish Highers Computing Science - Question 1 - 2018

Question icon

Question 1

Convert-the-number--120-into-8-bit-two's-complement.-Scottish Highers Computing Science-Question 1-2018.png

Convert the number -120 into 8 bit two's complement.

Worked Solution & Example Answer:Convert the number -120 into 8 bit two's complement. - Scottish Highers Computing Science - Question 1 - 2018

Step 1

Step 1: Convert 120 to Binary

96%

114 rated

Answer

To convert the positive number 120 into binary, we can divide the number by 2 and record the remainders:

120 ÷ 2 = 60, remainder 0
60 ÷ 2 = 30, remainder 0
30 ÷ 2 = 15, remainder 0
15 ÷ 2 = 7, remainder 1
7 ÷ 2 = 3, remainder 1
3 ÷ 2 = 1, remainder 1
1 ÷ 2 = 0, remainder 1

Reading the remainders from bottom to top, we get:

120 = 01111000 (in binary)

Step 2

Step 2: Find the Two's Complement

99%

104 rated

Answer

To find the two's complement of a binary number, we follow these steps:

  1. Invert the bits (change 0 to 1 and 1 to 0).
  2. Add 1 to the inverted binary number.

Start with the binary representation of 120:

01111000

Inverting the bits gives:

10000111

Now, add 1:

10000111
+        1
---------
10001000

Thus, the two's complement of -120 is:

10001000

Join the Scottish Highers students using SimpleStudy...

97% of Students

Report Improved Results

98% of Students

Recommend to friends

100,000+

Students Supported

1 Million+

Questions answered

;