wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

AP Computer Science Midterm Practice

Total questions: 38

Worksheet time: 19mins

Name
Class
Date
1.
a)

I only

b)

II only

c)

I and III

d)

II and III

2.

a)

include ← (floor > 10) OR (bedrooms = 3)

b)

include ← (floor ≥ 10) AND (bedrooms = 3)

c)

include ← (floor ≤ 10) OR (bedrooms = 3)

d)

include ← (floor ≤ 10) AND (bedrooms = 3)

3.

a)

1, 3

b)

3, 3

c)

3, 4

d)

4, 4

4.

a)

It allows programmers to implement algorithmic solutions to otherwise unsolvable problems.

b)

It eliminates the need for programmers to test completed programs.

c)

It enables programmers to create programs that use the lowest-level abstractions available.

d)

It helps programmers identify errors as components are added to a working program.

5.

A student is writing a program to model different real-world events using simulations. Which of the following simulations will generate a result that would best be stored using a Boolean variable?

a)

A simulation of flipping a fair coin

b)

A simulation of rolling a fair die (with sides numbered 1 through 6)

c)

A simulation of the temperature in a location over time

d)

A simulation of traffic patterns on a road

6.
a)

Code segment I displays the correct average, but code segment II does not.

b)

Code segment II displays the correct average, but code segment I does not.

c)

Both code segments display the correct average, but code segment I requires more arithmetic operations than code segment II.

d)

Both code segments display the correct average, but code segment II requires more arithmetic operations than code segment I.

7.

a)

Program A and program B display identical values.

b)

Program A and program B display the same values in different orders.

c)

Program A and program B display the same number of values, but the values differ.

d)

Program A and program B display a different number of values.

8.

a)

Program I correctly moves the robot to the gray square, but program II does not.

b)

Program II correctly moves the robot to the gray square, but program I does not.

c)

Both program I and program II correctly move the robot to the gray square

d)

Neither program I nor program II correctly moves the robot to the gray square.

9.

a)
b)
c)
d)
10.

a)

Participants who read more were generally more likely to say they are interested in the application.

b)

Participants who read more were generally less likely to say they are interested in the application.

c)

Participants who use a smartphone more were generally more likely to say they read more.

d)

Participants who use a smartphone more were generally less likely to say they read more.

11.

a)

end - start + 1

b)

( (end - start) / 5) + 1

c)

end - start + 6

d)

5 * (end - start) + 1

12.

a)
b)
c)
d)
13.

a)

Byte pair encoding is an example of a lossy transformation because it discards some of the data in the original string.

b)

Byte pair encoding is an example of a lossy transformation because some pairs of characters are replaced by a single character.

c)

Byte pair encoding is an example of a lossless transformation because an encoded string can be restored to its original version.

d)

Byte pair encoding is an example of a lossless transformation because it can be used to transmit messages securely.

14.

a)

III only

b)

I and II only

c)

I and III only

d)

I, II, and III

15.

a)

A= true, B= false, C= false, D= false

b)

A= true, B= true, C= false, D= false

c)

A= false, B= false, C= true, D= true

d)

A= fase, B= false, C= false, D= true

16.

a)

Max ( Max ( a, b ) , c)

b)

Max ( a, b ) + Max ( b, c ) - Max ( a, c )

c)

Max ( a, b ) - Max ( b, c )

d)

( Max ( a, b ) + Max ( b, c )) / 2

17.

a)
b)
c)
d)
18.

a)

adjustedTotal Max (midtermExam, final exam)

b)

adjustedTotal Max (midtermExam, final exam) + final exam

c)

adjustedTotal Max (midtermExam, final exam) + midtermExam

d)

adjustedTotal 2 * Max (midtermExam, final exam)

19.

a)

Concat (Substring ("Harp" , 1, 1), Substring ("Puppy" , 2, 4))

b)

Concat (Substring ("Harp" , 1, 2), Substring ("Puppy" , 3, 3))

c)

Concat (Substring ("Harp" , 1, 2), Substring ("Puppy" , 4, 2))

d)

Concat (Substring ("Harp" , 2, 2), Substring ("Puppy" , 4, 2))

20.

a)

Between line 6 and line 7

b)

Between line 9 and line 10

c)

Between line 20 and 21

d)

Between line 21 and 22

21.

a)

4 times as many addresses are available.

b)

96 times as many addresses are available.

c)

24 times as many addresses are available.

d)

296 times as many addresses are available.

22.

a)

An archive containing previous versions of the e-book

b)

The author and title of the e-book

c)

The date the e-book was first published

d)

The genre of the e-book (e.g., comedy, fantasy, romance, etc.)

23.

a)

III only

b)

I and II only

c)

I and III only

d)

I, II, and III

24.

a)

Using video file formats that conform to published standards and are supported across many different devices

b)

Using lossy compression software to reduce the size requirements of the data being stored

c)

Using storage media that can be expanded for additional data capacity

d)

Using a system that incorporates redundancy to handle disk failure

25.

a)
b)
c)
d)
26.

a)

(NOT P) AND (NOT Q)

b)

(NOT P) AND Q

c)

NOT (P AND Q)

d)

NOT (P OR Q)

27.

a)

counter > 0.5 * total

b)

total > 0.5 * counter

c)

counter < 0.5 * total

d)

total < 0.5 * counter

28.

a)

An overflow error occurred.

b)

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

c)

The program attempted to execute the operation with the arguments in reverse order.

d)

The program attempted to represent a floating-point number as an integer.

29.

a)

The procedure returns true when the user inputs the value "y" and returns false otherwise.

b)

The procedure returns true when the user inputs the value "n" and returns false otherwise.

c)

The procedure returns true no matter what the input value is.

d)

The procedure returns false no matter what the input value is.

30.

a)

I only

b)

II only

c)

I and III

d)

II and III

31.

a)

"BANANA"

b)

"LEVEL_UP"

c)

"MEET_ME_LATER"

d)

"NEITHER_HERE_NOR_THERE"

32.

a)

The program displays the sum of the even integers from 0 to 10.

b)

The program displays the sum of the even integers from 0 to 20.

c)

The program displays the sum of the odd integers from 1 to 9.

d)

The program displays the sum of the odd integers from 1 to 19.

33.

a)

30.6

b)

31.2

c)

31.8

d)

32.4

34.

a)

The mobile app release did not have any effect on the average number of daily messages sent per user.

b)

The mobile app release discouraged new user registration on the site.

c)

The mobile app release led to users being less frequently active on the site.

d)

The mobile app release led to users tending to write shorter messages.

35.

a)
b)
c)
d)
36.

a)

4

b)

6

c)

7

d)

8

37.

a)

I only

b)

II only

c)

II and III only

d)

I, II, and III

38.

a)
b)
c)
d)