AP Computer Science A · Unit practice
AP Computer Science A Unit 4: practice questions
5 exam-style questions with answers and explanations. Answer them on FiveStudy to keep a streak and see your AP® score estimate.
Question 1
A school library app signs students in with their student ID so that it can tell them when a reserved book is ready. The app also keeps the title of every book each student has borrowed since enrolling.
Which of the following best explains a privacy risk of keeping the borrowing history?
- A. It becomes a privacy risk only if a bug in the app's code exposes the stored titles to other users
- B. It is a privacy risk only for students who have borrowed books on sensitive or personal topics
- C. It is a lasting record of each named student's reading, open to anyone who later reaches it
- D. It stops being a privacy risk once the student graduates, because the account is no longer used
Answer: It is a lasting record of each named student's reading, open to anyone who later reaches it
The history ties a named student to every title the student has borrowed, so it reveals reading interests to whoever later gets access to the records: staff, a future system, or an intruder. That risk comes from keeping the data, and it lasts as long as the records do. Tying the risk to a bug is the misconception the course warns against: personal privacy is at risk whenever personal data is stored, even by correct code. Limiting the risk to sensitive titles misses that a full reading history reveals a student's interests whatever the topics are. Graduation does not end the risk, because the titles are still stored against the student's name after the account goes quiet, which is exactly the problem with keeping data longer than it is needed.
Question 2
A pizza-ordering app needs a delivery address for each order. Its sign-up form also requires each user's date of birth and a profile photo, although no feature of the app uses either one. Which change best addresses the privacy risk created by the birth dates and photos?
- A. Remove both fields from the form, so the app does not collect or store them
- B. Delete each delivery address after the order arrives, and keep the other fields
- C. Keep both fields, but move them to the last page of the sign-up form
- D. Ask for both fields again at every order so the stored values stay accurate
Answer: Remove both fields from the form, so the app does not collect or store them
The birth dates and photos are personal data that the app collects and stores without ever using. Removing the fields means there is nothing to expose, which is the strongest safeguard a programmer can apply: data that was never collected cannot be leaked, misused, or kept too long. Deleting delivery addresses after use limits a different field and leaves the unused birth dates and photos on file. Moving the fields to the last page changes the form's layout, but every user still has to supply them. Asking for them at every order makes the problem worse, because the app gathers the same unneeded data more often and stores fresher copies of it.
Question 3
A messaging app offers to upload a user's entire phone contact list so that it can find the user's friends who also use the app. The app stores every uploaded name and phone number. Which of the following best describes a privacy concern with this feature?
- A. The user agreed to the upload, so the feature creates no privacy risk for anyone in the list
- B. The feature is a risk only to the people in the list who already have accounts with the app
- C. Contacts saved under nicknames may be matched to the wrong accounts when the list is checked
- D. People in the list have their names and numbers stored even if they never use the app
Answer: People in the list have their names and numbers stored even if they never use the app
The upload gives the app personal data about everyone in the user's contact list, and the app keeps it. Most of those people never chose to use the app, so their names and numbers are now stored by a company they have no relationship with, open to its staff, its later systems, and anyone who breaks in. The user's agreement covers the user's own decision; it cannot give consent on behalf of every person in the list. People without accounts face more of a concern, not less, because their data is held by an app they never chose. Nickname mismatches are an accuracy problem in finding friends, not a risk to anyone's privacy.
Question 4
A homework-planner app stores each student's name, school, and full weekly class schedule on the developer's server. The developer tests the app thoroughly and finds no bugs. Which of the following statements about the app's privacy risk is most accurate?
- A. The app poses no privacy risk, because thorough testing found no bugs in the code that stores data
- B. The stored schedules still put privacy at risk by showing where each named student is all week
- C. The app poses a privacy risk only when a student chooses to share a schedule with a classmate
- D. Showing each schedule only after the student logs in removes the app's privacy risk completely
Answer: The stored schedules still put privacy at risk by showing where each named student is all week
The course states that when using a computer, personal privacy is at risk. A weekly schedule stored with a name and a school records where a specific student is at each hour, so the risk comes from the stored data itself, not from any flaw in the code. Finding no bugs shows that the code does what it was written to do; it does not change what the server holds or who might reach it later. Sharing with a classmate is one way the data can spread, but the server copy is at risk whether or not anyone shares it. A login controls who can view a schedule in the app, but the schedules are still stored on the server, so the risk is reduced rather than removed.
Question 5
A programmer is designing the Student class for a tutoring service that matches each student with a tutor by subject and available hours. Which design decision best reflects the programmer's responsibility to safeguard users' personal privacy?
- A. Store every field the sign-up form allows, in case a future feature needs one of them
- B. Leave privacy choices to the users, since they decided to enter their own details
- C. Store only the fields the matching uses, leaving out details such as a home address
- D. Add a promise that the service will keep users' personal data from ever being exposed
Answer: Store only the fields the matching uses, leaving out details such as a home address
The course places the duty on the programmer: when developing new programs, programmers should attempt to safeguard the personal privacy of the user. Matching by subject and available hours needs those fields, not a home address, so leaving unused details out of the class removes their risk entirely. Storing every possible field in case it is needed later collects personal data with no current purpose, which adds risk. Leaving the choice to users moves the responsibility away from the person who decides what the program collects and keeps. A promise that data will never be exposed is one no program can keep; the duty is to make a real attempt, such as collecting less, not to guarantee an outcome.
More AP Computer Science A practice