Skip to content
StudyFame

AP CSP MCQ Practice Test 4 with Answers

Each question has four options. Pick one to check your answer, or click Show answer to see the answer with an explanation. This test covers filtering and sorting data, Boolean logic, binary search, list procedures, encryption, data privacy and parallel computing.

  1. 1. A spreadsheet lists cafes with four columns: name, number of reviews, accepts cards (yes or no) and average rating. A student wants a list of only the cafes that have at least one review and accept cards, with the highest rating first. Which of these sequences of steps produce that list?

    I.   Remove cafes with 0 reviews, then remove cafes that don't accept cards,
         then sort by rating (highest first)
    II.  Sort by rating (highest first), then remove cafes that don't accept cards,
         then remove cafes with 0 reviews
    III. Remove cafes that don't accept cards, then sort by rating (highest first),
         then remove cafes with 0 reviews
  2. 2. Using the same kind of cafe data, a column priceRange holds "lo", "med" or "hi", and a column rating holds the average rating. Which expression is true exactly for the cafes whose price range is "lo" or "med" and whose rating is at least 4.0?

  3. 3. Which situation is an example of a rogue access point?

  4. 4. Which statement about algorithms is true?

  5. 5. Which statement describes symmetric encryption?

  6. 6. Which project is best suited to citizen science?

  7. 7. A sorted list has 128 elements. Using binary search, what is the maximum number of list elements that must be examined to find a value or decide it is not in the list?

  8. 8. The procedure hasDuplicate(list, target) should return true if target appears in list at least two times, and false otherwise. Which version works as intended?

    Code I
    count ← 0
    FOR EACH item IN list
    {
      IF (item = target)
      { count ← count + 1 }
    }
    RETURN(count ≥ 2)
    
    Code II
    FOR EACH item IN list
    {
      IF (item = target)
      { RETURN(true) }
    }
    RETURN(false)
    
    Code III
    count ← 0
    FOR EACH item IN list
    {
      IF (item = target)
      { count ← count + 1 }
      RETURN(count ≥ 2)
    }
    
    Code IV
    count ← 1
    FOR EACH item IN list
    {
      IF (item = target)
      { count ← count + 1 }
    }
    RETURN(count ≥ 2)
  9. 9. A warehouse records every truck that passes its gate: the truck's ID, its weight, the date and time, and whether it is entering or leaving. Which question can NOT be answered using only this data?

  10. 10. myList contains ["fork", "spoon", "tongs", "spatula", "whisk"]. Which code segment changes it to ["whisk", "fork", "spoon", "tongs", "spatula"]? (Lists start at index 1. INSERT(list, i, value) puts value at index i and shifts the later elements right.)

    Code I
    INSERT(myList, 1, myList[LENGTH(myList)])
    
    Code II
    temp ← myList[1]
    REMOVE(myList, 1)
    APPEND(myList, temp)
    
    Code III
    temp ← myList[LENGTH(myList)]
    REMOVE(myList, LENGTH(myList))
    INSERT(myList, 1, temp)
    
    Code IV
    REMOVE(myList, LENGTH(myList))
    INSERT(myList, 1, myList[LENGTH(myList)])
  11. 11. A teacher wants to compare the average grade of students who are in a club with students who are not. Student IDs are unique. Which spreadsheets together give enough information?

    Spreadsheet I    student ID, name, grade (every student in the school)
    Spreadsheet II   student IDs of the students who are in a club
    Spreadsheet III  club names and the days each club meets
  12. 12. A computer has two processors that can run at the same time. Four independent processes must run; each runs on one processor:

    Process  Time
    P        25 seconds
    Q        10 seconds
    R        20 seconds
    S        15 seconds

    Which assignment finishes all four processes in the least time?

  13. 13. JogBuddy is a free running app. It uses the phone's GPS to suggest running routes that start where the user is. A user can share a planned route so that nearby JogBuddy users who run at a similar pace can join. Free accounts see targeted ads based on the user's activity; a paid premium account shows no ads. Which data does the app need in order to suggest a route that starts where the user is?

  14. 14. Using the JogBuddy description from the previous question: to show a shared route to nearby runners, what additional data does the app need?

  15. 15. Using the JogBuddy description: which is the most likely benefit of the app?

  16. 16. Using the JogBuddy description: which is the biggest data-privacy concern?

  17. 17. Using the JogBuddy description: which users are LEAST likely to see targeted advertisements?

  18. 18. A circuit takes two Boolean inputs a and b and gives this output:

    a      b      output
    true   true   false
    true   false  true
    false  true   true
    false  false  true

    Which expressions give this output for every row?

    I.   (NOT a) OR (NOT b)
    II.  (NOT a) AND (NOT b)
    III. NOT (a OR b)
    IV.  NOT (a AND b)
  19. 19. The procedure should return "minor" for ages under 18, "adult" for ages 18 to 64, and "senior" for ages 65 and over. It does not work as intended.

    Line 1:  PROCEDURE ageGroup(age)
    Line 2:  {
    Line 3:    result ← "adult"
    Line 4:    IF (age < 18)
    Line 5:    {
    Line 6:      result ← "minor"
    Line 7:    }
    Line 8:    RETURN(result)
    Line 9:    result ← "adult"
    Line 10:   IF (age ≥ 65)
    Line 11:   {
    Line 12:     result ← "senior"
    Line 13:   }
    Line 14:   RETURN(result)
    Line 15: }

    Which change makes the procedure work as intended?

  20. 20. The variable hot is true and the variable humid is false. Which expression evaluates to true?