FREE! Click here to Join FunTrivia. Thousands of games, quizzes, and lots more!
Quiz about Think like a computer Pure Binary
Quiz about Think like a computer Pure Binary

Think like a computer! Pure Binary! Quiz


Computers compute values using ones and zeros, but they are also limited in space: only so many digits. Here are questions surrounding the use of one-byte registers of ye very olde computers.

A multiple-choice quiz by PJMayo. Estimated time: 6 mins.
  1. Home
  2. »
  3. Quizzes
  4. »
  5. Science Trivia
  6. »
  7. Computers
  8. »
  9. Software and Programming

Author
PJMayo
Time
6 mins
Type
Multiple Choice
Quiz #
263,961
Updated
Dec 03 21
# Qns
10
Difficulty
Tough
Avg Score
6 / 10
Plays
1049
- -
Question 1 of 10
1. Two one-byte registers contain 10110110 and 01001010. What would be the result of an addition operation between the two registers? The result is also placed into a one-byte register. And what would be the resulting state of a carry flag? Hint


Question 2 of 10
2. A computer can shift bits left or right in a register. A one-byte register with 00110100 would contain 01101000 after a left bit-shift. What is this doing to the value stored in that register? Hint


Question 3 of 10
3. When a computer shifts bits left in a one-byte register, it uses the carry flag as a ninth bit, to capture any overflow. What would be the result of four left bit shifts on a register containing 00101011? Hint


Question 4 of 10
4. When a computer shifts bits right, it can use the carry flag as an placeholder for that extra bit, to capture the rightmost bit as it is shifted out of the register to the right. What do you think another nickname for this flag is when used this way? Hint


Question 5 of 10
5. Computers like to be logical. Another type of operation between two registers is a bit-wise AND operation. What would be the result of a bit-wise AND between 01101110 and 01010101? Hint


Question 6 of 10
6. What do you think the result of a bit-wise OR operation between 01101110 and 01010101 would be? Hint


Question 7 of 10
7. The folks who designed computers wanted to represent both positive and negative values in a register. They wanted a scheme where addition operations have correct results without getting fancy. Can you recognize which of the following schemes is used almost exclusively to represent negative values? A positive and its negative example are shown for each method. Hint


Question 8 of 10
8. You may have noticed when using two's complement to represent negative values, the leftmost bit in the register actually represents something specific. What does it represent? Hint


Question 9 of 10
9. Given two one-byte registers containing 01011000 and 00110000, what kind of result would you have by adding them together? Hint


Question 10 of 10
10. This quiz has been using one-byte registers throughout. What is the common term used to describe computers with processors using registers of this size? Hint



(Optional) Create a Free FunTrivia ID to save the points you are about to earn:

arrow Select a User ID:
arrow Choose a Password:
arrow Your Email:




Quiz Answer Key and Fun Facts
1. Two one-byte registers contain 10110110 and 01001010. What would be the result of an addition operation between the two registers? The result is also placed into a one-byte register. And what would be the resulting state of a carry flag?

Answer: 00000000, carry flag set

The carry flag is like a ninth bit for many operations. So with adding 10110110 and 1001010 resulting in 100000000, the eight zeroes are placed in the destination register, and ninth bit, 1, is placed in the carry flag, setting it. A flag is simply a bit which is set when 1 and clear when 0.
2. A computer can shift bits left or right in a register. A one-byte register with 00110100 would contain 01101000 after a left bit-shift. What is this doing to the value stored in that register?

Answer: Doubling the value

The computer inserts a zero on the right after shifting all bits left. As we are working with binary values, adding a zero to the end of a binary number is equivalent to multiplying the binary number by binary 10 or two. A computer inserts a zero to the left and dumps the rightmost bit after a shift right, which is equivalent to halving the value (and rounding down).
3. When a computer shifts bits left in a one-byte register, it uses the carry flag as a ninth bit, to capture any overflow. What would be the result of four left bit shifts on a register containing 00101011?

Answer: 10110000, carry flag clear

A computer does not stop shifting when the carry flag is set. The program would have had to react to the setting of a flag. Since we just shifted left four times without stopping, we got interesting results. The first and second shifts were straight forward, to 01010110 and to 10101100, with 0 in the carry flag after both. On the next shift, the register contains 01011000, and the carry flag contains 1, and is set.

