Preview

08 - Binary Shift

 1. What is the purpose of Binary Shifts? Why do we need them?
Note: If you are able to, watch the following video on Binary Shift

  Binary shifts add or subtract a binary number

  Binary shifts make a binary number cease to exist

  Binary shifts make a binary number shift (physically in time and space)

  Binary shifts multiply or divide a binary number by 2

 2. In essence, what is done in a binary shift?

  every digit in the number is deleted

  every digit in the number is moved two places because it is binary (2)

  every digit in the number is moved one place

  every digit in the number is moved 10 places.

 3. To multiply, the digits are moved:

  none of the above

  one place to the top

  one place to the right

  one place to the left

 4. To divide, using a binary shift, the digits are moved:

  one place to the right

  one pace to the left

  none of the above

  one place to the very bottom

 5. When multiplying, if you move all the digits one place to the left, a 0 is inserted in the _______________

  rightmost position

  bottom most position

  leftmost position

  topmost position

 6. When dividing, the digits are moved and theā€¦.

  leftmost digit is discarded

  topmost digit is subtracted

   rightmost digit is discarded

  topmost digit is doubled

 7. True or False: Binary shifts cannot deal with fractions very well. Read the following and fill in the blanks.
if you are right shifting '111' (7 in decimal) it would become '11' which is 3 in Decimal. Humans don't mind adding another column to the left while multiplying but computers may have set sizes for numbers.  A CPU that left shifts a number will often drop the leftmost number, just like we drop the right most one while shifting. This can cause issues of _____________________.

  binary overflow

  exploding bits

  binary maths error

  mathematical conjunction

 8. Here is an example of a binary shift. Is the 'result' as shown, correct or incorrect?
Binary Shift Example
=====================
The below number is no. 4 in Decimal. We want to multiply by 2.

Shift every bit to the left by one and insert a zero to the 
rightmost bit. The original leftmost bit is discarded.

128   64     32     16    8     4     2    1
=============================================
0     0      0      0     0     1     0    0

Result
======

128   64     32     16    8     4     2    1
=============================================
0     0      0      0     1     0     0    0

  It is correct, because the answer is 8,and 00001000 is the binary for 8

  It is incorrect, because it is not possible to add zero to the rightmost bit

  It is incorrect, because the answer should be 16

  It is correct, but it is incorrect to discard the leftmost bit in this case.

 9. What is the result in binary after doing the left shift?
Binary Shift Example
=====================
The below number is no. 32 in Decimal. We want to multiply by 2.

Shift every bit to the left by one and insert a zero to the 
rightmost bit. The original leftmost bit is discarded.

128   64     32     16    8     4     2    1
=============================================
0     0      1     0     0    0    0    0

What is the Result in Binary?
======

128   64     32     16    8     4     2    1
=============================================
?     ?       ?      ?    ?     ?     ?    ?

  10000000

  1000000

  11100101

  11110001

 10. If we wish to ______ we shift every bit to the left by one and insert a zero to the rightmost bit. The original leftmost bit is discarded.

  subtract

  divide

  add

  multiply

 11. In decimal, you have the number 468, which is 111010100 in Binary. Shift it to the left to multiply by two and what happens?
Binary Shift Example
=====================
The below number is 468 in Decimal. We want to multiply by 2.

Shift every bit to the left by one and insert a zero to the 
rightmost bit. The original leftmost bit is discarded.

256   128   64     32     16    8     4     2    1
==================================================
1     1      1       0    1     0     1    0    0

What is the Result in Binary?
=============================
256   128   64     32     16    8     4     2    1
==================================================
???????????????????????????????????????????????????

  It will add instead of multiply the numbers

  You would get a result of 110101000 which is 424 - an overflow error has occurred

  none of the above

  Nothing spectacular. It will work as expected

 12. If 9 bits cannot be stored in an 8 bit register an _________ occurs.

  right shift

  addition

  multiplication

  overflow

 13. Overflow causes a lot of problems in the CPU and to address this a special __________(a single bit within a certain register) is used
note: the software that is responsible for carrying out the maths will read this _____ to see if an overflow has occurred. If the ___ shows that it has, then it will have to proceed to deal with the error

  nibble

  flag

  nit

  rag

 14. In the following example, can you spot the error. We are trying to divide 8 using binary shift.
The video will help, but you do not need it to answer the question.                                    Binary Shift Example
=====================
The below number is 8 in Decimal. We want to divide by 2.

Shift every bit to the right by one.
The original rightmost bit is discarded.

256   128   64     32     16    8     4     2    1
==================================================
0     0      0     0      0     1     0    0    0

What is the Result in Binary?
=============================
256   128   64     32     16    8     4     2    1
==================================================
 0     0     0      0      1    0     0     0    0 

  a single left shift has been applied instead of a single right shift

  two right shifts were necessary in order for the division to take place

  a single right shift has been applied but the result has not been added to another bit of '1'

  none of the above

 15. Can you spot the error in this binary shift (division)?
Binary Shift Example
=====================
The below number is 16 in Decimal. We want to divide by 4.

4 is 2 to the power of 2 (so we shift of two times to the right)

Shift every bit to the right by two. The original rightmost bit is discarded.

256   128   64     32     16    8     4     2    1
==================================================
0     0      0     0      1     0     0    0    0

What is the Result in Binary?
=============================
256   128   64     32     16    8     4     2    1
==================================================
 0     0     0      0      0    0     1     0    0 

= 4 in Decimal. 

  There is no error. The calculation and shift has been performed correctly

  The shift should have been one to the right, and the right most bit should not have been discarded but added to 1

  The shift should have been one twice to the left, not right.

  The shift should have been just once to the right