Skip to content
OpenExam.
HomeAll exams
  1. Home
  2. All exams
  3. AP Computer Science Principles
  4. Room for pencil and paper.
OverviewLearnPracticeFlashcards8
Practice a setSample questionsPDF worksheetsPrint custom set
PRINT STUDIO

Room for pencil and paper.

Print a worksheet, or choose “Save as PDF” in your browser’s print dialog.

OpenExam.AP COMPUTER SCIENCE PRINCIPLES · FOUNDATION PRACTICE

Mixed skills

Name: __________________________Date: __________________

10 original practice questions · Untimed · Follow each question’s response instructions

1. A student installs a newly released network card from a small manufacturer. Without any custom configuration, the card exchanges data with devices made by other companies. Which feature of Internet protocols most directly explains this?

A. Only the destination address matters for delivery, so devices can communicate without following shared rules.B. The card and the existing devices follow the same open protocols, whose specifications are publicly available.C. Delivery order is managed by each device’s manufacturer, so compatibility depends on vendors matching their private implementations.D. The card interoperates because modern devices automatically share the same bandwidth, which removes the need for common rules.
ap-csp-q-11

2. A program sets vals ← [3, 7, 2, 9, 5] and i ← 2, then runs DISPLAY(vals[i + 2]). What does it display?

A. 7, the element sitting at index iB. An index error, because an arithmetic expression cannot be used as a list indexC. 9D. 5, the element in the fifth slot
ap-csp-q-07

3. A program sets vals ← [3, 8, 2, 6] and total ← 0, then runs FOR EACH v IN vals { IF(v >= 3) { total ← total + v } ELSE { total ← total + 1 } }, then DISPLAY(total). What does it display?

A. 19, the sum of every element in valsB. 16, reading the >= test as strictly greaterC. 17, adding only the elements that pass the testD. 18
ap-csp-q-09

4. A sensor package logs the unsigned binary value 101011. What decimal value does it represent?

A. 53B. 86C. 43D. 15
ap-csp-q-02

5. A four-packet video clip is sent from one student’s device to another. The packets leave in order and carry addressing and sequencing information, but they arrive at the receiving device in the order 3, 1, 4, 2. What does the receiving device do to produce the complete clip?

A. It plays the pieces in arrival order, because that arrival order reflects the routes the packets actually took across the networks.B. It asks the sender to resend all four packets along one fixed route so the copies arrive in order.C. It restores the original order using each packet’s sequencing information, then reassembles the clip from the ordered pieces.D. It waits for the network’s last router to reassemble the clip into one finished stream before delivering it.
ap-csp-q-10

6. A program sets age ← 13 and approved ← false, then runs DISPLAY(NOT (age >= 13) OR approved). What does it display?

A. true, because age >= 13 is true and one true part is enough for ORB. false, because NOT (age >= 13) is false and false OR false is false.C. true, because 13 is not strictly greater than 13D. true, because NOT applies after the OR is decided and flips the combined result
ap-csp-q-04

7. A weather panel runs IF(temp > 30) { DISPLAY("Hot") } ELSE { IF(temp > 20) { DISPLAY("Mild") } ELSE { DISPLAY("Cool") } } with temp ← 28. Which output does it produce?

A. Nothing, because the first condition is false and an IF block runs no statements when its condition is false.B. Hot, because 28 is a high temperatureC. Hot and then Mild, because both comparisons involving 28 can succeed in one passD. Mild
ap-csp-q-05

8. Before a photo is uploaded, an app divides it into packets. Which description matches what each packet carries under the Internet’s packet-switching design?

A. a portion of the photo plus addressing and sequencing information for reassembly at the receiving deviceB. a complete copy of the photo, so that every packet could independently rebuild it without needing the othersC. the destination address only, with the photo’s order recovered afterward by sorting the packets by their sizeD. the total packet count only, which the routers then use to place every packet into its sequence
ap-csp-q-12

9. An arcade cabinet stores each score in a fixed 8-bit unsigned integer. A score reaches the largest value the 8 bits can hold, and the player then earns one more point. Which outcome follows from the fixed number of bits?

A. Eight bits still represent 256 distinct patterns, so the new score of 256 remains representable within them.B. The score stays at its maximum and the extra point is dropped without any error or indication appearing.C. The stored bit pattern rotates, so the score wraps around to a low value near zero, as some languages handle values beyond their range.D. The value 256 is outside the 0-255 range the fixed 8 bits can name, so the score no longer fits: an overflow error occurs.
ap-csp-q-03

10. A program runs queue ← [10, 20, 30, 40], then INSERT(queue, 2, 15), then REMOVE(queue, 3), then APPEND(queue, 50). What is queue afterward?

A. [10, 15, 40, 50]B. [10, 15, 30, 40, 50]C. [10, 20, 40, 15, 50]D. [10, 15, 20, 40, 50]
ap-csp-q-08
OpenExam.ANSWER KEY · KEEP SEPARATE

Answers & reasoning

1. The card and the existing devices follow the same open protocols, whose specifications are publicly available. · Choice B