But because we did not stop and shifted once more, the last shift placed a 0 in the carry flag, clearing it. We lost that last bit. If our goal had been to multiply the value in the register by sixteen (four doublings), we failed, because we did not account for the limited size of the register.
4. When a computer shifts bits right, it can use the carry flag as an placeholder for that extra bit, to capture the rightmost bit as it is shifted out of the register to the right. What do you think another nickname for this flag is when used this way?

Answer: Remainder bit

Since shifting bits to the right is equivalent to dividing the contents by binary 10 (or two), the bit that shifts into the carry bit ends up being the remainder of that division. The remainder after dividing by two is either one or zero.
5. Computers like to be logical. Another type of operation between two registers is a bit-wise AND operation. What would be the result of a bit-wise AND between 01101110 and 01010101?

Answer: 01000100

The bit-wise AND operation compares each bit position in one register to each bit position in the other register. That same position in the result is 1 only if the bit of one register AND the bit of the other register are both 1. In other words 1 AND 1 is 1, 1 AND 0 is 0, 0 AND 1 is 0, and 0 AND 0 is 0.
6. What do you think the result of a bit-wise OR operation between 01101110 and 01010101 would be?

Answer: 01111111

The bit-wise OR operation compares each bit position in one register to each bit position in the other register. That same position in the result is 1 if either the bit of one register OR the bit of the other register is 1. In other words 1 OR 1 is 1, 1 OR 0 is 1, 0 OR 1 is 1, and 0 OR 0 is 0.
7. The folks who designed computers wanted to represent both positive and negative values in a register. They wanted a scheme where addition operations have correct results without getting fancy. Can you recognize which of the following schemes is used almost exclusively to represent negative values? A positive and its negative example are shown for each method.

Answer: Inverting the bit values and adding one. Pos: 00010100, Neg: 11101100

The scheme picked for representing negative values is called "two's complement". The other examples, inverting all bits (called "one's complement") and simply setting the leftmost bit (sometimes called "signed magnitude"), can work to represent negative values but both schemes represent zero in two different ways, which complicates things.

Inverting bit values and subtracting one is not a feasible scheme for representing negative values. There is a better scheme where numbers are represented in order from lowest negative to highest positive.

It is called "excess" or "offset". It is the similar to two's complement except the leftmost bit is inverted where 1 represents a positive value and 0 represents a negative value. This scheme was not used because unsigned and equivalent positive signed values didn't match up. (They were offset.)
8. You may have noticed when using two's complement to represent negative values, the leftmost bit in the register actually represents something specific. What does it represent?

Answer: It represents the sign of the value

The leftmost bit is commonly referred to as the sign bit when representing integer values. The signed values represented in one-byte is -128 to -127. Only the right seven bits represent the magnitude, whereas with unsigned values where the leftmost bit does not represent the sign values can range from 0 to 255.

The value -128 is represented by 10000000. Reversing the two's complement to get the positive, subtract 1 (01111111) and invert bits gets you 1000000 again, which, if unsigned, would instead represent +128.
9. Given two one-byte registers containing 01011000 and 00110000, what kind of result would you have by adding them together?

Answer: A negative value, when using two's complement to represent signed values

Adding 01011000 and 00110000 results in 10001000, which represents either a positive value (132) or a negative value (-120) when using two's complement. If you using two's complement to represent negative values, you have just added two positive values resulting in a negative value, which could mean a possible bug in your programming! There is a special flag called an overflow flag that detects when this occurs.
10. This quiz has been using one-byte registers throughout. What is the common term used to describe computers with processors using registers of this size?

Answer: 8-bit

Old game consoles, like NES, used 8-bit processors. The earliest IBM PC used the Intel 8088 processor, a 16-bit processor with an 8-bit bus. (Memory was still accessed in 8-bit pieces.) Windows had to be upgraded not to long ago to work on 32-bit processors, the common processors of today. Now the common user is beginning to make the transition to 64-bit processors. Think of the progression: from 8-bit registers holding integer values ranging from -128 to +127 to 16-bit registers holding integer values ranging from -32,768 to +32,767 to 32-bit registers holding integer values ranging from −2,147,483,648 to +2,147,483,647 to 64-bit registers working with integers from -9,223,372,036,854,775,808 to +9,223,372,036,854,775,807, a range so large software developers don't even bother looking up the range! And there are 128-bit processors out there....
Source: Author PJMayo

This quiz was reviewed by FunTrivia editor crisw before going online.
Any errors found in FunTrivia content are routinely corrected through our feedback system.
11/21/2024, Copyright 2024 FunTrivia, Inc. - Report an Error / Contact Us