Lesson 4.5.4.9

4.5.4.9 Underflow and overflow Quiz: AQA Computer Science, Unit 5

20 questions

In partnership with Revision Ninja

Lesson 4.5.4.9, Underflow and overflow: 20 multiple choice questions for the AQA Computer Science (7517), Unit 5: Fundamentals of data representation, written with Revision Ninja.

Host it live on the board and students join with a game code on their own devices, or revise alone with Free Play. The answers are revealed in the game.

Host this setFree Play

The 20 questions

  1. What is overflow in a number representation?

    • A result whose magnitude is too small to be told apart from zero
    • An error caused by a sign bit set to zero
    • A result whose magnitude is too large to be stored in the available bits
    • A result that has been rounded to fewer digits
  2. What is underflow in a number representation?

    • A result whose magnitude is too small to be represented, so it becomes zero or is lost
    • A carry out of the most significant bit, which shows that the true sum needs an extra bit
    • A result that is too large for the exponent field, so the stored value wraps around to zero
    • A value stored with more bits than it needs, which wastes space in the representation used
  3. In floating point, when does underflow most commonly occur?

    • When a number is converted from binary to decimal, which can lose the final digits in the output
    • When two positive values are added together and the sum is larger than the format can hold
    • When a mantissa has more bits than the format allows, so the extra bits are simply dropped
    • When a very small value needs an exponent below the smallest that can be stored
  4. In which circumstance does overflow occur in unsigned integer addition?

    • When the sum needs more bits than are available, so a carry out of the top bit is produced
    • When the sum is less than zero, because an unsigned result cannot be stored in the register at all
    • When the two numbers being added are equal, because the adder then produces a carry every time
    • When a fraction is added to an integer, since the fraction must be stored in a separate register
  5. What happens in two's complement when a result exceeds the largest positive value?

    • The result is rounded to the nearest representable value without error
    • The result wraps around and gives an incorrect negative value, which is overflow
    • The result is stored correctly as a larger positive number
    • The sign bit is ignored and the result stays positive
  6. Which is an example of underflow?

    • A timestamp stored with more bits than it needs, so the extra bits are never used by the system
    • A large population stored in a 16-bit unsigned integer that cannot hold the full count of people
    • The sum of 255 and 1 in 8-bit unsigned binary, which needs more bits than the eight available
    • A very small probability stored as a floating point value below the smallest representable magnitude
  7. Which is an example of overflow?

    • Adding 1 to 255 in 8-bit unsigned binary, which needs 9 bits to store
    • Converting 1010 from binary to decimal, which gives the value 10 without any loss of precision
    • Storing 0.5 in a fixed point format that has enough fractional bits to hold it exactly
    • Storing 0 in unsigned binary, where the all-zero pattern is the smallest value the format holds
  8. Does 9 + 8 overflow in 4-bit unsigned binary?

    • Yes, since 17 exceeds the 4-bit maximum of 15
    • No, since 17 is less than 32, the value of two to the power of five
    • Only if the sum is negative, because unsigned binary can only overflow below zero
    • No, since 9 + 8 equals 1 in 4 bits when the carry is kept as part of the sum
  9. A value of 10^-41 is stored in a floating point format whose smallest positive magnitude is 10^-38. What happens?

    • It overflows into the sign bit
    • It underflows and is stored as zero or lost
    • It overflows and becomes infinity
    • It is stored exactly because it is small
  10. A 4-bit two's complement register holds 0111 (7) and adds 1. What is the result?

    • 0111, unchanged
    • 1000, which is -8, so the result overflows
    • 1000, which is +8 correctly
    • 0000, with a carry out and no error
  11. Subtract 5 from 3 in 4-bit unsigned binary. What happens?

    • The result cannot be negative, so it wraps to 1110, which is 14
    • The result is 1110, which is -2 correctly, because the subtraction is performed in two's complement form
    • The result is 0010, which is 2, because the smaller operand is subtracted from the larger in the register
    • The result is 0000 with no error, since the subtraction saturates at zero for any negative value
  12. A floating point exponent is too large to store in its field. What is this error called?

    • Overflow
    • Normalisation
    • Underflow
    • Rounding error
  13. An 8-bit two's complement value is 127 and 1 is added. What is the result?

    • 128, which is correct
    • -127
    • -128, which is an overflow
    • 0, with no overflow
  14. Does adding 64 and 63 overflow in 8-bit unsigned binary?

    • No, since 127 is within the 8-bit range
    • Yes, since 64 + 63 exceeds 64
    • Yes, since 127 needs 8 bits and overflows
    • No, because a carry is never an overflow
  15. Which check detects overflow in unsigned addition of two n-bit numbers?

    • The sign bit of the result being 1
    • The result having an odd number of 1s
    • A carry out of the most significant bit
    • The result being less than the first operand
  16. Why can overflow in two's complement be detected when two positive numbers are added?

    • Two positive numbers cannot sum to a negative value, so a negative sign bit signals that the true sum is out of range
    • Overflow is detected by checking whether the result is zero, since a zero result can only come from wrapping
    • A carry out of the top bit always means overflow in two's complement, so carries are checked first
    • A negative sign bit always shows a correct answer, so the sign alone confirms the result is valid
  17. Why do rounding and underflow both matter in scientific computing?

    • They are identical errors, so a single check for one of them also covers the other kind
    • They never occur together, since rounding removes underflow entirely from any stored result
    • They only affect integers, so fractions can be ignored safely in any scientific calculation
    • Very small values can be lost to zero and rounding accumulates, so results may be inaccurate
  18. An 8-bit unsigned counter is at 254 and increments three times. What value is shown, and what happens?

    • 257, which needs 9 bits and is stored correctly
    • 0, with no overflow
    • 255, since the counter stops at its maximum
    • 1, after wrapping past 255, with an overflow event
  19. Which statement about underflow in floating point is correct?

    • Underflow is avoided entirely by normalising the mantissa, since the leading bit is always kept
    • Underflow always produces a larger value than the true result, because the stored value is rounded up
    • Values below the smallest representable magnitude are lost, often becoming zero
    • Underflow only happens with negative exponents in fixed point, never in any floating point format
  20. An accumulator is 16 bits wide, and a running sum exceeds 65535. What is the best description?

    • Normalisation, because the running sum must be shifted left until its leading bit is one again
    • Underflow, because the running sum is too small to store in the sixteen bits available to it
    • Rounding error only, since no bit was lost when the running sum was held in the accumulator
    • Overflow of the accumulator, since the running sum needs more bits than the 16-bit container

All AQA Computer Science quizzes