6 Questions
What does the 'DISPLAY()' function do?
Displays the value of an expression
In the expression '17 MOD 5', what does the result evaluate to?
2
What is the result of '17 / 5' according to the given text?
3.4
What does the 'RANDOM(a, b)' function do?
Generates and returns a random integer from a to b
Which operators are used to perform arithmetic operations on variables 'a' and 'b'?
+, -, *, /
What is the purpose of the relational operators '=' and '≠'?
To compare equality or inequality between values
Study Notes
Instruction Text
-
a ← expression
assigns a copy of the result of the expression to the variablea
. -
DISPLAY(expression)
displays the value of the expression, followed by a space. -
INPUT()
accepts a value from the user and returns the input value.
Arithmetic Operators and Numeric Procedures
- Arithmetic operators (
+
,*
,/
, etc.) perform arithmetic operations ona
andb
. -
a MOD b
evaluates to the remainder whena
is divided byb
. - The
MOD
operator has the same precedence as other operators. - The order of operations used in mathematics applies when evaluating expressions.
Random Number Generation
-
RANDOM(a, b)
generates and returns a random integer froma
tob
. - Each result is equally likely to occur.
Relational and Boolean Operators
- Relational operators:
=
,≠
,>
,<
,≥
, and≤
. - These operators are used to compare values.
Order of Operations
- The order of operations used in mathematics applies when evaluating expressions.
- This means that expressions are evaluated in the following order: parentheses, exponents, multiplication and division, and addition and subtraction.
Test your knowledge of the AP Computer Science Principles Exam Reference Sheet for Fall 2020. Questions cover topics like assignment, display, and input statements in pseudocode.
Make Your Own Quizzes and Flashcards
Convert your notes into interactive study material.
Get started for free