[go: up one dir, main page]

0% found this document useful (0 votes)
2K views62 pages

AP CSP 2018 Practice Exam Guide

The AP Computer Science Principles End-of-Course Practice Exam is a 2-hour test consisting of 66 multiple-choice questions. Students are instructed to answer the questions according to specific guidelines, with no penalties for incorrect answers. Reference materials are provided to assist with programming questions, and exam materials must be collected at the end of the testing period.

Uploaded by

eerdogdu3131
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2K views62 pages

AP CSP 2018 Practice Exam Guide

The AP Computer Science Principles End-of-Course Practice Exam is a 2-hour test consisting of 66 multiple-choice questions. Students are instructed to answer the questions according to specific guidelines, with no penalties for incorrect answers. Reference materials are provided to assist with programming questions, and exam materials must be collected at the end of the testing period.

Uploaded by

eerdogdu3131
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Practice Exam

Exam Content and Format


This AP Computer Science Principles End-of-Course Practice Exam is 2 hours
long and consists of 66 multiple-choice questions.

Administering the Practice Exam


This section contains instructions for administering the AP Computer Science
Principles Practice Exam. You may wish to use these instructions to create an
exam situation that resembles an actual administration. If so, read the indented,
boldface directions to the students; all other instructions are for administering
the exam and need not be read aloud. Before beginning testing, have all exam
materials ready for distribution. These include test booklets and answer sheets.

When you are ready to begin the exam, say:

You will be given 2 hours to answer 66 multiple-choice questions.


Each question has four answer choices.
• For question numbers 1 through 59, mark only the single best
answer to each question.
• For the remaining questions, numbered 131 through 137, mark the
two best answer choices for each question.

Your total score on this multiple-choice exam is based only on the


number of questions answered correctly. Points are not deducted for
incorrect answers or unanswered questions. When you do not know the
answer to a question, you should eliminate as many choices as you can,
and then select the best answer among the remaining choices. If you
finish before time is called, you may check your work.

Programming reference materials are located at the front of the exam.


The reference materials provide instructions and explanations to help
you understand the format and meaning of the questions on the test. As
you encounter programming questions on the test, you should use the
reference materials to clarify the behavior of programming statements
found in those questions.

You have 2 hours for this exam. Open your exam booklet and begin.

Note Start Time here______ . Note Stop Time here______ . After 2 hours, say:

Stop working. The exam is over. I will now collect your exam materials.

Collect an exam booklet and answer sheet from each student.

AP Computer Science Principles Practice Exam 7


8
AP Exam Label PAGE 1
AP Number Label
(from Student Pack) (from Section I Booklet)
Answer Sheet 2018
AP FPO X123456789 X
COMPLETE THIS AREA AT EVERY EXAM. USE NO. 2 PENCIL ONLY D. EXAM DATE E. EXAM G. ONLINE
F. MULTIPLE-CHOICE BOOKLET
I am aware of and agree to follow the policies and procedures in the 2017-18 Bulletin for AP Students and Parents to C. YOUR AP NUMBER START PROVIDER
Month Day TIME SERIAL NUMBER CODE
maintain the security of the exam and the validity of my AP score. I understand and accept that my exam score may
be canceled if I do not follow these policies and procedures, if I disregard any exam day instructions, or if my exam is AM PM S
administered improperly. I certify that I am the person whose information appears on this answer sheet.
Sign your legal name as it will appear on your college applications. Date
0 0 0 0 0 0 0 0 0 0 0 0 6 12 0 0 0 0 0 0 0 0 0 0 0 0 0
A. SIGNATURE
1 1 1 1 1 1 1 1 1 1 1 1 7 1 1 1 1 1 1 1 1 1 1 1 1 1 1

2 2 2 2 2 2 2 2 2 2 2 8 2 2 2 2 2 2 2 2 2 2 2 2 2 2
B. LEGAL NAME Omit apostrophes, Jr., II. 3 3 3 3 3 3 3 3 3 3 3 9 3 3 3 3 3 3 3 3 3 3 3 3 3 3
Legal Last Name — First 15 Letters Legal First Name — First 12 Letters MI 4 4 4 4 4 4 4 4 4 4 10 4 4 4 4 4 4 4 4 4 4 4 4 4 4

5 5 5 5 5 5 5 5 5 5 11 5 5 5 5 5 5 5 5 5 5 5 5 5 5
A A A A A A A A A A A A A A A A A A A A A A A A A A A A 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6
B B B B B B B B B B B B B B B B B B B B B B B B B B B B 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7
C C C C C C C C C C C C C C C C C C C C C C C C C C C C 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8
D D D D D D D D D D D D D D D D D D D D D D D D D D D D 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9
E E E E E E E E E E E E E E E E E E E E E E E E E E E E
COMPLETE THIS AREA ONLY ONCE. K. DATE OF BIRTH
F F F F F F F F F F F F F F F F F F F F F F F F F F F F I. AREA CODE AND
G G G G G G G G G G G G G G G G G G G G G G G G G G G G PHONE NUMBER J. SCHOOL YOU ATTEND Month Day Year
SCHOOL CODE School Name
H H H H H H H H H H H H H H H H H H H H H H H H H H H H Jan
I I I I I I I I I I I I I I I I I I I I I I I I I I I I 0 0 0 0 0 0 0 0 0 0 Feb 0 0 0 0
J J J J J J J J J J J J J J J J J J J J J J J J J J J J 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 Mar 1 1 1 1
K K K K K K K K K K K K K K K K K K K K K K K K K K K K 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 Apr 2 2 2 2
L L L L L L L L L L L L L L L L L L L L L L L L L L L L 3 3 3 3 3 3 3 3 3 3 2 2 2 2 2 2 May 3 3 3 3
M M M M M M M M M M M M M M M M M M M M M M M M M M M M 4 4 4 4 4 4 4 4 4 4 3 3 3 3 3 3 City Jun 4 4 4
N N N N N N N N N N N N N N N N N N N N N N N N N N N N 5 5 5 5 5 5 5 5 5 5 4 4 4 4 4 4 Jul 5 5 5
O O O O O O O O O O O O O O O O O O O O O O O O O O O O 6 6 6 6 6 6 6 6 6 6 5 5 5 5 5 5 State Aug 6 6 6
P P P P P P P P P P P P P P P P P P P P P P P P P P P P 7 7 7 7 7 7 7 7 7 7 6 6 6 6 6 6 Sep 7 7 7
Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q 8 8 8 8 8 8 8 8 8 8 7 7 7 7 7 7 Oct 8 8 8
Country
R R R R R R R R R R R R R R R R R R R R R R R R R R R R 9 9 9 9 9 9 9 9 9 9 8 8 8 8 8 8 Nov 9 9 9
S S S S S S S S S S S S S S S S S S S S S S S S S S S S INTERNATIONAL PHONE 9 9 9 9 9 9 Dec
T T T T T T T T T T T T T T T T T T T T T T T T T T T T
M. COLLEGE TO RECEIVE YOUR
U U U U U U U U U U U U U U U U U U U U U U U U U U U U N. CURRENT
L. SOCIAL SECURITY AP SCORE REPORT
GRADE LEVEL
V V V V V V V V V V V V V V V V V V V V V V V V V V V V NUMBER (Optional) COLLEGE CODE Using the college code listed
in the AP Student Pack,
indicate the ONE college Not yet in
W W W W W W W W W W W W W W W W W W W W W W W W W W W W 11th
that you want to receive 9th grade
X X X X X X X X X X X X X X X X X X X X X X X X X X X X 0 0 0 0 0 0 0 0 0 0 0 0 0 your AP score report. 9th 12th
Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y 1 1 1 1 1 1 1 1 1 1 1 1 1 College Name 10th No longer in
high school
Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z 2 2 2 2 2 2 2 2 2 2 2 2 2

