Big Idea 3 Unit Test Part A: Programming Fundamentals (3.1-3.9) | AP CSP Practice Test

AP CSP Course Big Idea 3 Big Idea 3 Unit Test Part A: Programming Fundamentals (3.1-3.9)
Test
Big Idea 3 • Algorithms and Programming

Big Idea 3 Unit Test Part A: Programming Fundamentals (3.1-3.9)

📝 14 questions 🎯 AP exam difficulty ✅ Auto-scored

📋 Unit Test instructions

Part A of the Big Idea 3 test covers programming fundamentals, topics 3.1 through 3.9.

Answer all 14 questions, then press Submit test. You will see your score, which questions you missed, and the correct answer with an explanation. Passing is 70%, the AP benchmark. You can retake it.

0 of 14 answered
Question 1 of 143.1 Variables and Assignment

Consider the following program. What is displayed?

a <- 4
b <- 7
a <- b
b <- a + 2
DISPLAY(a)
DISPLAY(b)
Answer: B. Correct. a <- b sets a to 7, then b <- a + 2 uses the new value of a (7), giving 9.
Question 2 of 143.2 Data Abstraction

A program stores 40 student scores. Instead of 40 separately named variables, the programmer uses one list called scores. In terms of data abstraction, what is the main advantage of the list?

Answer: C. Correct. A list is a data abstraction: one name manages many related values, letting a single loop process all of them.
Question 3 of 143.3 Mathematical Expressions

In this expression, MOD has the same precedence as multiplication and division, which is higher than addition. What does the program display?

total <- 3 + 14 MOD 4
DISPLAY(total)
Answer: A. Correct. MOD is evaluated before addition, so 14 MOD 4 is 2, and 3 + 2 is 5.
Question 4 of 143.3 Mathematical Expressions

Using standard order of operations, what does the program display?

result <- 2 + 3 * 4 - 1
DISPLAY(result)
Answer: A. Correct. Multiplication happens first: 3 * 4 is 12, then 2 + 12 - 1 is 13.
Question 5 of 143.4 Strings

Consider the following program that uses string concatenation and the LENGTH procedure. What is displayed?

name <- "AP"
name <- name + "CSP"
DISPLAY(LENGTH(name))
Answer: B. Correct. Concatenation joins AP and CSP into APCSP, which has 5 characters.
Question 6 of 143.5 Boolean Expressions

Given a <- 5 and b <- 8, which of the following conditions evaluate to true?

  • I. (a < b) AND (b < 10)
  • II. NOT (a = b)
  • III. (a > b) OR (b < a)
Answer: D. Correct. I is true (5 < 8 and 8 < 10 both hold) and II is true (a is not b); III is false because neither 5 > 8 nor 8 < 5 holds.
Question 7 of 143.5 Boolean Expressions

Consider the following program. What is displayed?

x <- 10
IF ((x > 5) AND NOT (x > 12))
{
  DISPLAY("A")
}
ELSE
{
  DISPLAY("B")
}
Answer: A. Correct. x > 5 is true and x > 12 is false, so NOT (x > 12) is true; true AND true runs the IF branch.
Question 8 of 143.6 Conditionals

The program below uses two separate IF statements, not an IF/ELSE. What is displayed?

n <- 6
IF (n MOD 2 = 0)
{
  DISPLAY("even")
}
IF (n > 5)
{
  DISPLAY("big")
}
Answer: A. Correct. These are two independent IF statements, so both conditions are tested; 6 MOD 2 = 0 and 6 > 5 are both true.
Question 9 of 143.7 Nested Conditionals

Consider the following program with nested conditionals. What is displayed?

age <- 16
hasLicense <- "no"
IF (age >= 16)
{
  IF (hasLicense = "yes")
  {
    DISPLAY("Can drive")
  }
  ELSE
  {
    DISPLAY("Needs license")
  }
}
ELSE
{
  DISPLAY("Too young")
}
Answer: B. Correct. age >= 16 is true, so control enters the inner IF; hasLicense is not yes, so the inner ELSE runs.
Question 10 of 143.8 Iteration

Consider the following program. What is displayed?

sum <- 1
REPEAT 4 TIMES
{
  sum <- sum * 2
}
DISPLAY(sum)
Answer: D. Correct. Starting at 1 and doubling four times gives 2, then 4, then 8, then 16.
Question 11 of 143.8 Iteration

Consider the following program. What value is displayed?

n <- 1
REPEAT UNTIL (n > 5)
{
  n <- n + 2
}
DISPLAY(n)
Answer: C. Correct. n takes the values 1, 3, 5, 7; the loop stops once n > 5 is true, leaving n at 7.
Question 12 of 143.9 Developing Algorithms

The two code segments below run on the same value of x. Do they always assign the same final value to y?

Segment 1:
IF (x > 10)
{
  y <- 1
}
IF (x > 5)
{
  y <- 2
}

Segment 2:
IF (x > 5)
{
  y <- 2
}
IF (x > 10)
{
  y <- 1
}
Answer: D. Correct. When x > 10 both conditions are true, so the last assignment wins: Segment 1 leaves y = 2 and Segment 2 leaves y = 1.
Question 13 of 143.9 Developing Algorithms

You need an algorithm that displays the larger of two distinct numbers stored in a and b. Which algorithm always does this correctly?

Answer: B. Correct. If a > b it shows a; otherwise b is the greater value, so the larger number is always displayed.
Question 14 of 143.9 Developing Algorithms

A programmer already has a tested algorithm that checks whether an input is a valid whole number, and a separate tested algorithm that computes a shipping cost. To build a program that validates the input and then computes the cost, which approach best reflects developing an algorithm by combining existing ones?

Answer: C. Correct. Existing algorithms can be combined and sequenced; validating first and then computing reuses tested components to build a larger solution.

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]