AP CSP Practice Test Procedures Lists

Big Idea 3 Practice Test - Part 3

Procedures & Lists

25 Multiple-Choice Questions

⏱ 30 minutes recommended 📊 25 questions 🎯 Big Idea 3 Focus

Test Instructions

  • This test focuses on Big Idea 3: Procedures, parameters, return values, lists, and list algorithms
  • Select one answer for each question
  • You can change your answers before submitting
  • Click "Submit Test" when finished to see your score and explanations
  • For AP exam practice, try to complete the test in 30 minutes
Question 1
Consider this procedure:
PROCEDURE calculate(a, b) { result ← a * 2 + b RETURN result }
What is returned by calculate(5, 3)?
Question 2
Given the list: myList ← [10, 20, 30, 40, 50]
What does myList[3] return? (assume list indices start at 1)
Question 3
What does LENGTH([5, 10, 15, 20]) return?
Question 4
After this code executes, what is in newList?
oldList ← [1, 2, 3] newList ← [] APPEND(newList, oldList[2]) APPEND(newList, oldList[1])
Question 5
What is the purpose of a parameter in a procedure?
Question 6
Consider: numbers ← [7, 3, 9, 1, 5]
After REMOVE(numbers, 3), what is in numbers?
Question 7
What does this procedure return?
PROCEDURE mystery(list) { total ← 0 FOR EACH item IN list { total ← total + item } RETURN total } result ← mystery([2, 4, 6])
Question 8
After: INSERT(myList, 2, 99) where myList = [10, 20, 30], what is myList?
Question 9
Which statement about procedures is MOST accurate?
Question 10
What does this code produce?
nums ← [5, 10, 15, 20, 25] result ← [] FOR EACH n IN nums { IF (n MOD 10 = 0) { APPEND(result, n) } } DISPLAY(result)
Question 11
A procedure findMax(list) should return the largest value in a list. Which is a correct implementation?
Question 12
After these statements, what is myList?
myList ← [1, 2, 3] APPEND(myList, 4) REMOVE(myList, 1)
Question 13
What does this procedure do?
PROCEDURE process(data) { count ← 0 FOR EACH item IN data { IF (item > 0) { count ← count + 1 } } RETURN count }
Question 14
Consider: items ← ["A", "B", "C", "D"]
What is items[LENGTH(items)]?
Question 15
What does this return?
PROCEDURE combine(list1, list2) { result ← [] FOR EACH item IN list1 { APPEND(result, item) } FOR EACH item IN list2 { APPEND(result, item) } RETURN result } output ← combine([1, 2], [3, 4])
Question 16
Which operation adds an element to the END of a list?
Question 17
What does this procedure return for findAverage([10, 20, 30])?
PROCEDURE findAverage(numbers) { sum ← 0 FOR EACH num IN numbers { sum ← sum + num } RETURN sum / LENGTH(numbers) }
Question 18
After executing this, what does result contain?
data ← [5, 12, 8, 3, 15] result ← [] FOR EACH val IN data { IF (val < 10) { APPEND(result, val) } }
Question 19
Which is a valid reason to use procedures in programming?
Question 20
Given: colors ← ["red", "blue", "green"]
After colors[2] ← "yellow", what is colors?
Question 21
What is returned by this procedure?
PROCEDURE check(values) { FOR EACH v IN values { IF (v < 0) { RETURN false } } RETURN true } result ← check([5, 0, 3, -2, 1])
Question 22
After: newList ← []
APPEND(newList, 10)
APPEND(newList, 20)
INSERT(newList, 1, 5)
What is newList?
Question 23
What does this procedure return for reverseList([1, 2, 3])?
PROCEDURE reverseList(original) { reversed ← [] i ← LENGTH(original) REPEAT UNTIL (i = 0) { APPEND(reversed, original[i]) i ← i - 1 } RETURN reversed }
Question 24
Which statement about list indices is correct in AP CSP pseudocode?
Question 25
What does this return?
PROCEDURE doubleAll(nums) { result ← [] FOR EACH n IN nums { APPEND(result, n * 2) } RETURN result } output ← doubleAll([3, 5, 7])
--

out of 25

--

Answer Review

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

[email protected]

📚

Courses

AP CSA, CSP, & Cybersecurity

Response Time

Within 24 hours

Prefer email? Reach me directly at [email protected]