– – – – – – – – – – – – – – – – – – – – – – – 3 3 3 3 3 3 3 3 3 3 3 3 3 O. STUDENT SEARCH SERVICE®


Colleges and scholarship programs may

121586-00657 • TF11017E5500 • Printed in U.S.A.


4 4 4 4 4 4 4 4 4 4 4 4 4
Exam Name: Form: Form Code: request your information to inform you of
H. AP EXAM I AM City
5 5 5 5 5 5 5 5 5 5 5 5 5 educational opportunities and financial aid.
TAKING USING THIS
ANSWER SHEET 6 6 6 6 6 6 6 6 6 6 6 6 6 Would you like us to supply your information?
State
7 7 7 7 7 7 7 7 7 7 7 7 7 Yes No
SCHOOL USE ONLY

Q4546/1-4
801356 If you don’t answer and previously chose to
Section Number Fee Reduction Granted 8 8 8 8 8 8 8 8 8 8 8 8 8 Country participate in this service, we will continue
1 2 3 4 5 6 7 8 9 1 Option 1 2 Option 2 9 9 9 9 9 9 9 9 9 9 9 9 9 providing your information.
PAGE 2
COMPLETE THIS AREA AT EACH EXAM (IF APPLICABLE).

P. SURVEY QUESTIONS — Answer the survey questions in the AP Student Pack. Do not put responses to exam questions in this section.

1 A B C D E F G H I 4 A B C D E F G H I 7 A B C D E F G H I

2 A B C D E F G H I 5 A B C D E F G H I 8 A B C D E F G H I

3 A B C D E F G H I 6 A B C D E F G H I 9 A B C D E F G H I

Q. LANGUAGE — Do not complete this section unless instructed to do so.

If this answer sheet is for the French Language and Culture, German Language and Culture, Italian Language and Culture, Spanish Language
and Culture, or Spanish Literature and Culture Exam, please answer the following questions. Your responses will not affect your score.
1. Have you lived or studied for one month or more in a country where the language of the 2. Do you regularly speak or hear the language at home?
exam you are now taking is spoken?

Yes No Yes No

QUESTIONS 1–75

Indicate your answers to the exam questions in this section (pages 2 and 3). Mark only one response per question
for Questions 1 through 120. If a question has only four answer options, do not mark option E. Answers written in
the multiple-choice booklet will not be scored.

A B C D You must use a No. 2 pencil and marks must be complete. Do not use a mechanical pencil. It
EXAMPLES OF
COMPLETE MARK is very important that you fill in the entire circle darkly and completely. If you change your response,
INCOMPLETE MARKS A B C D erase as completely as possible. Incomplete marks or erasures may affect your score.

1 A B C D E 26 A B C D E 51 A B C D E
2 A B C D E 27 A B C D E 52 A B C D E
3 A B C D E 28 A B C D E 53 A B C D E
4 A B C D E 29 A B C D E 54 A B C D E
5 A B C D E 30 A B C D E 55 A B C D E
6 A B C D E 31 A B C D E 56 A B C D E
7 A B C D E 32 A B C D E 57 A B C D E
8 A B C D E 33 A B C D E 58 A B C D E
9 A B C D E 34 A B C D E 59 A B C D E
10 A B C D E 35 A B C D E 60 A B C D E
11 A B C D E 36 A B C D E 61 A B C D E
12 A B C D E 37 A B C D E 62 A B C D E
13 A B C D E 38 A B C D E 63 A B C D E
14 A B C D E 39 A B C D E 64 A B C D E
15 A B C D E 40 A B C D E 65 A B C D E
16 A B C D E 41 A B C D E 66 A B C D E
17 A B C D E 42 A B C D E 67 A B C D E
18 A B C D E 43 A B C D E 68 A B C D E
19 A B C D E 44 A B C D E 69 A B C D E
20 A B C D E 45 A B C D E 70 A B C D E
21 A B C D E 46 A B C D E 71 A B C D E
22 A B C D E 47 A B C D E 72 A B C D E
23 A B C D E 48 A B C D E 73 A B C D E
24 A B C D E 49 A B C D E 74 A B C D E
25 A B C D E 50 A B C D E 75 A B C D E

FOR OFFICIAL USE ONLY


R W O R W O
0 1 2 3 4 5 6 7 8 9 SELECTED MEDIA EXAMS OTHER EXAMS
Exam
0 1 2 3 4 5 6 7 8 9
PT02 TOTAL
0 1 2 3 4 5 6 7 8 9
Exam PT03 Subscore (if applicable)
0 1 2 3 4 5 6 7 8 9
PT04 Subscore (if applicable)

DO NOT WRITE IN THIS AREA

AP Computer Science Principles Practice Exam 9


PAGE 3
QUESTIONS 76–120

Be sure each mark is dark and completely fills the circle. If a question has only four answer options, do not mark option E.

76 A B C D E 91 A B C D E 106 A B C D E
77 A B C D E 92 A B C D E 107 A B C D E
78 A B C D E 93 A B C D E 108 A B C D E
79 A B C D E 94 A B C D E 109 A B C D E
80 A B C D E 95 A B C D E 110 A B C D E
81 A B C D E 96 A B C D E 111 A B C D E
82 A B C D E 97 A B C D E 112 A B C D E
83 A B C D E 98 A B C D E 113 A B C D E
84 A B C D E 99 A B C D E 114 A B C D E
85 A B C D E 100 A B C D E 115 A B C D E
86 A B C D E 101 A B C D E 116 A B C D E
87 A B C D E 102 A B C D E 117 A B C D E
88 A B C D E 103 A B C D E 118 A B C D E
89 A B C D E 104 A B C D E 119 A B C D E
90 A B C D E 105 A B C D E 120 A B C D E

QUESTIONS 121–126

For Students Taking AP Biology


Write your answer in the boxes at the top of the griddable area and fill in the corresponding circles.
Mark only one circle in any column. You will receive credit only if the circles are filled in correctly.

121 122 123 124 125 126

/ / / / / / / / / / / / / / / / / /

– . . . . . – . . . . . – . . . . . – . . . . . – . . . . . – . . . . .

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2

3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3

4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4

5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6

7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7

8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8

9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9

QUESTIONS 131–142

For Students Taking AP Computer Science Principles, AP Physics 1, or AP Physics 2


Mark two responses per question. You will receive credit only if both correct responses are selected.

131 A B C D 135 A B C D 139 A B C D


132 A B C D 136 A B C D 140 A B C D
133 A B C D 137 A B C D 141 A B C D
134 A B C D 138 A B C D 142 A B C D

© 2017 The College Board. College Board, AP, Student Search Service and the acorn logo are registered trademarks of the College Board.

DO NOT WRITE IN THIS AREA

10
COMPLETE THIS AREA ONLY ONCE. PAGE 4
R. YOUR MAILING ADDRESS Use the address abbreviations from your AP Student Pack. Fill in only one circle per column. Indicate a space in your address by leaving a blank box; do not grid that column. V. SEX
COUNTRY
STREET ADDRESS (include street number, street name, apartment number, etc.) CITY ZIP OR POSTAL CODE
CODE Female Male

W. WHICH LANGUAGE DO YOU


A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A 0 0 0 KNOW BEST?
B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B 1 1 1 English
C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C 2 2 2 English and another language
about the same
D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D 3 3 3 Another language

E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E 4 4 4

F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F 5 5 5 X. RACIAL/ETHNIC GROUP

G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G G 6 6 6 Please answer both questions about


Hispanic origin and about race. For the
H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H 7 7 7
following questions about your identity,
I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I 8 8 8 Hispanic origins are not races.

