AP Computer Science Principles - Practice Exam (70 MCQ)

AP Computer Science Principles Practice Exam

70 Multiple Choice Questions - Enhanced Difficulty

Includes Multi-Select, Reading Passage, and Error Analysis Questions

Test Mode

Full timed exam - 120 minutes

Submit all answers at the end

Mimics real AP exam conditions

📚

Study Mode

Check each answer immediately

See explanations as you go

Self-paced, no timer

Test Mode - AP CSP Practice Exam 2:00:00 0 / 70 answered
Study Mode Checked: 0 / 70 Correct: 0 Incorrect: 0

About This Practice Exam

  • 70 AP-style questions matching official exam format
  • 57 single-select + 8 multi-select + 5 passage-based questions
  • Includes challenging formats: error-finding, I/II/III analysis, NOT/EXCEPT
  • Auto-grading with detailed explanations and AP score estimate (1-5)

Instructions: For multi-select questions (marked with red badge), select ALL correct answers. Read questions carefully - watch for NOT, EXCEPT, and LEAST.

Question 1

The following procedure is intended to return the sum of all even numbers in a list, but it contains an error.

PROCEDURE sumEvens(numList) { total ← 0 FOR EACH num IN numList { IF (num MOD 2 = 1) { total ← total + num } } RETURN (total) }

Which change will make the procedure work as intended?

Question 2

Consider the following statements about Internet protocols:

  • TCP includes mechanisms for error checking and retransmission of lost packets.
  • IP is responsible for addressing and routing packets between devices.
  • HTTP encrypts all data transmitted between a web browser and server.

Which of the statements above are TRUE?

Question 3

All of the following are examples of lossy compression EXCEPT:

Question 4

Consider the following code segment:

list ← [3, 1, 4, 1, 5, 9] result ← 0 i ← 1 REPEAT UNTIL (i > LENGTH(list)) { IF (list[i] > list[i + 1]) { result ← result + 1 } i ← i + 2 } DISPLAY(result)

What is displayed when this code runs? (Assume 1-based indexing)

Question 5

A researcher collects data on student study habits and test scores. Which question can NOT be answered using only this data?

Question 6

A student wrote the following procedure to count how many times a target value appears in a list. The procedure does NOT work correctly.

PROCEDURE countOccurrences(myList, target) { count ← 0 index ← 1 REPEAT UNTIL (index > LENGTH(myList)) { IF (myList[index] = target) { count ← count + 1 RETURN (count) } index ← index + 1 } RETURN (count) }

For the call countOccurrences([2, 5, 2, 8, 2], 2), the procedure returns 1 instead of the correct answer 3. Which change fixes the error?

Question 7

In public-key cryptography, Alice wants to send a confidential message to Bob. Which keys should be used?

Question 8

A game uses a unique identifier for each player. The developers expect a maximum of 100,000 players. What is the minimum number of bits needed to represent all possible player IDs?

Question 9

Consider the following statements about procedural abstraction:

  • It allows programmers to use a procedure without knowing the details of its implementation.
  • It always improves the runtime efficiency of a program.
  • It helps manage complexity in large programs by breaking them into smaller, reusable parts.

Which of the statements above are TRUE?

Question 10

Algorithm A takes 1 second to process a list of 1,000 items. Algorithm B takes 2 seconds for the same list. When processing 2,000 items, Algorithm A takes 4 seconds while Algorithm B takes 4 seconds. Which statement is MOST likely true?

Question 11

Consider the Boolean expression: NOT (x AND y) OR z

If x = true, y = false, and z = false, what is the value of this expression?

Question 12

What value is displayed when the following code executes?

total ← 0 FOR i ← 1 TO 3 { FOR j ← 1 TO i { total ← total + 1 } } DISPLAY(total)
Question 13

Which of the following would LEAST likely help reduce the digital divide?

Question 14

A city uses a simulation to model traffic patterns and test the impact of adding a new highway exit. Which statement about this simulation is FALSE?

Question 15

Which of the following problems is undecidable?

Question 16

What is the value of result after the following code executes?

word ← "COMPUTER" result ← "" FOR i ← 1 TO LENGTH(word) { IF (i MOD 2 = 1) { result ← result + word[i] } } DISPLAY(result)
Question 17

