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.
Not yet started
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.
Not yet started
1 point


3.
Not yet started
1 point


4.
Not yet started
1 point
Which of the following statements describes a limitation of using a computer simulation to model a real-world object or system?

5.
Not yet started
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
Which of the following questions about a particular animal could NOT be answered using only the data collected from the tracking collars?

6.
Not yet started
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
For which of the following goals would it be more useful to analyze the data instead of the metadata?

7.
Not yet started
1 point


8.
Not yet started
1 point
Which of the following is a true statement about data compression?

9.
Not yet started
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?

10.
Not yet started
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?

11.
Not yet started
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?

12.
Not yet started
1 point
Under which of the following conditions is it most beneficial to use a heuristic approach to solve a problem?

13.
Not yet started
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?

14.
Not yet started
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.
Not yet started
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.
Not yet started
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.

FOR EACH child IN morningList
{
  <MISSING CODE> 
}

Which of the following could replace <MISSING CODE> so that the code segment
works as intended?

17.
Not yet started
1 point
Consider the following program code.



Which of the following best describes the result of running the program code?


18.
Not yet started
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.
Not yet started
1 point
According to the domain name system (DNS), which of the following is a subdomain of the domain example.com?


20.
Not yet started
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.
Not yet started
1 point
Which of the following algorithms require both selection and iteration?

Select two answers.


22.
Not yet started
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.
Not yet started
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.

24.
Not yet started
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?

25.
Not yet started
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.

26.
Not yet started
1 point
Which of the following is most likely to be part of a phishing attack?


27.
Not yet started
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.
Not yet started
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.
Not yet started
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.


30.
Not yet started
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.