J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J 9 9 9
(You may mark all that apply.)
K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K
a. Are you of b. What is your race?
L L L L L L L L L L L L L L L L L L L L L L L L L L L L L L L L L L L L L L L L L L L L L L L L Hispanic,
Latino, or
American Indian or
M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M Spanish origin? Alaska Native
N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N No, not of Asian (including Indian
Hispanic, Latino, subcontinent and
O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O or Spanish origin Philippines origin)

P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P Yes, Cuban Black or African American


(including Africa and
Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Yes, Mexican Afro-Caribbean origin)

R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R Yes, Puerto Rican Native Hawaiian or other


Pacific Islander
S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S Yes, another White (including Middle
Hispanic, Latino, Eastern origin)
T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T or Spanish origin

U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U
V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V Y. PARENTAL EDUCATION LEVEL
In the first column, indicate the highest level of education of
W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W
one parent/guardian, and indicate whether this is your mother/
X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X female guardian or father/male guardian. Then, if applicable,
indicate the highest level of education of your other parent/
Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y guardian in the second column, and indicate whether this is
Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z your mother/female guardian or father/male guardian.

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 STATE MI NY VT 0 0 0 0 0 0 0 0 0 Mother or female guardian

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 AK HI MN OH WA 1 1 1 1 1 1 1 1 1 Father or male guardian

2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 AL IA MO OK WI 2 2 2 2 2 2 2 2 2 Grade school

3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 AR ID MS OR WV 3 3 3 3 3 3 3 3 3 Some high school

4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 AZ IL MT PA WY 4 4 4 4 4 4 4 4 4 High school diploma or equivalent

5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 CA IN NC RI Puerto 5 5 5 5 5 5 5 5 5 Vocational or trade school


Rico
6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 CO KS ND SC 6 6 6 6 6 6 6 6 6 Some college

7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 CT KY NE SD AA 7 7 7 7 7 7 7 7 7 Associate or two-year degree

8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 DC LA NH TN AE 8 8 8 8 8 8 8 8 8 Bachelor’s or four-year degree

9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 DE MA NJ TX AP 9 9 9 9 9 9 9 9 9 Some graduate or professional school

/ / / / / / / / / / / / / / / / / / / / / / / / FL MD NM UT Other / / / / / / / Graduate or professional degree


GA ME NV VA T. STUDENT IDENTIFIER (Student ID Number)
S. FOR STUDENTS OUTSIDE If your address does not fit in the spaces provided in Item R, fill in as
THE UNITED STATES ONLY many circles as you can, then fill in the circle in Item S and print the remainder of your address in the spaces provided.
Address City State or Province Country ZIP or Postal Code

By providing your email address, you are granting the College Board
U. EMAIL ADDRESS permission to use your email address in accordance with the policies
in the 2017-18 Bulletin for AP Students and Parents.

AP Computer Science Principles Practice Exam


11
AP Computer Science Principles Exam
®

Multiple Choice

DO NOT OPEN THIS BOOKLET UNTIL YOU ARE TOLD TO DO SO.


Instructions
At a Glance
Exam reference materials are located at the front of this booklet.
Total Time
2 hours This practice exam contains 66 multiple-choice questions. Indicate all of your answers to
Number of Questions the multiple-choice questions on the answer sheet. No credit will be given for anything
66 written in this exam booklet, but you may use the booklet for notes or scratch work.
Percent of Total Score For questions 1 through 59, select the single best answer choice for each question. After
60% you have decided which of the choices is best, fill in the appropriate letter in the
Writing Instrument corresponding space on the answer sheet.
Pencil required
Electronic Device For questions 131 through 137, select the two best answer choices for each question. After
None allowed
you have decided which two of the choices are best, enter both letters in the corresponding
space on the answer sheet.
Use your time effectively, working as quickly as you can without losing accuracy. Do not
spend too much time on any one question. Go on to other questions and come back to
the ones you have not answered if you have time. It is not expected that everyone will
know the answers to all of the multiple-choice questions.
Your total score on the exam is based only on the number of questions answered
correctly. Points are not deducted for incorrect answers or unanswered questions.

12 AP Computer Science Principles Practice Exam


COMPUTER SCIENCE PRINCIPLES
Time—2 Hours
Number of Questions—66

Programming reference materials are included on the following pages. As AP Computer Science Principles does not
designate any particular programming language, these reference materials provide instructions and explanations to help
you understand the format and meaning of the questions you will see on the exam. The reference materials include two
programming formats, text-based and block-based.
Programming instructions use four data types: numbers, Booleans, strings, and lists.
Instructions from any of the following categories may appear on the exam:
• Assignment, Display, and Input
• Arithmetic Operators and Numeric Procedures
• Relational and Boolean Operators
• Selection
• Iteration
• List Operations
• Procedures
• Robot

GO ON TO THE NEXT PAGE.

AP Computer Science Principles Practice Exam 13


REFERENCE MATERIALS

Instruction Explanation
Assignment, Display, and Input
Text: Evaluates expression and assigns the result to
a ← expression the variable a.
Block:

Text: Displays the value of expression, followed by


DISPLAY (expression) a space.
Block:

Text: Accepts a value from the user and returns it.


INPUT ()
Block:

Arithmetic Operators and Numeric Procedures


Text and Block: The arithmetic operators +, -, *, and / are
a + b used to perform arithmetic on a and b.
a - b
a * b For example, 3 / 2 evaluates to 1.5.
a / b
Text and Block: Evaluates to the remainder when a is divided
a MOD b by b. Assume that a and b are positive
integers.
For example, 17 MOD 5 evaluates to 2.
Text: Evaluates to a random integer from a to b,
RANDOM (a, b) including a and b.
Block: For example, RANDOM (1, 3) could evaluate
to 1, 2, or 3.
Relational and Boolean Operators
Text and Block: The relational operators =, π , >, <,  , and 
a = b are used to test the relationship between two
a π b variables, expressions, or values.
a > b
a < b For example, a = b evaluates to true if a
a  b and b are equal; otherwise it evaluates to
a  b false.
Text: Evaluates to true if condition is false;
NOT condition otherwise evaluates to false.
Block:

Text: Evaluates to true if both condition1 and


condition1 AND condition2 condition2 are true; otherwise evaluates to
false.
Block:

14 AP Computer Science Principles Practice Exam


REFERENCE MATERIALS

Instruction Explanation
Relational and Boolean Operators (continued)
Text: Evaluates to true if condition1 is true
condition1 OR condition2 or if condition2 is true or if both
condition1 and condition2 are true;
Block:
otherwise evaluates to false.

Selection
Text: The code in block of statements is
IF (condition) executed if the Boolean expression condition
{ evaluates to true; no action is taken if
<block of statements> condition evaluates to false.
}
Block:

Text: The code in first block of statements


IF (condition) is executed if the Boolean expression
{ condition evaluates to true; otherwise the
<first block of statements> code in second block of statements is
} executed.
ELSE
{
<second block of statements>
}
Block:

Iteration
Text: The code in block of statements is
REPEAT n TIMES executed n times.
{
<block of statements>
}
Block:

AP Computer Science Principles Practice Exam 15


REFERENCE MATERIALS
Instruction Explanation
Iteration (continued)
Text: The code in block of statements is
REPEAT UNTIL (condition) repeated until the Boolean expression
{ condition evaluates to true.
<block of statements>
}
Block:

List Operations
For all list operations, if a list index is less than 1 or greater than the length of the list, an error message
is produced and the program terminates.
Text: Refers to the element of list at index i. The
list[i] first element of list is at index 1.
Block:

Text: Assigns the value of list[j] to list[i].


list[i] ← list[j]
Block:

Text: Assigns value1, value2, and value3 to


list ← [value1, value2, value3] list[1], list[2], and list[3],
respectively.
Block:

Text: The variable item is assigned the value of each


