exemples de questions
The sample questions that follow illustrate the relationship between the curriculum framework and the AP Computer Science Principles Exam and serve as examples of the types of questions that will appear on the exam.
1.
2.
.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
24.
25.
26.
27.
28.
29.
30.
1.
1 point
A video-streaming Web site uses 32-bit integers to count the number of times each video has been played. In anticipation of some videos being played more times than can be represented with 32 bits, the Web site is planning to change to 64-bit integers for the counter. Which of the
following best describes the result of using 64-bit integers instead of 32-bit integers?
2.
1 point
.
3.
1 point
4.
1 point
Which of the following statements describes a limitation of using a computer simulation to model a real-world object or system?
5.
1 point
Biologists often attach tracking collars to wild animals. For each animal, the following geolocation data is collected at frequent intervals.
- The time
- The date
- The location of the animal
6.
1 point
A certain social media Web site allows users to post messages and to comment on other messages that have been posted. When a user posts a message, the message itself is considered data. In addition to the data, the site stores the following metadata.
- The time the message was posted
- The name of the user who posted the message
- The names of any users who comment on the message and the times the comments were made
7.
1 point
8.
1 point
Which of the following is a true statement about data compression?
9.
1 point
A programmer completes the user manual for a video game she has developed and realizes she has reversed the roles of goats and sheep throughout the text. Consider the programmer’s goal of changing all occurrences of “goats” to “sheep,” and all occurrences of “sheep” to “goats.” The programmer will use the fact that the word “foxes” does not appear anywhere in the original text.
Which of the following algorithms can be used to accomplish the programmer’s goal?
Which of the following algorithms can be used to accomplish the programmer’s goal?
10.
1 point
Consider the code segment below.
If the variables onTime and absent both have the value false, what is displayed as a result of running the code segment?
If the variables onTime and absent both have the value false, what is displayed as a result of running the code segment?
11.
1 point
The program segment below is intended to move a robot in a grid to a gray square. The program segment uses the procedure GoalReached, which evaluates to true if the robot is in the gray square and evaluates to false otherwise. The robot in each grid is represented as a triangle and is initially facing left. The robot can move into a white or gray square, but cannot move into a black region.
For which of the following grids does the program NOT correctly move the robot to the gray square?
For which of the following grids does the program NOT correctly move the robot to the gray square?
12.
1 point
Under which of the following conditions is it most beneficial to use a heuristic approach to solve a problem?
13.
1 point
There are 32 students standing in a classroom. Two different algorithms are given for finding
the average height of the students.
Algorithm A
Step 1: All students stand.
Step 2: A randomly selected student writes his or her height on a card and is seated.
Step 3: A randomly selected standing student adds his or her height to the value on the card, records the new value on the card, and is seated. The previous value on the card is erased.
Step 4: Repeat step 3 until no students remain standing.
Step 5: The sum on the card is divided by 32. The result is given to the teacher.
Algorithm B
Step 1: All students stand.
Step 2: Each student is given a card. Each student writes his or her height on the card.
Step 3: Standing students form random pairs at the same time. Each pair adds the numbers written on their cards and writes the result on one student’s card; the other student is seated. The previous value on the card is erased.
Step 4: Repeat step 3 until one student remains standing.
Step 5: The sum on the last student’s card is divided by 32. The result is given to the teacher.
Which of the following statements is true?
Algorithm A
Step 1: All students stand.
Step 2: A randomly selected student writes his or her height on a card and is seated.
Step 3: A randomly selected standing student adds his or her height to the value on the card, records the new value on the card, and is seated. The previous value on the card is erased.
Step 4: Repeat step 3 until no students remain standing.
Step 5: The sum on the card is divided by 32. The result is given to the teacher.
Algorithm B
Step 1: All students stand.
Step 2: Each student is given a card. Each student writes his or her height on the card.
Step 3: Standing students form random pairs at the same time. Each pair adds the numbers written on their cards and writes the result on one student’s card; the other student is seated. The previous value on the card is erased.
Step 4: Repeat step 3 until one student remains standing.
Step 5: The sum on the last student’s card is divided by 32. The result is given to the teacher.
Which of the following statements is true?
14.
1 point
The following question uses a robot in a grid of squares. The robot is represented as a triangle, which is initially in the bottom left square of the grid and facing right.
Consider the following code segment, which moves the robot in the grid.
Which of the following shows the location of the robot after running the code segment?
15.
1 point
The figure below shows a robot in a grid of squares. The robot is represented as a triangle, which is initially facing upward. The robot can move into a white or gray square but cannot move into a black region.
Consider the procedure MoveAndTurn below.
Which of the following code segments will move the robot to the gray square?
16.
1 point
A summer camp offers a morning session and an afternoon session.
The list morningList contains the names of all children attending the morning session,
and the list afternoonList contains the names of all children attending the afternoon
session.
Only children who attend both sessions eat lunch at the camp. The camp director
wants to create lunchList, which will contain the names of children attending both
sessions.
The following code segment is intended to create lunchList, which is initially empty.
It uses the procedure IsFound (list, name), which returns true if name is found in list
and returns false otherwise.
Which of the following could replace <MISSING CODE> so that the code segment
works as intended?
The list morningList contains the names of all children attending the morning session,
and the list afternoonList contains the names of all children attending the afternoon
session.
Only children who attend both sessions eat lunch at the camp. The camp director
wants to create lunchList, which will contain the names of children attending both
sessions.
The following code segment is intended to create lunchList, which is initially empty.
It uses the procedure IsFound (list, name), which returns true if name is found in list
and returns false otherwise.
FOR EACH child IN morningList
{
<MISSING CODE> }
Which of the following could replace <MISSING CODE>
works as intended?
17.
1 point
Consider the following program code.
Which of the following best describes the result of running the program code?
18.
1 point
An office building has two floors. A computer program is used to control an elevator that travels between the two floors. Physical sensors are used to set the following Boolean variables.
The elevator moves when the door is closed and the elevator is called to the floor that it is not currently on. Which of the following Boolean expressions can be used in a selection statement to cause the elevator to move?
19.
1 point
According to the domain name system (DNS), which of the following is a subdomain of the domain example.com?
20.
1 point
Which of the following are true statements about digital certificates in Web browsers?
I. Digital certificates are used to verify the ownership of encrypted keys used in secured communication.
II. Digital certificates are used to verify that the connection to a Web site is fault tolerant.
21.
1 point
Which of the following algorithms require both selection and iteration?
Select two answers.
Select two answers.
22.
1 point
A teacher uses the following program to adjust student grades on an assignment by adding 5 points to each student’s original grade. However, if adding 5 points to a student’s original grade causes the grade to exceed 100 points, the student will receive the maximum possible score of 100 points. The students’ original grades are stored in the list gradeList, which is indexed from 1 to n.
i ← 1
REPEAT n TIMES
{
<MISSING CODE>
i ← i + 1
}
The teacher has the following procedures available.
Which of the following code segments can replace <MISSING CODE> so that the program works as intended?
Select two answers.
Additional Sample Questions:
23.
1 point
Which of the following are true statements about creating computational artifacts?
I. A computational artifact must be created using a computer or computing device.
II. A computational artifact must be created using a traditional, prescribed technique.
III. Some computational artifacts are created by combining existing computational artifacts.
I. A computational artifact must be created using a computer or computing device.
II. A computational artifact must be created using a traditional, prescribed technique.
III. Some computational artifacts are created by combining existing computational artifacts.
24.
1 point
A team of students is creating a video to advertise an upcoming school activity. While working
on the video, the students plan to meet every day to review their progress and plan next steps.
Which of the following is a FALSE statement about the described collaborative process?
Which of the following is a FALSE statement about the described collaborative process?
25.
1 point
Which of the following are true statements about digital audio files?
I. An audio file can be created by using samples of one or more existing audio files.
II. An audio file can be created by using a computer program to synthesize a new sound.
III. An audio file that has gone through lossy compression can be restored to its original uncompressed version.
I. An audio file can be created by using samples of one or more existing audio files.
II. An audio file can be created by using a computer program to synthesize a new sound.
III. An audio file that has gone through lossy compression can be restored to its original uncompressed version.
26.
1 point
Which of the following is most likely to be part of a phishing attack?
27.
1 point
Which of the following are true statements regarding the benefits of using e-mail to send messages?
I. E-mail can be used to disseminate information to multiple recipients at once.
II. E-mail is designed to be a completely secure way of sending confidential information.
III. E-mail fosters communication and collaboration between people in distant locations.
28.
1 point
A student purchases a single-user license of a copyrighted application and wants other students to be able to use it at the same time. Under which of the following conditions is it considered acceptable for the student to share the application?
29.
1 point
Which of the following are true statements regarding the benefits of using the Internet to
communicate?
I. The Internet provides equal access to information across all socioeconomic groups globally.
II. The Internet allows information to be disseminated to many people very quickly.
III. The Internet fosters new ways to communicate and collaborate.
I. The Internet provides equal access to information across all socioeconomic groups globally.
II. The Internet allows information to be disseminated to many people very quickly.
III. The Internet fosters new ways to communicate and collaborate.
30.
1 point
A bookstore has a database containing information about each book for sale in the store. A sample portion of the database is shown below.
A store employee wants to calculate the total amount of money the store will receive if they sell
all of the available science fiction books. Which columns in the database can be ignored and
still allow the employee to perform this calculation?
Select two answers.
Select two answers.