Data: abstraction, metadata, overflow & round-off errors

Computer Science · AP CSP

Question 1 of 10

0

    What causes a round-off error?

    Stuck? Read the explanation

    Unlocks at a streak of 5 correct answers in a row.

    Print a free worksheet (PDF)

    Embed this practice on your site or class page

    Paste this HTML into your page. Students practise right there; it is free and needs no account.

    Data: abstraction, metadata, overflow & round-off errors explained

    Data abstraction hides the detail of how data is stored and shows only what a user needs. A programmer might work with a list of student names without knowing how the list is held in memory. Abstraction makes programs easier to read and change, because the underlying storage can be altered without affecting the code that uses it.

    Metadata is data about other data. A digital photograph carries metadata such as the date it was taken, the camera model and the file size. Metadata helps people search, organise and check data, but it can also reveal private information.

    Computers store numbers in a fixed number of bits, so errors can occur. Overflow happens when a result is too large for the space allocated to store it, and the value wraps around. Round-off error happens when a number cannot be represented exactly, for example the decimal fraction 0.1 in binary floating point, so small errors build up in calculations.

    Worked example

    An 8-bit unsigned integer can store values from 0 to 255. Calculate 200 + 100 stored in this type.

    1. The true sum is 300, which is too large for 8 bits.
    2. The value wraps around, so the stored result is 300−256=44300 - 256 = 44.

    This is overflow, and a program that does not check for it will silently give the wrong answer. Round-off error can be seen in Python, where 0.1+0.20.1 + 0.2 gives 0.300000000000000040.30000000000000004 rather than exactly 0.30.3, because 0.1 has no exact binary form.

    What you will practise

    81 multiple-choice questions (Easy, Medium, Hard). Each answer is followed by an explanation.

    Example questions

    • What does abstraction mean in computing?
    • What is metadata?
    • What is an overflow error?
    • What causes a round-off error?
    • Which set of characteristics is most often used to describe big data?
    • Which is an example of data abstraction?
    • A value 3.14159 is stored as 3.14, keeping only two decimal places. What is this an example of?
    • What is a data set?

    …and 73 more.