This Big Idea covers the vast majority of the code you'll see on the AP test in the spring. It describes basic components of most programming languages such as variables, lists, and procedures.
Unlike AP Comp Sci A, which only teaches Java, there's no programming language specification for AP CSP. Your teacher could use a block-based language like Scratch or a text-based language like Python. In order to accommodate for these differences, The AP CSP test uses a basic Pseudocode, or a simplified programming language.
The College Board's Pseudocode shares many similarities with the coding language Python, which is used to help write examples across this guide.
All photos of Pseudocode come from the Exam Reference Sheet on page 214 of the CED,
found here.Learning Objective: Represent a value with a variable.
Learning Objective: Determine the value of a variable as a result of an assignment.
a variable is a placeholder for a value
spelling and capitalization matter for variable names
data types are different categories of data that your computer can represent
Learning Objective: Represent a list or string using a variable.
Learning Objective: For data abstraction, develop data abstraction using lists to store multiple elements; explain how the use of data abstraction manages complexity in program code.
elements are individual values in a list
each element has an index value
data abstraction simplifies a set of data by representing it in some general way
list
element
index
string
array
Learning Objective: Express an algorithm that uses sequencing without using a programming language.
Learning Objective: Represent a step-by-step algorithmic process using sequential code statements.β
Learning Objective: Evaluate expressions that use arithmetic operators.
an algorithm represents the problem-solving logic
programs execute algorithms
steps in your algorithm are implemented in the order they're written in
MOD operator
evaluating an expression is done through an order of operations specified by the programming language
algorithm
sequencing
code statement
expression
Learning Objective: Evaluate expressions that manipulate strings.
strings are an ordered list of characters that you can navigate through using index values
you can't perform mathematical operations with strings, but you can still manipulate them
slicing is the process to create a substring
concatenation is the process of joining strings together
string concatenation
substring
Learning Objective: For relationships between two variables, expressions, or values, write expressions using relational operators; evaluate expressions that use relational operators.
Learning Objective: For relationships between Boolean values, write expressions using logical operators; evaluate expressions that use logic operators.
Boolean variables can only represent the values true or false
relational operators are used with Boolean values to test the relationship between two values
NOT, AND, and OR are logical operators that evaluate either Boolean expressions or a single Boolean value
Learning Objective: Express an algorithm that uses selection without using a programming language.
Learning Objective: For selection, write conditional statements; determine the result of conditional statements.
Learning Objective: For nested selection, write nested conditional statements; determine the result of nested conditional statements.
nested conditional statements are conditional statements inside conditional statements
if the conditions for the outer conditional statement are not satisfied, the conditions for the nested conditional statement will not even be checked
Learning Objective: Express an algorithm that uses iteration without using a programming language.
Learning Objective: For iteration, write iteration statements; determine the result or side effect of iteration statements.
"repeat n times" loops happen a set number of times - these are for loops in Python
"repeat until (condition)" loops happen until a condition is met - these are while loops in Python
you can use logical operators when writing conditions for loops
Learning Objective: Compare multiple algorithms to determine if they yield the same side effect or result.
Learning Objective: For algorithms, create algorithms; combine and modify existing algorithms.
different algorithms can be used to achieve the same goals
algorithms that look similar might yield different side effects or results
new algorithms can be created from scratch or by combining and modifying algorithms that already exist
none
Learning Objective: For list operations, write expressions that use list indexing and list procedures; evaluate expressions that use list indexing and list procedures.
Learning Objective: For algorithms involving elements of a list, write iteration statements to traverse a list; determine the result of an algorithm that includes list traversal.
there are basic operations you can perform on a list
access an element by index
assign the value of an element of a list to a variable
assign a value to an element
assign the value of one element in the list to another
insert elements at a given index
add elements to the end of the list
remove elements
determine the length of the list
you can traverse through a list, either through a complete traversal or a partial traversal
traverse
linear/sequential search
Learning Objective: For binary search algorithms, determine the number of iterations required to find a value in a data set; explain the requirements necessary to complete a binary search.
Learning Objective: For procedure calls, write statements to call procedures; determine the result or effect of a procedure call.
you use a procedure to use the same set of instructions without having to rewrite it into your code
procedures often require some sort of parameter in order to work
you call procedures with arguments
once a procedure terminates (either because there are no more lines or you use a return statement), the program goes back to where the procedure was called and continues reading code sequentially
procedure
parameters
arguments
Learning Objective: Explain how the use of procedural abstraction manages complexity in a program.
Learning Objective: Develop procedural abstractions to manage complexity in a program by writing procedures.β
you can call a procedure without knowing how it works
procedures allow you to solve a large problem based on the solution to smaller sub-problems
procedural abstraction allows programmers the flexibility to modify or fix procedures without affecting the whole program, as long as the procedure continues to function in the same way
procedural abstraction
modularity
Learning Objective: Select appropriate libraries or existing code segments to use in creating new programs.
you can import already-existing code from a library to help you create new programs
you can also import code you've already written
APIs help you understand how the procedures in a library behave and how to use them
Learning Objective: For generating random values, write expressions to generate possible values; evaluate expressions to determine the possible results.
none
Learning Objective: For simulations, explain how computers can be used to represent real-world phenomena or outcomes; compare simulations with real-world contexts.
simulations are simplifications of complex objects or phenomena for a stated goal, such as investigating real-world events and conditions
to develop a simulation, you have to remove certain real world details or simplify how something functions
simulations run the risk of being too simple or conveying the wrong message about what you're trying to study
simulations may contain bias based on what the creator chose to include or exclude
Learning Objective: For determining the efficiency of an algorithm, explain the difference between algorithms that run in reasonable time and those that do not; identify situations where a heuristic solution may be more appropriate.
informally, efficiency is measured by determining how many times a statement or statement group executes
algorithms that run with a polynomial efficiency or lower are said to run in a reasonable amount of time
algorithms that run with an exponential or factorial efficiency run in an unreasonable amount of time
some problems can't be solved in a reasonable amount of time, so we look for an approximate solution using a heuristic
Learning Objective: Explain the existence of undecidable problems in computer science.
decidable problem
undecidable problem
- Practically, this translates to a good portion of the questions on the test. This unit also makes up the bulk of your final Create project. It's a big part of this course.