FOR EACH item IN list element of list sequentially, in order from the
{ first element to the last element. The code in
<block of statements> block of statements is executed once for
} each assignment of item.
Block:

16 AP Computer Science Principles Practice Exam


REFERENCE MATERIALS
Instruction Explanation
List Operations (continued)
Text: Any values in list at indices greater than or
INSERT (list, i, value) equal to i are shifted to the right. The length of
list is increased by 1, and value is placed at
Block:
index i in list.

Text: The length of list is increased by 1, and


APPEND (list, value) value is placed at the end of list.
Block:

Text: Removes the item at index i in list and shifts


REMOVE (list, i) to the left any values at indices greater than i. The
length of list is decreased by 1.
Block:

Text: Evaluates to the number of elements in list.


LENGTH (list)
Block:

Procedures
Text: A procedure, name, takes zero or more
PROCEDURE name (parameter1, parameters. The procedure contains programming
parameter2, ...) instructions.
{
<instructions>
}
Block:

Text: A procedure, name, takes zero or more


PROCEDURE name (parameter1, parameters. The procedure contains programming
parameter2, ...) instructions and returns the value of
{ expression. The RETURN statement may
<instructions> appear at any point inside the procedure and causes
RETURN (expression) an immediate return from the procedure back to the
} calling program.

Block:

AP Computer Science Principles Practice Exam 17


REFERENCE MATERIALS

Instruction Explanation
Robot
If the robot attempts to move to a square that is not open or is beyond the edge of the grid, the robot will
stay in its current location and the program will terminate.
Text: The robot moves one square forward in the
MOVE_FORWARD () direction it is facing.
Block:

Text: The robot rotates in place 90 degrees


ROTATE_LEFT () counterclockwise (i.e., makes an in-place left turn).
Block:

Text: The robot rotates in place 90 degrees clockwise


ROTATE_RIGHT () (i.e., makes an in-place right turn).
Block:

Text: Evaluates to true if there is an open square one


CAN_MOVE (direction) square in the direction relative to where the robot is
facing; otherwise evaluates to false. The value
Block:
of direction can be left, right, forward, or
backward.

18 AP Computer Science Principles Practice Exam


Directions: Each of the questions or incomplete statements below is followed by four suggested answers or completions.
Select the one that is best in each case and then fill in the corresponding circle on the answer sheet.

1. The code segment below is intended to swap the values of the variables first and second using a
temporary variable, temp.

Which of the following can be used to replace <MISSING CODE> so that the code segment works as
intended?
(A)

(B)

(C)

(D)

2. A bank customer receives an e-mail from a sender claiming to be a bank employee. The e-mail asks the
customer to provide personal information and to call a phone number if he or she has any questions. The
customer suspects the e-mail might be a phishing attempt. Which of the following responses is most likely to be
a privacy risk for the bank customer?

(A) Calling the bank at its official phone number to ask whether the request for personal information is
legitimate
(B) Calling the phone number given in the e-mail and providing the personal information over the phone
(C) Checking that the domain name of the sender’s e-mail address is associated with the bank
(D) Conducting a Web search to see if other people have received similar requests for personal information

GO ON TO THE NEXT PAGE.

AP Computer Science Principles Practice Exam 19


3. Which of the following would be the best use of citizen science?

(A) An experiment that requires all participants to be working in the same laboratory
(B) An experiment that requires expensive equipment to conduct
(C) An experiment that requires data measurements to be taken in many different locations
(D) An experiment that requires specialized knowledge and training to conduct

4. 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

GO ON TO THE NEXT PAGE.

20 AP Computer Science Principles Practice Exam


5. The ticket prices at a movie theater are given below.

Type of Ticket Price


(in dollars)
Regular 12
Child (ages 12 and below) 9
Senior (ages 60 and above) 9
Additional $5 fee for 3-D movies

A programmer is creating an algorithm to set the value of ticketPrice based on the information in the
table. The programmer uses the integer variable age for the age of the moviegoer. The Boolean variable
is3D is true when the movie is 3-D and false otherwise.
Which of the following code segments correctly sets the value of ticketPrice ?

(A) (B)

(C) (D)

GO ON TO THE NEXT PAGE.

AP Computer Science Principles Practice Exam 21


6. Which of the following best describes the role of the Internet Engineering Task Force (IETF) ?

(A) Developing standards and protocols for Internet communication


(B) Preventing copyrighted materials from being illegally distributed online
(C) Preventing malicious software from being distributed online
(D) Verifying the ownership of encrypted keys used in secured messages

7. Consider the following program, which uses the variables start, end, and current.
start ← 1
end ← 20
current ← 3
start ← current
current ← current + 1
DISPLAY (start)
DISPLAY (current)
What is displayed as a result of executing the program?

(A) 1 3
(B) 3 3
(C) 3 4
(D) 4 4

GO ON TO THE NEXT PAGE.

22 AP Computer Science Principles Practice Exam


8. A smartphone stores the following data for each photo that is taken using the phone.
• The file name of the photo
• The date and time the photo was taken
• The geographic location where the photo was taken
Assume that all of the photos that have been taken on the phone are accessible. Which of the
following can be determined using the photo data described above?
I. The number of photos that were taken at a particular geographic location
II. The number of photos that were taken in the last year
III. The name of the person who took the most recent photo

(A) III only


(B) I and II only
(C) I and III only
(D) I, II, and III

GO ON TO THE NEXT PAGE.

AP Computer Science Principles Practice Exam 23


9. Which of the following best describes one of the benefits of using an iterative and incremental process of
program development?
(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.

GO ON TO THE NEXT PAGE.

24 AP Computer Science Principles Practice Exam


10. The procedure DrawCircle (x, y, r) can be used to draw a circle on a coordinate grid. The circle is
centered at the coordinate (x, y) and has a radius of r units. The procedure will be used to draw the
following figure on a coordinate grid.

Which of the following code segments can be used to draw the figure?
(A) xPos ← 3 (B) xPos ← 3
yPos ← 6 yPos ← 6
REPEAT 3 TIMES REPEAT 3 TIMES
{ {
DrawCircle (xPos, yPos, 2) DrawCircle (xPos, yPos, 2)
xPos ← xPos + 2 xPos ← xPos + 2
yPos ← yPos + 2 yPos ← yPos - 2
} }

(C) xPos ← 7 (D) xPos ← 7


yPos ← 2 yPos ← 2
REPEAT 3 TIMES REPEAT 3 TIMES
{ {
DrawCircle (xPos, yPos, 2) DrawCircle (xPos, yPos, 2)
xPos ← xPos + 2 xPos ← xPos + 2
yPos ← yPos + 2 yPos ← yPos - 2
} }

GO ON TO THE NEXT PAGE.

AP Computer Science Principles Practice Exam 25


11. A spinner is divided into three sections. The sector labeled Red is four times as large as each of the sectors
labeled Blue and Yellow, which are of equal size.

The procedure below is intended to simulate the behavior of the spinner.

Which of the following can be used to replace <MISSING CODE> so that the procedure correctly simulates
the spinner?
(A) (B)

GO ON TO THE NEXT PAGE.

26 AP Computer Science Principles Practice Exam


(C) (D)

GO ON TO THE NEXT PAGE.

AP Computer Science Principles Practice Exam 27


Questions 12–13 refer to the information below.
A social media site allows users to send messages to each other. A group of researchers gathered user data for the first
10 years of the site’s existence. Some of the data are summarized in the table below, along with some of the company
milestones.
Average Average
Total Number Average
Number of Number of
of Registered Number of
Year Milestone Active Daily Daily
Users (in Characters
Users (in Messages Sent
millions) Per Message
millions) Per User
1 Web site launched 25.4 0.8 3.6 360
2 26.0 0.7 3.5 362
3 26.5 0.6 3.5 358
4 26.9 0.6 3.4 360
5 Mobile app released 27.4 0.9 3.3 269
6 28.0 0.9 3.4 242
7 28.6 1.1 3.5 195
8 29.1 1.2 3.5 176
9 29.6 1.1 3.6 104
10 30.2 1.1 3.6 96

12. The researchers noticed that the total number of registered users appears to be increasing at about a constant
rate. If this pattern continues, which of the following best approximates the total number of registered users, in
millions, in year 12 (two years after the last entry in the table) ?
(A) 30.6
(B) 31.2
(C) 31.8
(D) 32.4

13. Which of the following hypotheses is most consistent with the data in the table?
(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.

GO ON TO THE NEXT PAGE.

28 AP Computer Science Principles Practice Exam


14. Consider the two programs below.

Which of the following best compares the values displayed by programs A and B?

(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.

15. Which of the following is a true statement about Internet communication?


(A) Devices from different manufacturers are required to run the same operating system to communicate
over the Internet.
(B) Every device connected to the Internet is assigned a digital certificate by a certificate authority.
(C) Every device connected to the Internet is assigned an Internet protocol (IP) address.
(D) Every device connected to the Internet requires a high-bandwidth connection to enable redundant routing
to each device.

GO ON TO THE NEXT PAGE.

AP Computer Science Principles Practice Exam 29


16. A user reads reviews of a popular artist’s new album and then downloads the album from the Web site of a
licensed online music seller. Which of the following is LEAST likely to be a consequence of this action?
(A) Advertisements for the artist’s other albums will be displayed when the user visits a different Web
site.
(B) Album reviews from other people who live nearby will be displayed to the user.
(C) Similar artists will be recommended to the user based on the user’s download selection.
(D) The user will be in violation of the Digital Millennium Copyright Act (DMCA).

17. Which of the following actions could be used to help reduce the digital divide?
I. Providing free education and training on how to use computing devices
II. Providing free or low-cost computing devices to low-income
individuals
III. Providing networks and infrastructure to people in remote areas
A) III only
B) I and II only
C) II and III only
D) I, II, and III