A digital photograph contains both the image data and metadata. Which of the following is typically stored as metadata rather than image data?

Question 18

A sequential program takes 100 seconds to complete. When parallelized across 4 processors, it takes 40 seconds. Which statement BEST explains this result?

Question 19

A robot is in a 5x5 grid, starting at position (1, 1) facing right. The following commands are available: MOVE_FORWARD(), ROTATE_LEFT(), ROTATE_RIGHT(). What is the robot's position after executing this code?

REPEAT 2 TIMES { MOVE_FORWARD() MOVE_FORWARD() ROTATE_LEFT() }
Question 20

A company uses crowdsourcing to have thousands of users classify images as "cat" or "not cat." Which is a potential limitation of this approach?

Question 21

Binary search can be used to efficiently find a value in a list. Which condition must be true for binary search to work correctly?

Question 22

Consider the following procedure:

PROCEDURE mystery(a, b) { IF (a < b) { RETURN (mystery(a + 1, b)) } ELSE { RETURN (a) } }

What does mystery(3, 7) return?

Question 23

An employee receives a phone call from someone claiming to be from IT support, asking for their password to "fix an urgent system issue." This is an example of:

Question 24

Consider the following code segment:

list ← [10, 20, 30, 40] REMOVE(list, 2) INSERT(list, 2, 25) APPEND(list, 50) DISPLAY(list)

What is displayed? (Assume 1-based indexing where REMOVE removes the element at that index)

Question 25

Which Boolean expression is logically equivalent to NOT (A OR (B AND C))?

Question 26

A programmer is testing a procedure and finds that it produces incorrect output for certain inputs but works correctly for others. Which debugging strategy would be MOST effective?

Question 27

Consider the following statements about bias in computing systems:

  • Bias can be introduced when training data does not represent all groups equally.
  • Algorithms are objective and cannot reflect human biases.
  • Facial recognition systems have shown different accuracy rates across demographic groups.

Which of the statements above are TRUE?

Question 28

What is displayed when this code executes?

nums ← [2, 4, 6, 8, 10] result ← 1 FOR EACH n IN nums { IF (n < 7) { result ← result * n } } DISPLAY(result)
Question 29

When a user types "www.example.com" into a web browser, which protocol is used to translate this domain name into an IP address?

Question 30

A team of four programmers is collaborating on a software project. They use a version control system (like Git) to manage their code. Which benefit does this provide?

Question 31

A procedure is designed to find the second largest value in a list. Which test case would NOT be useful for testing edge cases?

Question 32

What is the output of the following code?

x ← 5 y ← 3 temp ← x x ← y y ← temp DISPLAY(x) DISPLAY(y)
Question 33

All of the following are true about heuristic algorithms EXCEPT:

Question 34

An 8-bit binary number can represent unsigned integers in what range?

Question 35

Which statement about HTTPS is TRUE?

Question 36

A procedure takes a list of numbers and returns a new list containing only the numbers that appear more than once. What type of operation does this primarily involve?

Question 37

A programmer writes a library of math functions to use in multiple projects. This is an example of:

Question 38

What is the decimal equivalent of the binary number 11010110?

Question 39

The following code is intended to count how many numbers in a list are between 10 and 20 (inclusive). What is wrong?

PROCEDURE countInRange(myList) { count ← 0 FOR EACH num IN myList { IF (num > 10 AND num < 20) { count ← count + 1 } } RETURN(count) }
Question 40

A website implements rate limiting to prevent brute-force attacks. What does this mean?

Question 41

Which factor is LEAST likely to contribute to computing bias?

Question 42

What is displayed?

a ← 10 b ← 3 c ← a MOD b d ← a / b DISPLAY(c + d)
Question 43

A network has multiple paths between any two computers. This design principle is called:

Question 44

Which of the following BEST describes an API?

Question 45

What is displayed after this code runs?

list ← ["a", "b", "c", "d"] i ← LENGTH(list) result ← "" REPEAT UNTIL (i < 1) { result ← result + list[i] i ← i - 1 } DISPLAY(result)
Question 46

Open-source software licensing typically allows users to:

Question 47

A streaming service uses machine learning to recommend shows. This system learns from:

Question 48

What type of error does the following code contain?

