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 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

  Binary shifts add or subtract a binary number

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

  every digit in the number is moved one place

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

  every digit in the number is deleted

  every digit in the number is moved 10 places.

 3. To multiply, the digits are moved:

  one place to the left

  one place to the top

  none of the above

  one place to the right

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

  one place to the right

  none of the above

  one pace to the left

  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 _______________

  topmost position

  bottom most position

  leftmost position

  rightmost position

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

  topmost digit is subtracted

  leftmost digit is discarded

   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 _____________________.

  exploding bits

  binary maths error

  binary overflow

  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 incorrect, because it is not possible to add zero to the rightmost bit

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

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

  It is incorrect, because the answer should be 16

 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

  11110001

  1000000

  11100101

 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.

  multiply

  divide

  subtract

  add

 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
==================================================
???????????????????????????????????????????????????

  none of the above

  It will add instead of multiply the numbers

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

  Nothing spectacular. It will work as expected

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

  right shift

  addition

  overflow

  multiplication

 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

  nit

  flag

  rag

  nibble

 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 right shift has been applied but the result has not been added to another bit of '1'

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

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

  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 twice to the left, not right.

  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 just once to the right