GO ON TO THE NEXT PAGE.

30 AP Computer Science Principles Practice Exam


18. A population researcher is interested in predicting the number of births that will occur in a particular community.
She created a computer model that uses data from the past ten years, including number of residents and the number of
babies born. The model predicted that there would be 200 births last year, but the actual number of births last year
was only 120. Which of the following strategies is LEAST likely to provide a more accurate prediction?
(A) Gathering data for additional years to try to identify patterns in birth rates
(B) Refining the model used in the computer simulation to more closely reflect the data from the past ten years
(C) Removing as many details from the model as possible so that calculations can be performed quickly
(D) Taking into consideration more information about the community, such as the ages of residents

19. A library of e-books contains metadata for each book. The metadata are intended to help a search feature find
books that users are interested in. Which of the following is LEAST likely to be contained in the metadata of each
e-book?

(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.)

GO ON TO THE NEXT PAGE.

AP Computer Science Principles Practice Exam 31


20. An application program interface (API) provides a procedure Max, which returns the greater of its two integer
arguments.
A programmer would like to find the greatest of three integer values a, b, and c. Which of the following
expressions will produce the desired result in every case?

(A) Max (Max (a, b), c)


(B) Max (a, b) - Max (b, c)
(C) Max (a, b) + Max (b, c) – Max (a, c)
(D) (Max (a, b) + Max (b, c)) / 2

GO ON TO THE NEXT PAGE.

32 AP Computer Science Principles Practice Exam


21. The following question uses a robot in a grid of squares. The robot is represented by a triangle, which is initially
facing right.

Consider the procedures below.

Which of the following code segments will move the robot to the gray square?
(A) (B)

(C) (D)

GO ON TO THE NEXT PAGE.

AP Computer Science Principles Practice Exam 33


22. A student is creating a procedure to determine whether the weather for a particular month was considered very
hot. The procedure takes as input a list containing daily high temperatures for a particular month. The procedure
is intended to return true if the daily high temperature was at least 90 degrees for a majority of days in the
month and return false otherwise.
PROCEDURE IsHot (temperatureList)
{
total ← 0
counter ← 0
FOR EACH temperature IN temperatureList
{
IF (temperature ≥ 90)
{
counter ← counter + 1
}
total ← total + 1
}
RETURN (<MISSING CODE>)
}
Which of the following can be used to replace <MISSING CODE> so that the procedure works as intended?
(A) counter < 0.5 * total
(B) counter > 0.5 * total
(C) total < 0.5 * counter
(D) total > 0.5 * counter

GO ON TO THE NEXT PAGE.

34 AP Computer Science Principles Practice Exam


23. The following figures represent different ways of configuring a network of physically linked computers labeled
P, Q, R, and S. A line between two computers indicates that the computers can communicate directly with each
other. In which configuration is it NOT possible to have redundant routing between computers P and S?

(A) (B)

(C) (D)

GO ON TO THE NEXT PAGE.

AP Computer Science Principles Practice Exam 35


Questions 24–25 refer to the information below.
Byte pair encoding is a data encoding technique. The encoding algorithm looks for pairs of characters that appear in
the string more than once and replaces each instance of that pair with a corresponding character that does not appear in
the string. The algorithm saves a list containing the mapping of character pairs to their corresponding replacement
characters.
For example, the string "THIS_IS_THE_BEST_WISH" can be encoded as "%#_#_%E_BEST_W#H" by
replacing all instances of "TH" with "%" and replacing all instances of "IS" with "#".

