Variables, functions, conditionals, iteration, and lists
Select a resource below to start studying.
Overview: This unit forms the computational core of AP Computer Science Principles by exploring how algorithms solve problems and how programming languages express those algorithms as executable code. An algorithm is a finite set of well-defined instructions that accomplish a specific task, and its efficiency is measured by how its resource requirements grow with input size. Students must understand variables as named storage locations that hold values, and the assignment operator as the mechanism for storing data. Boolean expressions, using comparison and logical operators, form the basis of decision-making in programs. Conditionals (if, if-else, nested conditionals) allow programs to execute different blocks of code based on whether certain conditions are true or false. Loops—for loops, while loops, and repeat until loops—enable repeated execution of code blocks, and students must be able to trace loop execution carefully to avoid off-by-one errors. Lists (or arrays) are ordered collections of elements accessed by index, and list traversal—processing each element sequentially—is one of the most common programming patterns. Procedures and functions encapsulate reusable code blocks, accept parameters as inputs, and may return values as outputs. This procedural abstraction allows developers to write modular, readable, and maintainable code. The unit also covers algorithm efficiency, comparing linear search (O(n)) and binary search (O(log n)), and emphasizing that algorithm choice can dramatically affect program performance as data scales. Students must practice tracing code, identifying infinite loops, and understanding variable scope.
x = 5) stores a value in a variable, while the equality check (x == 5) compares values.==, !=, <, >, <=, >=) and logical operators (AND, OR, NOT).If statements handle single conditions; if-else handles two branches; nested conditionals handle complex logic.For loops iterate a known number of times; while loops continue as long as a condition remains true; repeat until loops run until a condition becomes true.=) with equality comparison (==), leading to unintended variable changes.Answer each question one at a time. Click an option to select your answer.
Watch these unit review videos directly on our site.
AP Computer Science Principles(Full Review of all Content) - 2025 by Math Ace
AP CSP Semester Exam Review/Practice 1-24 by CalculusRCHS
AP CS Principles: Algorithms and Programming Review by Mr Comp Sci
Quick reference for Algorithms and Programming. Print this out and review before the exam!
x = 5 stores value; x == 5 comparesif, if-else, nested for decisionsfor (known iterations), while (condition-based), repeat untilDownload official review materials for this unit.
No URP materials available for this unit yet.
Check back soon for study guides, practice questions, and review videos.