The way statements are sequenced and combined in a program determines the computed result. Programs incorporate iteration and selection constructs to represent repetition and make decisions to handle varied input values.
For relationships between two variables, expressions, or values:
a. Write expressions using relational operators.
b. Evaluate expressions that use relational operators.
A Boolean value is either true or false.
The exam reference sheet provides the following relational operators: =, ≠, >, <, ≥, and ≤.
Text and Block:
a = b
a ≠b
a > b
a < b
These are used to test the relationship between two variables, expressions, or values. A comparison using a relational operator evaluates to a Boolean value. For example, a = b evaluates to true if a and b are equal; otherwise, it evaluates to false.
For relationships between Boolean values:
a. Write expressions using logical operators.
b. Evaluate expressions that use logical operators.
The exam reference sheet provides the logical operators NOT, AND, and OR, which evaluate to a Boolean value.
The exam reference sheet provides
Text:
NOT condition
Block:
which evaluates to true if condition is false; otherwise it evaluates to false.
The exam reference sheet provides
Text:
condition1 AND condition2
Block:
which evaluates to true if both condition1 and condition2 are true; otherwise it evaluates to false.
The exam reference sheet provides
Text:
condition1 OR condition2
Block:
which evaluates to true if condition1 is true or if condition2 is true or if both condition1 and condition2 are true; otherwise it evaluates to false.
The operand for a logical operator is either a Boolean expression or a single Boolean value.
a ≥ b
a ≤ b