24. Which of the following statements about byte pair encoding is true?
(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.

25. For which of the following strings is it NOT possible to use byte pair encoding to shorten the string’s length?

(A) "BANANA"
(B) "LEVEL_UP"
(C) "MEET_ME_LATER"
(D) "NEITHER_HERE_NOR_THERE"

GO ON TO THE NEXT PAGE.

36 AP Computer Science Principles Practice Exam


26. The grid below contains a robot represented as a triangle, initially facing up. The robot can move into a white or
gray square but cannot move into a black region.

The code segment below uses the procedure GoalReached, which evaluates to true if the robot is in the
gray square and evaluates to false otherwise.
REPEAT UNTIL (GoalReached ())
{
<MISSING CODE>
}
Which of the following replacements for <MISSING CODE> can be used to move the robot to the gray
square?
(A) IF (CAN_MOVE (right)) (B) IF (CAN_MOVE (right))
{ {
ROTATE_RIGHT () ROTATE_RIGHT ()
} MOVE_FORWARD ()
MOVE_FORWARD () }

(C) IF (CAN_MOVE (forward)) (D) IF (CAN_MOVE (forward))


{ {
MOVE_FORWARD () MOVE_FORWARD ()
} ROTATE_RIGHT ()
ROTATE_RIGHT () }

GO ON TO THE NEXT PAGE.

AP Computer Science Principles Practice Exam 37


THIS PAGE INTENTIONALLY LEFT BLANK

GO ON TO THE NEXT PAGE.

38 AP Computer Science Principles Practice Exam


27. A student wrote the following code for a guessing game.
Line 1: secretNumber ← RANDOM (1, 100)
Line 2: win ← false
Line 3: REPEAT UNTIL (win)
Line 4: {
Line 5: DISPLAY ("Guess a number.")
Line 6: guess ← INPUT ()
Line 7: IF (guess = secretNumber)
Line 8: {
Line 9: DISPLAY ("You got it right!")
Line 10: }
Line 11: ELSE
Line 12: {
Line 13: IF (guess > secretNumber)
Line 14: {
Line 15: DISPLAY ("Your guess is too high.")
Line 16: }
Line 17: ELSE
Line 18: {
Line 19: DISPLAY ("Your guess is too low.")
Line 20: }
Line 21: }
Line 22: }
While debugging the code, the student realizes that the loop never terminates. The student plans to insert the
instruction win ← true somewhere in the code. Where could win ← true be inserted so that the
code segment works as intended?
(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

GO ON TO THE NEXT PAGE.

AP Computer Science Principles Practice Exam 39


28. A text-editing application uses binary sequences to represent each of 200 different characters. What is the
minimum number of bits needed to assign a unique bit sequence to each of the possible characters?
(A) 4
(B) 6
(C) 7
(D) 8

29. The diagram below shows a circuit composed of three logic gates. Each gate takes two inputs and produces a
single output.

For which of the following input values will the circuit have an output of false?
(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 = false, B = false, C = false, D = true

GO ON TO THE NEXT PAGE.

40 AP Computer Science Principles Practice Exam


30. A video-streaming service maintains a database of information about its customers and the videos they have
watched.
The program below analyzes the data in the database and compares the number of viewers of science fiction
videos to the number of viewers of videos of other genres. It uses the procedure Analysis (category),
which returns the number of unique users who viewed videos of a given category in the past year. The
Analysis procedure takes approximately 1 hour to return a result, regardless of the number of videos of the
given genre. All other operations happen nearly instantaneously.
sciFiFans ← Analysis ("science fiction")
genreList ← ["comedy", "drama", "mystery", "romance"]
FOR EACH genre IN genreList
{
IF (Analysis (genre) > sciFiFans)
{
DISPLAY (genre)
}
}
Which of the following best approximates the amount of time it takes the program to execute?
(A) 1 hour
(B) 2 hours
(C) 4 hours
(D) 5 hours

GO ON TO THE NEXT PAGE.

AP Computer Science Principles Practice Exam 41


31. The question below uses a robot in a grid of squares. The robot is represented as a triangle, which is initially in
the bottom right square of the grid and facing toward the top of the grid.

The following programs are each intended to move the robot to the gray square. Program II uses the
procedure GoalReached, which returns true if the robot is in the gray square and returns false
otherwise.

Which of the following statements is true?


(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.

GO ON TO THE NEXT PAGE.

42 AP Computer Science Principles Practice Exam


32. Participants in a survey were asked how many hours per day they spend reading, how many hours per day they
spend using a smartphone, and whether or not they would be interested in a smartphone application that lets
users share book reviews.
The data from the survey are represented in the graph below. Each × represents a survey participant who said he
or she was interested in the application, and each O represents a participant who said he or she was not
interested.

Which of the following hypotheses is most consistent with the data in the graph?
(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.

GO ON TO THE NEXT PAGE.

AP Computer Science Principles Practice Exam 43


33. A flowchart is a way to visually represent an algorithm. The flowchart below is used by an apartment rental Web
site to set the variable include to true for apartments that meet certain criteria.

Block Explanation
The start or end of the algorithm

A conditional or decision step, where execution proceeds to the side


labeled true if the condition is true and to the side labeled
false otherwise
One or more processing steps, such as a statement that assigns a
value to a variable

Which of the following statements is equivalent to the algorithm in the flowchart?


(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)

GO ON TO THE NEXT PAGE.

44 AP Computer Science Principles Practice Exam


34. A researcher wrote a program to simulate the number of mice in an environment that contains predators. The
program uses the following procedures.

Procedure Call Explanation


InitialMousePopulation () Returns the number of mice at the start of the
simulation
InitialPredatorPopulation () Returns the number of predators at the start of
the simulation
NextDayPopulation (numberOfMice, Based on the current numbers of mice and
numberOfPredators) predators, returns the number of mice after one
day
Code for the simulation is shown below.
days ← 0
numMice ← InitialMousePopulation ()
numPredators ← InitialPredatorPopulation ()
REPEAT UNTIL (days = 365)
{
numMice ← NextDayPopulation (numMice, numPredators)
days ← days + 1
}
DISPLAY ("There are")
DISPLAY (numMice)
DISPLAY ("mice after one year.")
Based on the code, which of the following assumptions is made in the simulation?
(A) The number of mice increases by 1 each day.
(B) The number of mice does not change from day to day.
(C) The number of predators increases by 1 each day.
(D) The number of predators does not change from day to day.

GO ON TO THE NEXT PAGE.

AP Computer Science Principles Practice Exam 45


35. A musician is creating a song using audio samples. Which of the following actions will minimize the risk of a
copyright violation when creating sample-based music?
(A) Using samples found on popular music-streaming sites
(B) Using samples found on peer-to-peer networks
(C) Using samples from nondigital sound sources (vinyl records, tapes, etc.)
(D) Using samples published with a no-rights-reserved Creative Commons license

36. A computer program performs the operation 2 ÷ 3 and represents the result as the value 0.6666667.
Which of the following best explains this result?
(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.

GO ON TO THE NEXT PAGE.

46 AP Computer Science Principles Practice Exam


37. The two code segments below are each intended to display the average of the numbers in the list numList.
Assume that numList contains more than one value.

Which of the following best describes the two code segments?


(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.

GO ON TO THE NEXT PAGE.

AP Computer Science Principles Practice Exam 47


38. A snack bar has a frequent customer program in which every 10th purchase is free. Customers are enrolled in
the program when they make their first purchase. A programmer is writing a program to implement the frequent
customer program. In one code segment, cost is set to 0 for every 10th purchase by a given customer. The
programmer will use the procedure GetCount (customerID), which returns the total number of
purchases a customer has made since enrolling in the frequent customer program, including his or her first
purchase.
Which of the following code segments will set cost to 0 for every 10th purchase a customer makes after
enrolling in the frequent customer program?

(A) count ← GetCount (customerID)


IF (count / 10 = 0)
{
cost ← 0
}

(B) count ← GetCount (customerID)


IF (NOT (count / 10 = 0))
{
cost ← 0
}

(C) count ← GetCount (customerID)


IF (count MOD 10 = 0)
{
cost ← 0
}

(D) count ← GetCount (customerID)


IF (NOT (count MOD 10 = 0))
{
cost ← 0
}

GO ON TO THE NEXT PAGE.

48 AP Computer Science Principles Practice Exam


. Which of the following explains a benefit of using open standards and protocols for Internet communication?

(A) Open standards and protocols allow different manufacturers and developers to build hardware and
software that can communicate with hardware and software on the rest of the network.
(B) Open standards and protocols provide ways for users to eliminate the latency of messages they send on
the Internet.
(C) Open standards and protocols allow users to freely share or reuse material found on the Internet for
noncommercial purposes.
(D) Open standards and protocols prevent developers from releasing software that contains errors.

GO ON TO THE NEXT PAGE.

AP Computer Science Principles Practice Exam 49


Questions 40–41 refer to the information below.
Grades in a computer science course are based on total points earned on a midterm exam and a final exam. The teacher
provides a way for students to improve their course grades if they receive high scores on the final exam: if a student’s
final exam score is greater than the student’s midterm exam score, the final exam score replaces the midterm exam
score in the calculation of total points.
The table below shows two students’ scores on the midterm and final exams and the calculated total points each student
earns.
Student Name Midterm Exam Score Final Exam Score Total Points Calculation
Khalil 90 80 90 ˜ 80 ° 170
Josefina 70 90 90 ˜ 90 ° 180

• Khalil does better on the midterm exam than on the final exam, so his original midterm and
final exam scores are added to compute his total points.
• Josefina does better on the final exam than on the midterm exam, so her final exam score
replaces her midterm exam score in the total points calculation.

GO ON TO THE NEXT PAGE.

50 AP Computer Science Principles Practice Exam


40. The teacher has data representing the scores of thousands of students. For each student, the data contain the
student name, the midterm exam score, the final exam score, and the result of the total points calculation. Which of
the following could be determined from the data?
I. The average total points earned per student
II. The average increase in total points per student as a result of the score replacement policy
III. The proportion of students who improved their total points as a result of the score replacement policy
A) III only
B) I and II only
C) I and III only
D) I, II, and III

41. A programmer is writing a procedure to calculate a student’s final grade in the course using the score
replacement policy described. The student’s exam scores are stored in the variables midtermExam and
finalExam. The procedure Max (a, b) returns the larger of a and b.
Which of the following could be used in the procedure to calculate a student’s total points earned in the course and
store the result in the variable adjustedTotal?

(A) adjustedTotal ← Max (midtermExam, finalExam)


(B) adjustedTotal ← Max (midtermExam, finalExam) + finalExam
(C) adjustedTotal ← Max (midtermExam, finalExam) + midtermExam
(D) adjustedTotal ← 2 * Max (midtermExam, finalExam)

GO ON TO THE NEXT PAGE.

AP Computer Science Principles Practice Exam 51


42. Internet protocol version 4 (IPv4) represents each IP address as a 32-bit binary number. Internet protocol
version 6 (IPv6) represents each IP address as a 128-bit binary number. Which of the following best describes the
result of using 128-bit addresses instead of 32-bit addresses?
(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.

43. An online retailer uses an algorithm to sort a list of n items by price. The table below shows the approximate
number of steps the algorithm takes to sort lists of different sizes.

Number of Items Number of Steps


10 100
20 400
30 900
40 1,600
50 2,500
60 3,600
Based on the values in the table, which of the following best characterizes the algorithm for very large values
of n ?
(A) The algorithm runs in reasonable time.
(B) The algorithm runs, but not in reasonable time.
(C) The algorithm attempts to solve an undecidable problem.
(D) The algorithm attempts to find an approximate solution whenever it fails to find an exact solution.

GO ON TO THE NEXT PAGE.

52 AP Computer Science Principles Practice Exam


44. A computer program uses 4 bits to represent nonnegative integers. Which of the following statements describe a
possible result when the program uses this number representation?
I. The operation 4 + 8 will result in an overflow error.
II. The operation 7 + 10 will result in an overflow error.
III. The operation 12 + 3 will result in an overflow error.
A) I only
B) II only
C) II and III only
D) I, II, and III

