Skip to main content

AP Computer Science Principles Unit 4 practice questions

Try 10 multiple-choice questions from Unit 4 here. Pick an answer to see why it's right or wrong, then take the timed test above for a full AP-style set.

  1. Question 1

    A video streaming service experiences a sudden surge in new subscribers, causing the recommendation engine to lag significantly and fail to update user preferences. Which of the following best describes the cause of this performance issue?

    The system lacks scalability, preventing it from efficiently processing the increased volume of user data.

    The system lacks encryption, preventing it from efficiently securing the increased volume of user data.

    The system lacks redundancy, preventing it from efficiently backing up the increased volume of user data.

    The system lacks portability, preventing it from efficiently transferring the increased volume of user data.

    Show answer

    Answer: (A)

    Linking the surge in users to the system lag highlights scalability as the capacity of a system to adapt as the amount of data processing increases.

  2. Question 2

    A global team of developers agrees to use the standard TCP/IP protocols for transmitting data between their servers rather than creating a custom protocol. How does this decision to use a standard abstraction reduce complexity for the team?

    It eliminates the need to design and debug low-level data transmission rules from scratch.

    It guarantees that the data transmitted between servers is automatically encrypted and secure.

    It prevents the servers from communicating with devices that do not belong to the organization.

    It increases the bandwidth available for data transmission by compressing the data packets.

    Show answer

    Answer: (A)

    Linking the use of standard protocols to the avoidance of redundant low-level work.

  3. Question 3

    A messaging app is being developed for journalists working in hostile environments where communication interception is a major threat. Which encryption protocol best fits this purpose?

    End-to-end encryption where only the sender and receiver hold the keys

    Server-side encryption where the service provider manages the keys

    Transport layer security that encrypts data only while in transit

    No encryption to ensure messages can be recovered if a password is lost

    Show answer

    Answer: (A)

    Evaluating the security threat model indicates that third-party access must be eliminated. End-to-end encryption ensures that not even the service provider can access the messages, fitting the high-security purpose.

  4. Question 4

    When sending an email, the email client uses standard protocols like the Simple Mail Transfer Protocol (SMTP) without handling the physics of signal transmission. How does this layering of abstraction manage complexity?

    It separates concerns so software developers can build applications without managing electrical signals.

    It eliminates latency so the email arrives at its destination instantly regardless of distance.

    It prevents data loss so the email is guaranteed to be delivered even if the network cable is cut.

    It encrypts the content so the email cannot be read by anyone other than the intended recipient.

    Show answer

    Answer: (A)

    Layering allows developers to work at the application level, relying on lower layers to handle physical transmission details, which simplifies application development.

  5. Question 5

    In a multiplayer online game, Player A sees Player B's character move across the screen. What data serves as the input to Player A's computer to enable this?

    Data packets from the server containing Player B's coordinates serve as input to Player A.

    The graphics rendered on Player A's monitor serve as input to the game's physics engine.

    The keyboard commands from Player A serve as input to control Player B's character movement.

    The local game files on Player A's hard drive serve as input to determine network speed.

    Show answer

    Answer: (A)

    Tracing the network communication reveals the input source. Player A's computer receives coordinate data from the server as input to update the local game state.

  6. Question 6

    A company plans to build a smart light bulb that users can control via an existing popular home automation hub. What technical specification must the developers investigate to ensure compatibility?

    The communication protocols supported by the home automation hub

    The maximum number of devices the home automation hub can simultaneously connect to

    The operating system installed on the home automation hub's central processor

    The electrical power consumption rating of the home automation hub during normal operation

    Show answer

    Answer: (A)

    To interface with an external system, the device must use a compatible communication standard (like Zigbee or Wi-Fi) supported by that hub.

  7. Question 7

    A voting system uses this algorithm: Step 1: Read voterID. Step 2: Check votedList. Step 3: If voterID is in votedList, reject. Step 4: Add voterID to votedList and accept. Two machines run this algorithm simultaneously. If both read the same ID at the same time, what is the risk?

    Both machines might accept the vote because the ID was not yet added

    Both machines might reject the vote because the ID was already added

    One machine will accept and the other will reject the vote correctly

    The system will crash due to simultaneous access to the list file

    Show answer

    Answer: (A)

    This describes a race condition. If Machine A and Machine B both execute Step 2 before either executes Step 4, both will see the ID is missing and both will proceed to accept the vote, resulting in a double vote.

  8. Question 8

    A chat application fails to display messages in the correct order due to network delays. The developer switches from a raw data stream to using a TCP/IP library that handles sequencing. How does this abstraction correct the error?

    It manages the complexity of packet ordering and retransmission, presenting a reliable stream of data to the application.

    It eliminates the need for error checking by ensuring all packets arrive in the correct sequence without any possibility of data loss or corruption.

    It hides the implementation details of packet ordering from the application, allowing the developer to focus on message display logic rather than network protocol specifics.

    It reduces the complexity of the application code by removing the need for the developer to manually implement packet sequencing logic at the application layer.

    Show answer

    Answer: (A)

    Network protocols abstract the unreliable nature of the internet, providing a guaranteed order of delivery that fixes the sequencing error.

  9. Question 9

    IPv4 addresses use 32 bits, limiting the number of unique devices. IPv6 uses 128 bits. How does a network library abstraction manage the complexity of transitioning between these standards?

    It provides a unified interface that handles both address types transparently

    It forces all devices to upgrade to IPv6 before they can communicate data

    It converts all IPv6 addresses into IPv4 addresses by truncation logic

    It assigns multiple devices to the same IP address to save address space

    Show answer

    Answer: (A)

    The library hides the low-level bit differences between the protocols, allowing the application to work regardless of the underlying address size.

  10. Question 10

    The Internet Protocol version 4 (IPv4) uses 32-bit addresses, limiting the network to approximately 4.3 billion unique devices. Which solution was adopted to permanently solve this address exhaustion?

    Implementing IPv6, which uses 128-bit addresses to vastly expand the space.

    Implementing Network Address Translation (NAT) to allow multiple devices to share a single IPv4 address.

    Implementing classless routing protocols to subdivide the 32-bit address space more efficiently.

    Implementing a hierarchical addressing system to allow reuse of IPv4 addresses across different geographic regions.

    Show answer

    Answer: (A)

    Evaluating the limitation of 2322^{32} addresses led to the development of IPv6. Using 128 bits (21282^{128}) provides an effectively infinite number of addresses, solving the exhaustion problem.

What's on the AP Computer Science Principles Unit 4 practice test

The standard version takes about 34 minutes and follows the timing and directions of the AP exam, sized to one unit:

  • 20 Multiple Choice Questions (34 minutes)

Questions are drawn from 893 multiple-choice questions written for Unit 4, Computer Systems & Networks.

Review Unit 4 before you start

Other AP Computer Science Principles unit tests