wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

AP CSP U1 Mastery Check 1

Total questions: 7

Worksheet time: 4mins

Name
Class
Date
1.

A certain programming language uses 4-bit binary sequences to represent nonnegative integers. For example, the binary sequence 0101 represents the corresponding decimal value 5. Using this programming language, a programmer attempts to add the decimal values 14 and 15. Which of the following best describes the result of this operation? (DAT-1.B.3)

a)

The correct sum of 29 will be calculated and stored.

b)

An overflow error will occur because 4 bits is not large enough to represent either of the values 14 or 15.

c)

An overflow error will occur because 4 bits is not large enough to represent 29, the sum of 14 and 15.

d)

A round-off error will occur because the decimal values 14 and 15 are represented as approximations due to the fixed number of bits used to represent numbers.

2.

An online store uses 6-bit binary sequences to identify each unique item for sale. The store plans to increase the number of items it sells and is considering using 7-bit binary sequences. Which of the following best describes the result of using 7-bit sequences instead of 6-bit sequences? (DAT-1.C.5)

a)

2 more items can be uniquely identified.

b)

2 more items can be uniquely identified.

c)

2 times as many items can be uniquely identified.

d)

10 times as many items can be uniquely identified.

3.

A video game character can face toward one of four directions: north, south, east, and west. Each direction is stored in memory as a sequence of four bits. A new version of the game is created in which the character can face toward one of eight directions, adding northwest, northeast, southwest, and southeast to the original four possibilities. Which of the following statements is true about how the eight directions must be stored in memory? (DAT-1.B.1)

a)

Four bits are not enough to store the eight directions. Five bits are needed for the new version of the game.

b)

Four bits are not enough to store the eight directions. Eight bits are needed for the new version of the game.

c)

Four bits are not enough to store the eight directions. Sixteen bits are needed for the new version of the game.

d)

Four bits are not enough to store the eight directions. Sixteen bits are needed for the new version of the game.

4.

In a certain computer program, two positive integers are added together, resulting in an overflow error. Which of the following best explains why the error occurs? (CRD-2.I.4)

a)

The program attempted to perform an operation that is considered an undecidable problem.

b)

The precision of the result is limited due to the constraints of using a floating-point representation.

c)

The program can only use a fixed number of bits to represent integers; the computed sum is greater than the maximum representable value.

d)

The program cannot represent integers; the integers are converted into decimal approximations, leading to rounding errors.

5.

The player controls in a particular video game are represented by numbers. The controls and their corresponding binary values are shown in the following table.

The numeric values for the controls can also be represented in decimal (base 10). What control is represented by the decimal value 15? (DAT-1.C.1)

a)

b)

c)

d)

6.

Each student that enrolls at a school is assigned a unique ID number, which is stored as a binary number. The ID numbers increase sequentially by 1 with each newly enrolled student. If the ID number assigned to the last student who enrolled was the binary number 1001 0011, what binary number will be assigned to the next student who enrolls? (DAT-1.C.4)

a)

1001 0100

b)

1001 0111

c)

1101 0100

d)

1101 0111

7.

A program developed for a Web store represents customer account balances using a format that approximates real numbers. While testing the program, a software developer discovers that some values appear to be mathematically imprecise. Which of the following is the most likely cause of the imprecision? (DAT-1.B.3)

a)

The account balances are represented using a fixed number of bits, resulting in overflow errors.

b)

The account balances are represented using a fixed number of bits, resulting in round-off errors.

c)

The account balances are represented using an unlimited number of bits, resulting in overflow errors.

d)

The account balances are represented using an unlimited number of bits, resulting in round-off errors.