45. A NAND gate is a type of logic gate that produces an output of false only when both of its two inputs
are true. Otherwise, the gate produces an output of true. Which of the following Boolean expressions
correctly models a NAND gate with inputs P and Q ?
(A) (NOT P) AND (NOT Q)
(B) (NOT P) AND Q
(C) NOT (P AND Q)
(D) NOT (P OR Q)

GO ON TO THE NEXT PAGE.

AP Computer Science Principles Practice Exam 53


46. A student wants to create an algorithm that can determine, given any program and program input, whether or not
the program will go into an infinite loop for that input.
The problem the student is attempting to solve is considered an undecidable problem. Which of the following is true?
(A) It is possible to create an algorithm that will solve the problem for all programs and inputs, but the

algorithm can only be implemented in a low-level programming language.


(B) It is possible to create an algorithm that will solve the problem for all programs and inputs, but the
algorithm requires simultaneous execution on multiple CPUs.
(C) It is possible to create an algorithm that will solve the problem for all programs and inputs, but the
algorithm will not run in reasonable time.
(D) It is not possible to create an algorithm that will solve the problem for all programs and inputs.

47. In public key cryptography, the sender uses the recipient’s public key to encrypt a message. Which of the
following is needed to decrypt the message?
(A) The sender’s public key
(B) The sender’s private key
(C) The recipient’s public key
(D) The recipient’s private key

GO ON TO THE NEXT PAGE.

54 AP Computer Science Principles Practice Exam


48. In a certain science experiment, 75 percent of trials are expected to be successful and 25 percent of trials are
expected to be unsuccessful. The program below is intended to simulate the results of repeated trials of the
experiment.
successful ← 0
unsuccessful ← 0
REPEAT 1000 TIMES
{
IF (<MISSING CODE>)
{
successful ← successful + 1
}
ELSE
{
unsuccessful ← unsuccessful + 1
}
}
DISPLAY (successful)
DISPLAY ("trials were successful,")
DISPLAY (unsuccessful)
DISPLAY ("trials were unsuccessful.")
Which of the following can be used to replace <MISSING CODE> so that the simulation works as intended?

(A) RANDOM (1, 100) = 25


(B) RANDOM (1, 100) ≤ 25
(C) RANDOM (1, 100) = 75
(D) RANDOM (1, 100) ≤ 75

GO ON TO THE NEXT PAGE.

AP Computer Science Principles Practice Exam 55


49. The code segment below is intended to display all multiples of 5 between the values start and end,
inclusive. For example, if start has the value 35 and end has the value 50, the code segment should
display the values 35, 40, 45, and 50. Assume that start and end are multiples of 5 and
that start is less than end.
Line 1: i ← start
Line 2: REPEAT <MISSING EXPRESSION> TIMES
Line 3: {
Line 4: DISPLAY (i)
Line 5: i ← i + 5
Line 6: }

Which of the following could replace <MISSING EXPRESSION> in line 2 so that the code segment works as
intended?
(A) end - start + 1
(B) end - start + 6
(C) ((end - start) / 5) + 1
(D) 5 * (end - start) + 1

GO ON TO THE NEXT PAGE.

56 AP Computer Science Principles Practice Exam


50. The procedure below searches for the value target in list. It returns true if target is found and
returns false otherwise.

Which of the following are true statements about the procedure?


I. It implements a binary search.
II. It implements a linear search.
III. It only works as intended when list is sorted.
(A) I only
(B) II only
(C) I and III
(D) II and III

GO ON TO THE NEXT PAGE.

AP Computer Science Principles Practice Exam 57


51. Which of the following is an example of symmetric encryption?
(A) Evy buys a locked box that operates using two different codes. When the first code is entered, a slot opens
that allows a message to be put in the box. When the second code is entered, the door to the box opens.
Evy gives the first code to her friends so they can leave messages for her and keeps the second code to
herself so that she is the only one who can retrieve the messages.
(B) Finn and Gwen develop a system that maps each letter of the alphabet to a unique symbol using a secret
key. Finn uses the key to write a message to Gwen where each letter is replaced with the corresponding
symbol. Gwen uses the key to map each symbol back to the original letter.
(C) Hannah writes a message to send to Isabel and hides the message under a rock behind the soccer field.
Hannah gives Isabel the exact location of the rock so that only Isabel can find the message.
(D) Juan writes a message to send to Kelly and slides the message through a slot in the front of Kelly’s locker.
Juan knows that Kelly has not shared her locker combination with anyone, so no one other than Kelly will
be able to read the message.

GO ON TO THE NEXT PAGE.

58 AP Computer Science Principles Practice Exam


52. A programmer is developing a word game. The programmer wants to create an algorithm that will take a list of
words and return a list containing the first letter of all words that are palindromes (words that read the same
backward or forward). The returned list should be in alphabetical order. For example, if the list contains the
words ["banana", "kayak", "mom", "apple", "level"], the returned list would contain
["k", "l", "m"] (because "kayak", "level", and "mom" are palindromes).
The programmer knows that the following steps are necessary for the algorithm but is not sure in which order
they should be executed.

Step Explanation
Shorten Takes a list of words and returns a new list that contains only the
first letter of each word from the input list
Keep Takes a list of words and returns a list that contains only the
palindromes palindromes from the input list
Sort Takes a list of words and returns a copy of the list in alphabetical
order
Executing which of the following sequences of steps will enable the algorithm to work as intended?
I. First shorten, then keep palindromes, then sort
II. First keep palindromes, then shorten, then sort
III. First sort, then keep palindromes, then shorten
(A) I only
(B) II only
(C) I and III
(D) II and III

