AP Computer Science Interest Questions
Answer the following questions. If the questions are interesting and you are able to answer a majority of
them correctly, you should consider taking AP Computer Science.
1. The music director of a college radio station gathered data to analyze the songs that were played on the
station during the last year. A song was listed in the data every time it was played. The following data was
collected for each song:
The name of the artist
The song title
The album title
The genre
The music director wants to find the number of unique songs played in the jazz genre. Consider the two
proposed algorithms below.
Algorithm I: Filter the data by creating a list of songs only in the jazz genre. Sort the list by song title. Set
a counter to zero. Iterate through the sorted list. If a song is different from the previous song in the list (or
if it is the first song in the list), increment the counter by one.
Algorithm II: Create a new list of the data sorted by song title. Iterate through the sorted list. Every time a
song is the same as the previous song in the list, delete the duplicate song from the list. Set a counter to
zero. Iterate through the remaining list of songs. Each time jazz is listed as the genre, increment the
counter by one.
Which algorithm, if any, can the music director use to find the number of unique songs played in the jazz
genre?
A.
B.
C.
D.
I only
II only
Both I and II
Neither I nor II
2. Suppose that every personal music playing device will be modified so that whenever a song is played,
the device will anonymously upload the following metadata to a shared centralized database:
The name of the song
The artist who recorded the song
The time of day that the song is played
Which of the following would NOT be possible if only the database is used?
A.
B.
C.
D.
Music companies will be able to determine the artists who are rising in popularity.
Users will be able to compare their personal listening preferences to those of their friends.
Artists will be able to determine which of their songs are most popular.
Users will be able to compare their personal listening preferences to the listening trends of the
entire database.
Page 1 of 4
The next two questions use a simple programming language, with the following instructions.
Instruction
random( a, b )
a + b
a ← b
REPEAT n TIMES { }
display( expression )
isPositive( n )
FOR EACH n IN list { }
IF ( condition )
instruction
Explanation
Generates a random integer between a and b, inclusive.
Evaluates to the sum of the values stored in a and b.
Assigns the value of b to the variable a.
The block of instructions contained between the scroll braces { } is
repeated n times.
Displays the value of expression.
Evaluates to true if n is greater than 0; otherwise evaluates to
false.
The variable n is assigned the value of each list element
sequentially. The block of instructions between the scroll braces { }
is executed once for each assignment of n.
The instruction is executed once if condition is true; no
action taken if condition is false.
3. Consider the goal of simulating the results of rolling a number cube (numbered from 1 to 6) two times,
and displaying the sum of the values obtained from the two rolls. Which of the following code segments
will produce the appropriate results?
A.
B.
C.
D.
I. display(random(1, 12))
II. display(random(1, 6) + random(1, 6))
III. sum ← 0
REPEAT 2 TIMES
{
sum ← sum + random(1, 6)
}
display(sum)
I only
I and III only
II and III only
I, II, and III
Page 2 of 4
4. Consider the goal of counting the number of positive-valued integers in a list called numbers. Which of
the following code segments can be used to accomplish the goal?
A. count ← 0
FOR EACH value IN numbers
{
IF (isPositive(value))
}
display(count)
B. FOR EACH value IN numbers
{
count ← 0
IF (isPositive(value))
}
display(count)
C. count ← 0
FOR EACH value IN numbers
{
IF (isPositive(count))
}
display(count)
D. FOR EACH value IN numbers
{
count ← 0
IF (isPositive(count))
}
display(count)
count ← count + 1
count ← count + 1
increment(value)
increment(value)
The question below uses a robot in a grid of squares. The robot is represented as a triangle, which is
initially facing toward the right side of the grid. The robot is moved according to the following
instructions.
Instruction
Move Forward
Rotate Right
Rotate Left
REPEAT n TIMES { }
Explanation
The robot moves one square forward in the direction it is facing.
The robot rotates in place 90 degrees clockwise (i.e. makes an inplace right turn).
The robot rotates in place 90 degrees counterclockwise (i.e. makes
an in-place left turn).
The block of instructions contained between the scroll braces { } is
repeated n times.
Page 3 of 4
5. Consider the following incorrect program, which is intended to move the robot around the perimeter of
the grid below, as indicated by the arrows.
►
Line 1: REPEAT 4 TIMES
{
Line 2:
Move Forward
Line 3:
Rotate Right
Line 4:
REPEAT 4 TIMES
{
Line 5:
Move Forward
}
Line 6:
Rotate Right
}
Which lines of code should be removed so that the program will work as intended? Select two answers.
A. Line 2
B. Line 3
C. Line 4
D. Line 5
6. The Jones Trucking Company tracks the location of each of its trucks on a grid similar to an (x, y)
plane. The home office is at the origin (0, 0). Using the coordinates of truck A and the coordinates of
truck B provided by the program, determine which is closer to the office.
Each collection contains 4 integers: the x-coordinate and then the y-coordinate of truck A followed by the
x-coordinate and then the y-coordinate of truck B.
The distance formula for (x1, y1) and (x2, y2) is:
√(𝑥2 − 𝑥1)2 + (𝑦2 − 𝑦1)2
Input from the program:
Enter Truck A location :: 3 -2
Enter Truck B location :: -5 -3
Which truck is closer?
A. Truck A
B. Truck B
C. They are the same distance away.
Answers:
1. C
2. B
3. C
4. A
5. A and B
6. A
Page 4 of 4
© Copyright 2026 Paperzz