Computer Science 50 Flashcards Advanced 100% Free

AP - Computer Science Principles:: Algorithms and Programming

Created by Chat Robotics Community  ·  Updated 2026-08-31

Curriculum Overview

Topics & Key Concepts

Ap Computer Science Principles

Sample Flashcard Questions & Answers

Showing 8 of 50 cards
Question #1 Active Recall

What is a VARIABLE, in the AP CSP pseudocode used for the exam?

- **A)** A value that can never be changed once a program starts running
- **B)** A synonym for an algorithm
- **C)** A named location used to store a value that a program can reference and change while it runs
- **D)** A type of loop structure

Answer & Explanation:
**Answer: C)**

Variables provide a way to name and store changeable data during a program's execution -- a foundational concept shared across essentially all programming languages and pseudocode systems.
Question #2 Active Recall

In AP CSP pseudocode, what does the ASSIGNMENT operator '\(\leftarrow\)' (or '=') do, as in \(x \leftarrow 5\)?

- **A)** It checks whether \(x\) is EQUAL to 5, without changing \(x\)'s value
- **B)** It swaps the values of two different variables
- **C)** It stores the value on the right side (5) into the variable on the left side (\(x\))
- **D)** It permanently deletes the variable \(x\)

Answer & Explanation:
**Answer: C)**

Assignment stores a value into a variable -- distinct from equality comparison, which only checks a condition without changing anything.
Question #3 Active Recall

Given \(x \leftarrow 5\) followed by \(x \leftarrow x + 3\), what is the value of \(x\) afterward?

- **A)** \(8\)
- **B)** \(15\)
- **C)** \(5\)
- **D)** \(3\)

Answer & Explanation:
**Answer: A)**

The second assignment computes \(x + 3\) using \(x\)'s CURRENT value (5), then stores the result (8) back into \(x\).
Question #4 Active Recall

What is the general form of an IF-ELSE conditional statement in AP CSP pseudocode, and what does it do?

- **A)** IF-ELSE can only be used with numeric conditions, never with boolean conditions
- **B)** It executes BOTH block A and block B every single time, regardless of the condition
- **C)** IF-ELSE statements always repeat a block of code multiple times
- **D)** \(IF\ (condition)\ \{block\ A\}\ ELSE\ \{block\ B\}\) -- executes block A if the condition is true, or block B if the condition is false

Answer & Explanation:
**Answer: D)**

IF-ELSE provides exactly two mutually exclusive execution paths, just as it does across essentially every programming language.
Question #5 Active Recall

What is the purpose of a REPEAT n TIMES loop in AP CSP pseudocode?

- **A)** It executes the loop body a FIXED, KNOWN number of times (\(n\) times total)
- **B)** REPEAT n TIMES is a conditional statement, not a loop
- **C)** It executes the loop body an UNKNOWN, potentially infinite number of times with no fixed count
- **D)** It executes the loop body exactly ONCE, regardless of \(n\)

Answer & Explanation:
**Answer: A)**

REPEAT n TIMES is AP CSP's count-controlled loop construct, analogous to a fixed-iteration \(for\) loop in other languages.
Question #6 Active Recall

What is the purpose of a REPEAT UNTIL (condition) loop in AP CSP pseudocode?

- **A)** It stops executing the very first time the condition is checked, regardless of the condition's value
- **B)** REPEAT UNTIL loops can never actually repeat more than once
- **C)** It executes the loop body a fixed, predetermined number of times, identical to REPEAT n TIMES
- **D)** It repeatedly executes the loop body UNTIL the given condition becomes TRUE, meaning the exact number of repetitions isn't necessarily known in advance

Answer & Explanation:
**Answer: D)**

REPEAT UNTIL is AP CSP's condition-controlled loop, continuing until a stopping condition is finally met, rather than running a fixed number of times.
Question #7 Active Recall

Given the pseudocode \(i \leftarrow 1\)\ \(REPEAT\ 4\ TIMES\ \{\ DISPLAY(i)\ \ i \leftarrow i + 2\ \}\), what values are displayed, in order?

- **A)** \(1, 3, 5, 7\)
- **B)** \(1, 2, 3, 4\)
- **C)** \(1, 3, 5, 7, 9\)
- **D)** \(2, 4, 6, 8\)

Answer & Explanation:
**Answer: A)**

Starting at 1 and adding 2 each of the 4 iterations produces: 1, then 3, then 5, then 7 -- displayed before each increment.
Question #8 Active Recall

What is a PROCEDURE (sometimes called a function) in AP CSP pseudocode?

- **A)** Procedures can never accept any input values
- **B)** A procedure can only ever be used exactly one single time in an entire program
- **C)** A named group of programming instructions that can be CALLED (invoked) to perform a specific task, potentially multiple times from different places in a program, without rewriting the same instructions repeatedly
- **D)** A synonym for a variable

Answer & Explanation:
**Answer: C)**

Procedures let a set of instructions be defined once and reused wherever needed, avoiding duplicated code and improving organization -- the same core idea behind Java's methods.

Want to study all 50 flashcards with spaced repetition?

Practice with Anki-style scheduling, Hands-Free audio commute mode, and AI Tutor explanations.

Start Studying Full Deck Now

How You Can Study This Deck on Chat Robotics

Anki Spaced Repetition (SRS)

Algorithms schedule review intervals automatically so you retain 90%+ in minimum study time.

Hands-Free Audio Commute Mode

High-fidelity Neural Text-To-Speech reads questions and answers aloud with customizable delay timers.

Built-in AI Tutor Assistant

Stuck on a tricky concept? Click "Ask AI" on any card to receive instant deep-dive step-by-step explanations.

Subdeck & Tag Organization

Organize and filter by topic tags or drill entire subdeck hierarchies sequentially in Subdeck Scheduler.