53. Which of the following best describes the purpose of machine learning programs?
(A) To analyze large data sets, recognize patterns, and make predictions based on data
(B) To automatically translate algorithms from natural language to machine language
(C) To determine whether an algorithm can be constructed to answer “yes” or “no” for all possible inputs
(D) To find approximate solutions to problems that would otherwise require an unreasonably long amount of
time to solve

GO ON TO THE NEXT PAGE.

AP Computer Science Principles Practice Exam 59


54. A programmer notices the following two procedures in a library. The procedures do similar, but not identical,
things.

• Procedure Square (n) returns the value n 2 .


• Procedure Cube (n) returns the value n3.
Which of the following procedures is a generalization of the procedures described above?

(A) Procedure Add (n, m), which returns the value n + m

(B) Procedure Fourth (n), which returns the value n4

(C) Procedure Polynomial(n), which returns the value n3 + n 2

(D) Procedure Power (n, m), which returns the value n m

55. A student wrote the procedure below, which is intended to ask whether a user wants to keep playing a game.
The procedure does not work as intended.
PROCEDURE KeepPlaying ()
{
DISPLAY ("Do you want to continue playing (y/n)?")
response ← INPUT ()
IF ((response = "y") AND (response = "yes"))
{
RETURN (true)
}
ELSE
{
RETURN (false)
}
}
Which of the following best describes the result of running the procedure?

(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.

GO ON TO THE NEXT PAGE.

60 AP Computer Science Principles Practice Exam


56. Consider the following program.

Which of the following describes the result of executing the program?


(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.

GO ON TO THE NEXT PAGE.

AP Computer Science Principles Practice Exam 61


57. A program contains the following procedures for string manipulation.

Procedure Call Explanation


Concat (str1, str2) Returns a single string consisting of str1 followed by str2. For
example, Concat("key", "board") returns "keyboard".
Substring (str, start, length) Returns a substring of consecutive characters from str, starting with
the character at position start and containing length characters.
The first character of str is located at position 1. For example,
Substring ("delivery", 3, 4) returns "live".

Which of the following expressions can be used to generate the string "Happy" ?
(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))

GO ON TO THE NEXT PAGE.

62 AP Computer Science Principles Practice Exam


58. Which of the following are true statements about how the Internet enables crowdsourcing?
I. The Internet can provide crowdsourcing participants access to useful tools, information, and
professional knowledge.
II. The speed and reach of the Internet can lower geographic barriers, allowing individuals from different
locations to contribute to projects.
III. Using the Internet to distribute solutions across many users allows all computational problems to be
solved in reasonable time, even for very large input sizes.
A) I and II only
B) I and III only
C) II and III only
D) I, II, and III

59. A media librarian at a movie studio is planning to save digital video files for archival purposes. The movie
studio would like to be able to access full-quality videos if they are needed for future projects. Which of the
following actions is LEAST likely to support the studio’s goal?
(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

GO ON TO THE NEXT PAGE.

AP Computer Science Principles Practice Exam 63


Directions: For each of the questions or incomplete statements below, two of the suggested answers are correct.
For each of these questions, you must select both correct choices to earn credit. No partial credit will be earned
if only one correct choice is selected. Select the two that are best in each case and then fill in the corresponding
circles that begin with number 131 on the answer sheet.

131. Which of the following are ways in which a programmer can use abstraction to manage the complexity of a program?
Select two answers.

(A) Replacing each instance of repeated code with a call to a procedure


(B) Replacing longer variable names with shorter variable names to reduce typing errors
(C) Replacing several lines of documentation with a single line of documentation
(D) Replacing the string variables name1, name2, name3, and name4 with a list of strings
called names

GO ON TO THE NEXT PAGE.

64 AP Computer Science Principles Practice Exam


132. Two different schools maintain data sets about their currently enrolled students. No individual student is
enrolled at both schools. Each line of data contains information, separated by commas, about one student.
East High School stores the data in the following format.

Data format School Name, Last Name, First Name, Age, ZIP Code, Days Absent
Sample line of data East H.S., Ableson, Carlton, 16, 98987, 8
West High School stores the data in the following format.

Data format Student ID, First Name, Last Name, Age, Days Absent
Sample line of data 87667721, Kendra, Angelos, 14, 12
The two schools would like to combine their data to make a single data set. Which of the following can be done
with the combined data?
Select two answers.
(A) The schools can create a single list of student names, sorted by last name.
(B) The schools can determine the average number of days students are absent.
(C) The schools can determine which ZIP code is represented by the most students.
(D) The schools can determine the student ID of the student with the greatest number of absences.

133. A free online encyclopedia contains articles that can be written and edited by any user. Which of the following
are advantages the online encyclopedia has over a traditional paper-based encyclopedia?
Select two answers.

(A) The ability to easily check that the encyclopedia is free of copyrighted content
(B) The ability to ensure that encyclopedia content is the same every time it is accessed
(C) The ability to have a larger number of perspectives reflected in the encyclopedia content
(D) The ability to quickly update encyclopedia content as new information becomes available

GO ON TO THE NEXT PAGE.

AP Computer Science Principles Practice Exam 65


134. The program below is intended to count the number of prime numbers in a list called numbers and display
the result. The program uses the procedure isPrime (n), which returns true if n is a prime number
and false otherwise.

The program does not work as intended.


Line 1: count ← 0
Line 2: FOR EACH value IN numbers
Line 3: {
Line 4: count ← 0
Line 5: IF (isPrime (value))
Line 6: {
Line 7: count ← count + 1
Line 8: }
Line 9: count ← count + 1
Line 10: }
Line 11: DISPLAY (count)
Which two lines of code should be removed so that the program will work as intended?
Select two answers.

(A) Line 1
(B) Line 4
(C) Line 7
(D) Line 9

135. Which of the following statements describe how cloud computing has affected Internet communication?
Select two answers.

(A) Cloud computing has eliminated the need to provide redundancy in Internet routing.
(B) Cloud computing has helped enhance collaboration.
(C) Cloud computing has introduced new data-security concerns.
(D) Cloud computing has reduced concerns about intellectual property rights.

GO ON TO THE NEXT PAGE.

66 AP Computer Science Principles Practice Exam


136. A program is created to perform arithmetic operations on positive and negative integers. The program contains
the following incorrect procedure, which is intended to return the product of the integers x and y.
PROCEDURE Multiply (x, y)
{
count ← 0
result ← 0
REPEAT UNTIL (count = y)
{
result ← result + x
count ← count + 1
}
RETURN (result)
}
A programmer suspects that an error in the program is caused by this procedure. Under which of the following
conditions will the procedure NOT return the correct product?

Select two answers.


(A) When the values of x and y are both positive.
(B) When the value of x is positive and the value of y is negative.
(C) When the value of x is negative and the value of y is positive.
(D) When the values of x and y are both negative.

GO ON TO THE NEXT PAGE.

AP Computer Science Principles Practice Exam 67


137. The procedure Smallest is intended to return the least value in the list numbers. The procedure does not
work as intended.
PROCEDURE Smallest (numbers)
{
min ← numbers[1]
FOR EACH number IN numbers
{
IF (number < min)
{
RETURN (number)
}
}
RETURN (min)
}
For which of the following values of theList will Smallest (theList) NOT return the intended
value?
Select two answers.
(A) theList ← [10, 20, 30, 40]
(B) theList ← [20, 10, 30, 40]
(C) theList ← [30, 40, 20, 10]
(D) theList ← [40, 30, 20, 10]

STOP

IF YOU FINISH BEFORE TIME IS CALLED, YOU MAY


CHECK YOUR WORK ON THIS TEST.

68 AP Computer Science Principles Practice Exam

You might also like