PROCEDURE average(numList) { sum ← 0 FOR EACH num IN numList { sum ← sum + num } RETURN (sum / LENGTH(numList)) }
Question 49

Which of the following is the BEST example of using abstraction in program design?

Question 50

Internet packets traveling from New York to Los Angeles may take different routes. Which statement explains why?

Question 51

What is displayed?

x ← 64 count ← 0 REPEAT UNTIL (x ≤ 1) { x ← x / 2 count ← count + 1 } DISPLAY(count)
Question 52

A company's privacy policy states they collect user data for "improving services." This data could potentially be used for all of the following EXCEPT:

Question 53

A procedure uses random values to simulate rolling two dice and returns their sum. Running the procedure twice:

Question 54

Overflow errors occur when:

Question 55

A programmer wants to document their code so others can understand it. Which is MOST important to include?

Question 56

Which correctly represents the iterative development process?

Question 57

Two computers on different continents communicate via the Internet. Which is TRUE about this communication?

Multi-Select Questions (58-65): Select ALL correct answers
Question 58 Select TWO answers

Which TWO of the following are potential benefits of using cloud computing?

Question 59 Select TWO answers

Which TWO of the following are characteristics of lossless data compression?

Question 60 Select TWO answers

Which TWO of the following help protect against phishing attacks?

Question 61 Select TWO answers

Which TWO of the following are true about algorithms?

Question 62 Select TWO answers

Which TWO are potential negative impacts of computing innovations?

Question 63 Select TWO answers

Which TWO are benefits of procedural abstraction?

Question 64 Select TWO answers

A researcher analyzes a dataset of hospital patient records. Which TWO questions can likely be answered from this data?

Question 65 Select TWO answers

Which TWO practices help ensure fault tolerance in a system?

Reading Passage Questions (66-70)

Computing Innovation: Autonomous Delivery Robots

Several companies have deployed autonomous delivery robots in urban areas. These robots use a combination of GPS, cameras, and machine learning algorithms to navigate sidewalks and deliver packages to customers.

The robots collect extensive data during operation, including video of their surroundings, GPS coordinates, delivery times, and information about obstacles encountered. This data is transmitted to company servers and used to improve the robots' navigation algorithms.

Early deployments have shown both benefits and challenges. Delivery robots can reduce traffic congestion by replacing some delivery truck trips, and they can make deliveries at times when human drivers are unavailable. However, they have been criticized for blocking sidewalks, creating accessibility issues for wheelchair users, and raising privacy concerns about constant video recording in public spaces.

The robots operate on battery power and return to charging stations between deliveries. Their range is limited to a few miles, making them most effective for short-distance deliveries in dense urban areas.

Question 66

Based on the passage, which data collected by the robots is used to improve their performance?

Question 67

According to the passage, which is a potential harmful effect of the delivery robots?

Question 68

The passage mentions that robots collect video of their surroundings. This raises concerns most closely related to which computing concept?

Question 69

The robots use "machine learning algorithms to navigate." Based on your knowledge of machine learning, this means the robots:

Question 70

Based on the passage, which would be the MOST appropriate use case for these delivery robots?

Your Results

0 / 70

Raw Score

Estimated AP Score: 1
0 Correct
0 Incorrect
0% Score

Answer Explanations

Review each question to understand the correct answers

Study Session Complete

0 / 70

Questions Correct

Estimated AP Score: 1
0 Correct
0 Incorrect
0% Score

Get in Touch

Whether you're a student, parent, or teacher — I'd love to hear from you.

Just want free AP CS resources?

Enter your email below and check the subscribe box — no message needed. Students get daily practice questions and study tips. Teachers get curriculum resources and teaching strategies.

Typically responds within 24 hours

Message Sent!

Thanks for reaching out. I'll get back to you within 24 hours.

🏫 Welcome, fellow educator!

I offer curriculum resources, practice materials, and study guides designed for AP CS teachers. Let me know what you're looking for — whether it's classroom materials, a guest speaker, or Teachers Pay Teachers resources.

Email

tanner@apcsexamprep.com

📚

Courses

AP CSA, CSP, & Cybersecurity

Response Time

Within 24 hours

Prefer email? Reach me directly at tanner@apcsexamprep.com