The exchange works with no configuration because the new card and the existing devices implement the same open protocols, whose specifications are publicly available. Open standards are what allow devices from different manufacturers to interoperate. The alternatives either drop the need for shared rules, privatize them behind vendor matching, or substitute an unrelated measure (bandwidth). None explains why an unconfigured device from a new maker can participate immediately.

ap-csp-q-11

2. 9 · Choice C

Compute the index first: i + 2 = 4. Lists are indexed from 1, so vals[4] is the fourth element of [3, 7, 2, 9, 5], which is 9. The index is valid because 4 is between 1 and LENGTH(vals) = 5. The two numeric alternatives come from skipping the addition or counting slots from 0, and the error option misstates when the index rule applies. All three contradict the 1-based indexing convention, under which the n-th element sits at index n with no offset.

ap-csp-q-07

3. 18 · Choice D

FOR EACH visits 3, 8, 2, 6 in order, one pass each. Passes: 3 >= 3 adds 3; 8 >= 3 adds 8; 2 fails the test, so the ELSE adds 1; 6 >= 3 adds 6. total = 3 + 8 + 1 + 6 = 18. Each pass runs exactly one branch, and the ELSE pass contributes 1 rather than v. The three wrong totals come from adding v unconditionally, tightening >= to >, or dropping the ELSE pass altogether.

ap-csp-q-09

4. 43 · Choice C

Label each place from the right as 1, 2, 4, 8, 16, 32. The 1-bits sit in the 32, 8, 2 and 1 places, so the value is 32 + 8 + 2 + 1 = 43. Verify by converting back: 43 - 32 = 11, 11 - 8 = 3, 3 - 2 = 1, 1 - 1 = 0, which lights exactly the bits of 101011. Each wrong option shifts, reverses, or replaces the place row, changing which powers of two enter the sum.

ap-csp-q-02

5. It restores the original order using each packet’s sequencing information, then reassembles the clip from the ordered pieces. · Choice C

The receiving device reads each packet’s sequencing information and restores the original order 1, 2, 3, 4 before reassembly. The arrival order 3, 1, 4, 2 reflects the different routes the packets took, not the message’s structure. The distractor procedures all act at the wrong place or on the wrong evidence: arrival order (routes, not content), resending on one route (unnecessary and contrary to independent paths), or reassembly in a router (ordering information travels for the destination’s use). The stated packet design decides the procedure.

ap-csp-q-10

6. false, because NOT (age >= 13) is false and false OR false is false. · Choice B

Evaluate the comparison first: 13 >= 13 is true because >= includes the boundary. NOT reverses that to false. Finally false OR false evaluates to false, so the program displays false. Re-check the grouping to see why every true option fails: NOT binds to the parenthesized comparison only, and OR combines the two already-evaluated parts. The three wrong options correspond to dropping NOT, tightening the boundary, or widening NOT over the whole OR.

ap-csp-q-04

7. Mild · Choice D

The outer condition temp > 30 is false at 28, so control passes into the ELSE block. The nested condition temp > 20 is true at 28, so the nested IF runs DISPLAY("Mild") and the nested ELSE is skipped. Trace one decision at a time: the outer IF/ELSE chose the ELSE subtree, and inside it the nested IF/ELSE chose Mild. The failed outer test neither skipped the construct (an ELSE exists) nor allowed a second display.

ap-csp-q-05

8. a portion of the photo plus addressing and sequencing information for reassembly at the receiving device · Choice A

Each packet carries a piece of the original data together with the addressing information used to route it and the sequencing information used to restore order at the destination. Check each alternative against what delivery and reconstruction require: a full copy removes the division, address-only loses the ordering, and count-only names neither position nor route. Only portion-plus-addressing-plus-sequencing supports both.

ap-csp-q-12

9. The value 256 is outside the 0-255 range the fixed 8 bits can name, so the score no longer fits: an overflow error occurs. · Choice D

Eight bits form 2^8 = 256 patterns, and as unsigned integers those patterns name 0 through 2^8 - 1 = 255. The value 256 would need a 257th pattern, so it exceeds what the allotted bits can represent. That failure is overflow: a computed value exceeds the maximum for the allotted bits. The stem fixes the width at 8 bits, so the options that keep the value playable, by clamping or wrapping, describe program choices outside the stated representation rule.

ap-csp-q-03

10. [10, 15, 30, 40, 50] · Choice B

Apply one operation at a time to the index row. INSERT(queue, 2, 15) shifts 20, 30, 40 right and gives [10, 15, 20, 30, 40]. REMOVE(queue, 3) deletes the value at index 3, which is now 20, and shifts the tail left: [10, 15, 30, 40]. APPEND(queue, 50) adds 50 at the end: [10, 15, 30, 40, 50]. Each wrong option breaks exactly one step: replacing instead of shifting, appending instead of inserting at index 2, or reordering the statements. Tracking the length after each step, 5 then 4 then 5, catches the replace and append errors immediately.

ap-csp-q-08

Original selected foundation practice. Educator review is pending. Not an official exam paper.

OpenExam · Independent AP Computer Science Principles practiceFoundation pilot · No official score predictionAbout & editorial approachSources & content notes