Arithmetic Expressions Flashcards
are the fundamental means of specifying computations in a programming language
Expressions
An arithmetic expression consists of
operators, operands, parentheses, and function calls
In most programming languages, binary operators are … which means they appear between operands
inflix
specifies the order of operations in expressions that contain more than one (1) operator
operator precedence
Three (3) types of operators
- Unary
- Binary
- Ternary
operator has a single operand
unary
operator has two (2) operands
binary
operator has three (3) operands
ternary
Operators are considered … if they are separated by a single operand
adjacent
When an expression has two (2) operators with the same precedence, the expression is evaluated according to its …
associativity
When there are two (2) adjacent operators with the same precedence, the left operator is evaluated first
left associativity
When there are two (2) adjacent operators with the same precedence, the right operator is evaluated first
right associativity
The precedence and associativity rules can be altered by placing … in expressions
parentheses
Variables in expressions are evaluated by fetching their values from memory
true
A … of a function occurs when the function changes either one of its parameters or a global variable
side effect
A … is declared outside the function but is accessible in the function
global variable
A program has the property of … if any two (2) expressions in the program that have the same value can be substituted for one another anywhere in the program, without affecting the action of the program
referential transparency
An operator can be used for more than one (1) purpose. This multiple use of an operator is called …
operator overloading