AP Computer Science Principles Flashcards: Mathematical Expressions
Written by AP Content Team, Verified for 2026 AP Exams, Last updated: May 2026
Review key ideas with interactive flashcards. This set includes 36 cards to help you master important concepts.
Evaluate the expression: 5 * 4 MOD 6
The expression evaluates to 2. First, 5 * 4 is 20, then 20 MOD 6 is 2.
Card 1 of 36
All Flashcards (36)
Evaluate the expression: 5 * 4 MOD 6
The expression evaluates to 2. First, 5 * 4 is 20, then 20 MOD 6 is 2.
Evaluate the expression: 7 * 5
The expression evaluates to 35.
Explain the role of sequencing in implementing an algorithm.
Sequencing ensures that the instructions of an algorithm are executed in the correct, specified order to accomplish the task.
What does the MOD operator do?
The expression `a MOD b` evaluates to the remainder when a is divided by b.
What are the three fundamental constructs used to build any algorithm?
Every algorithm can be constructed using combinations of sequencing, selection, and iteration.
Evaluate the expression: 10 + 6 / 2
The expression evaluates to 13, because division is performed before addition based on the order of operations.
Evaluate the expression: 15 MOD 4 * 2
The expression evaluates to 6. First, 15 MOD 4 is 3, then 3 * 2 is 6.
What is a code statement?
A code statement is a part of program code that expresses an action to be carried out.
What are arithmetic operators?
Arithmetic operators are part of most programming languages and include addition, subtraction, multiplication, division, and modulus operators.
Evaluate the expression: 20 / 2 MOD 3
The expression evaluates to 1. First, 20 / 2 is 10, then 10 MOD 3 is 1.
What is an expression in programming?
An expression can consist of a value, a variable, an operator, or a procedure call that returns a value. Expressions are evaluated to produce a single value.
What are three ways to express an algorithm besides a programming language?
Algorithms can be expressed in a variety of ways, such as natural language, diagrams, and pseudocode.
What is the precedence of the MOD operator?
The MOD operator has the same precedence as the * (multiplication) and / (division) operators.
Evaluate the expression: 15 + 4
The expression evaluates to 19.
What familiar rule applies when evaluating mathematical expressions in programming?
The order of operations used in mathematics applies when evaluating expressions.
How can you express a simple, sequential algorithm without using a programming language?
You can express an algorithm using natural language, like a recipe, or by using diagrams and pseudocode.
Evaluate the expression: 20 MOD 5
The expression evaluates to 0, which is the remainder when 20 is divided by 5.
How do sequential statements execute?
Sequential statements execute in the order they appear in the code segment.
List the five arithmetic operators provided on the exam reference sheet.
The exam reference sheet provides the arithmetic operators: +, -, *, /, and MOD.
What are the four possible components of an expression?
An expression can consist of a value, a variable, an operator, or a procedure call that returns a value.
What are two important considerations when writing an algorithm in a programming language?
Clarity and readability are important considerations when expressing an algorithm in a programming language.
Evaluate the expression: 16 / 4 - 2
The expression evaluates to 2, because division is performed before subtraction based on the order of operations.
What determines the order in which parts of an expression are evaluated?
The evaluation of expressions follows a set order of operations defined by the programming language.
Evaluate the expression: 30 / 6
The expression evaluates to 5.
Evaluate the expression: 5 + 3 * 2
The expression evaluates to 11, because multiplication is performed before addition based on the order of operations.
What is the ultimate result of evaluating an expression?
Expressions are evaluated to produce a single value.
Evaluate the expression: 17 MOD 4
The expression evaluates to 1, which is the remainder when 17 is divided by 4.
Why is it important for a programming language to have a defined order of operations?
A defined order of operations ensures that expressions are evaluated consistently and produce a predictable, single value every time.
Evaluate the expression: 3 + 10 MOD 3
The expression evaluates to 4. First, 10 MOD 3 is 1, then 3 + 1 is 4.
How do you represent a step-by-step algorithmic process in code?
You represent a step-by-step process using sequential code statements that execute in the order they are written.
Evaluate the expression: 20 - 8
The expression evaluates to 12.
Evaluate the expression: 10 MOD 3
The expression evaluates to 1, which is the remainder when 10 is divided by 3.
What is sequencing in the context of an algorithm?
Sequencing is the application of each step of an algorithm in the order in which the code statements are given.
Evaluate the expression: 12 - 10 / 5
The expression evaluates to 10. First, 10 / 5 is 2, then 12 - 2 is 10.
How are algorithms and programming languages related?
Algorithms executed by programs are implemented using programming languages.
What is an algorithm?
An algorithm is a finite set of instructions that accomplish a specific task.