Big Idea 3: Algorithms and Programming

Ben Davis
16 min read
Listen to this study note
Study Guide Overview
This study guide covers Big Idea 3: Algorithms and Programming for AP Computer Science Principles. It includes: variables, data types, lists, strings, Boolean expressions, conditionals (including nested conditionals), iteration, developing algorithms, binary search, calling and developing procedures, libraries, random values, simulations, algorithmic efficiency, and undecidable problems. The guide emphasizes pseudocode and provides practice questions and exam tips.
#AP Computer Science Principles: Big Idea 3 - Algorithms and Programming š
Welcome to your ultimate study guide for Big Idea 3! This section is HUGE, making up 30-35% of your AP exam, and it's also the core of your Create project. Let's get you ready to ace it!
This unit is a major focus of the AP exam. Master these concepts for a strong score!
#The Big Idea: Code Fundamentals
This Big Idea covers the core programming concepts you'll need. Think of it as the building blocks of all the code you'll see on the AP test. It introduces variables, lists, and procedures that are common to most programming languages. Instead of a specific language, the AP CSP test uses Pseudocode, a simplified language that's similar to Python. Remember, all pseudocode examples come from the College Board's Exam Reference Sheet.
#3.1 Variables and Assignments
Variables are like containers that hold values. Remember, capitalization matters!
#Key Ideas
- Variables are placeholders for values.
- Variable names are case-sensitive (e.g.,
myVar
is different frommyvar
). - Data types categorize data (e.g., numbers, text).
#Vocabulary
- Variable: A named storage location in memory.
- Data Types: Categories of values (e.g., integer, string, boolean).
#Resources
š 3.1: Variables and Assignments
Practice Question
Multiple Choice:
- What is the value of
x
after the following code is executed?
pseudocode
x ā 5
x ā x + 2
(A) 5 (B) 2 (C) 7 (D) Error
-
Which of the following is NOT a valid variable name?
(A)
my_variable
(B)myVariable
(C)1variable
(D)myVar1
Free Response:
Write a pseudocode program that declares a variable named age
and assigns it your age, then increases it by one, and then prints the new age.
Scoring:
- 1 point: Correct declaration and assignment of
age
. - 1 point: Correctly incrementing
age
by one. - 1 point: Correctly printing the new value of
age
.
#3.2 Data Abstraction
#Key Ideas
- Lists store multiple elements.
- Each element has an index (position), starting from 1 in pseudocode.
- Data abstraction simplifies data for easier program management.
#Vocabulary
- List: An ordered collection of elements.
- Element: An individual value in a list.
- Index: The position of an element in a list.
- String: A sequence of characters.
- Array: Another term for list (often used interchangeably).
#Resources
Practice Question
Multiple Choice:
- What is the value of
myList[2]
after the following code is executed?
pseudocode
myList ā [10, 20, 30, 40]
(A) 10 (B) 20 (C) 30 (D) 40
-
Which of the following best describes data abstraction?
(A) Making code more complex (B) Simplifying data representation (C) Writing code in multiple languages (D) Using only integers
Free Response:
Create a pseudocode program that initializes a list called scores
with three numbers. Then, print the second element of the list.
Scoring:
- 1 point: Correct initialization of the list
scores
. - 1 point: Correctly accessing and printing the second element of
scores
.
#3.3 Mathematical Expressions
#Key Ideas
- Algorithms are the logic behind problem-solving.
- Programs execute algorithms step-by-step.
- The
MOD
operator gives the remainder of a division. - Expressions are evaluated using order of operations (PEMDAS).
#Vocabulary
- Algorithm: A step-by-step procedure for solving a problem.
- Sequencing: Executing code statements in order.
- Code Statement: A single instruction in a program.
- Expression: A combination of values, variables, and operators.
#Resources
š 3.3: Mathematical Expressions
Practice Question
Multiple Choice:
-
What is the result of the expression
17 MOD 5
?(A) 2 (B) 3 (C) 3.4 (D) 12
-
What is the value of
result
after the following code is executed?
pseudocode
result ā 5 + 3 * 2
(A) 16 (B) 11 (C) 10 (D) 13
Free Response:
Write pseudocode to calculate the average of three numbers: 10, 20, and 30. Store the result in a variable called average
and print it.
Scoring:
- 1 point: Correctly summing the three numbers.
- 1 point: Correctly dividing by 3 to find the average.
- 1 point: Correctly assigning the result to
average
and printing it.
#3.4 Strings
#Key Ideas
- Strings are ordered lists of characters.
- Use index values to access characters.
- String slicing creates substrings.
- Concatenation joins strings.
#Vocabulary
- String Concatenation: Joining strings together.
- Substring: A portion of a string.
#Resources
š 3.4: Strings
Practice Question
Multiple Choice:
-
What is the result of the expression
"hello" + "world"
?(A)
helloworld
(B)hello world
(C)"hello" + "world"
(D) Error -
If
myString
is"computer"
, what isSUBSTRING(myString, 3, 5)
?(A)
comp
(B)mput
(C)mpu
(D)put
Free Response:
Write pseudocode that declares a string variable called message
with the value "Hello, World!". Then, print the substring that contains only "World".
Scoring:
- 1 point: Correctly declaring and assigning the string to
message
. - 1 point: Correctly extracting and printing the substring "World".
#3.5 Boolean Expressions
Boolean values are either true
or false
.
#Key Ideas
- Boolean variables store
true
orfalse
. - Relational operators (e.g.,
<
,>
,==
) compare values. - Logical operators (
NOT
,AND
,OR
) combine Boolean values.
#Vocabulary
- Boolean Value: A value that is either
true
orfalse
.
#Resources
Practice Question
Multiple Choice:
-
What is the result of the expression
(5 > 3) AND (2 < 1)
?(A)
true
(B)false
(C) Error (D) None...

How are we doing?
Give us your feedback and let us know how we can improve