Deck 2: Evaluating C Expressions

Full screen (f)
exit full mode
Question
____ is not a valid operator in C++.

A) &
B) %=
C) ++
D) =+
Use Space or
up arrow
down arrow
to flip the card.
Question
You can isolate the last digit of a base-10 number by performing modulus with ____.

A) 1
B) 2
C) 10
D) 100
Question
When you use the += operator, you may insert a space between the + and the =.
Question
When an expression includes a(n) ____ operator, the mathematical operation takes place after the expression is evaluated.

A) prefix
B) postfix
C) unary
D) binary
Question
Multiplication, division, and modulus are said to have higher ____ than addition or subtraction.

A) priority
B) unifying factor
C) cast value
D) arithmetic precedence
Question
C++ provides ____ simple arithmetic operators for creating arithmetic expressions.

A) three
B) four
C) five
D) six
Question
The result of evaluating 3.0 / 4 + 2.2 is ____.

A) 2
B) 2.2
C) 2.95
D) 2.99
Question
When you mix data types in a binary arithmetic expression, the values on each side of the arithmetic operator are temporarily converted to a ____ type-the data type of the value that occupies more memory and to which all the types in the expression are converted.

A) unifying
B) standard
C) common
D) large
Question
The result of evaluating 3 / 4 + 2.2 is ____.

A) 2
B) 2.2
C) 2.95
D) 2.99
Question
The address operator (____) is a C++ unary operator that is not available for use in most other programming languages.

A) *
B) **
C) &
D) %
Question
When more than one arithmetic operator is included in an expression, then multiplication, division, and modulus operations always occur before addition or subtraction.
Question
When an expression includes a(n) ____ operator, the mathematical operation takes place before the expression is evaluated.

A) prefix
B) postfix
C) unary
D) binary
Question
The C++ modulus operator is ____.

A) &
B) #
C) !
D) %
Question
When two operations with the same precedence appear in an arithmetic expression, the operations are carried out in order from either left to right or right to left based on their ____.

A) associativity
B) precedence
C) unifying factor
D) modulus
Question
The modulus operator gives the remainder of integer division; it can be used only with integers.
Question
All precedence rules can be overridden with appropriately placed ____.

A) colons
B) semicolons
C) casts
D) parentheses
Question
All arithmetic operators are binary.
Question
The associativity of arithmetic operations (if there are no parentheses in the expression) is from right to left.
Question
To ____ a value is to transform it to another data type.

A) reduce
B) cast
C) convert
D) unify
Question
A(n) ____ is a digit added to a number (either at the end or at the beginning) that validates the authenticity of the number.

A) checksum
B) check digit
C) error detection code
D) CRC
Question
Consider the following line of C++ code:
float g = 2.0f, h = 4.4f, i = 12.8f, floatResult;
What is the purpose of the lowercase f's (e.g. 2.0 f )?
Question
A(n) ____________________ is a symbol that performs arithmetic.
Question
A(n) ____________________ is an operator that takes two operands, one on each side of the operator.
Question
A ____ expression is one that is interpreted to be true or false.

A) binary
B) mathematical
C) Boolean
D) unary
Question
____________________ are those that require only one operand.
Question
When you use ____________________ in front of a variable name, you refer to the memory address of that variable rather than the contents of the variable.
Question
Write the following operators in order of precedence, from highest to lowest:
float
int
doable
char
unsigned long
long double
long
short
unsigned int
Question
What is the hexadecimal numbering system? When is it typically used?
Question
Explain what the following statement means: "If you will use a calculated value later in a program, it is inefficient not to store it."
Question
Explain why using modulus with negative numbers can lead to unexpected results.
Question
What are the relational operators in C++?
Question
The expression cout 2); yields ____ as output.

A) 0
B) 1
C) true
D) false
Question
(4 - 4) = = 0 evaluates to ____.

A) 0
B) 1
C) true
D) false
Question
The unary operator ____ is the not operator; it means "the opposite of," and essentially reverses the true/false value of an expression.

A) !
B) &
C) %
D) $
Question
The two categories of shortcut arithmetic operators are ____________________ operators and increment and decrement operators.
Question
How can you perform an explicit cast?
Question
____ operators evaluate the relationship between operands; you use them with Boolean expressions.

A) Relational
B) Logical
C) Boolean
D) Mathematical
Question
A(n) ____________________ is a deliberate cast (as opposed to an automatic one).
Question
What should you keep in mind when dividing integers?
Question
!5 evaluates to ____.

A) -1
B) 0
C) 1
D) N/A
Question
Match between columns
positive value operator when used alone in front of an operand
mixed expression
positive value operator when used alone in front of an operand
long double
positive value operator when used alone in front of an operand
%=
positive value operator when used alone in front of an operand
char
positive value operator when used alone in front of an operand
associativity
positive value operator when used alone in front of an operand
count++
positive value operator when used alone in front of an operand
+
positive value operator when used alone in front of an operand
++count
positive value operator when used alone in front of an operand
implicit cast
Question
Match between columns
postfix increment operator
mixed expression
postfix increment operator
long double
postfix increment operator
%=
postfix increment operator
char
postfix increment operator
associativity
postfix increment operator
count++
postfix increment operator
+
postfix increment operator
++count
postfix increment operator
implicit cast
Question
Match between columns
prefix increment operator
mixed expression
prefix increment operator
long double
prefix increment operator
%=
prefix increment operator
char
prefix increment operator
associativity
prefix increment operator
count++
prefix increment operator
+
prefix increment operator
++count
prefix increment operator
implicit cast
Question
What is a common C++ programming error when comparing two values in C++?
Question
Match between columns
modulus and assign operator
mixed expression
modulus and assign operator
long double
modulus and assign operator
%=
modulus and assign operator
char
modulus and assign operator
associativity
modulus and assign operator
count++
modulus and assign operator
+
modulus and assign operator
++count
modulus and assign operator
implicit cast
Question
What are static fields?
Question
Match between columns
rule that dictates the order in which an operator works with its operands
mixed expression
rule that dictates the order in which an operator works with its operands
long double
rule that dictates the order in which an operator works with its operands
%=
rule that dictates the order in which an operator works with its operands
char
rule that dictates the order in which an operator works with its operands
associativity
rule that dictates the order in which an operator works with its operands
count++
rule that dictates the order in which an operator works with its operands
+
rule that dictates the order in which an operator works with its operands
++count
rule that dictates the order in which an operator works with its operands
implicit cast
Question
Match between columns
is performed automatically and without your intervention
mixed expression
is performed automatically and without your intervention
long double
is performed automatically and without your intervention
%=
is performed automatically and without your intervention
char
is performed automatically and without your intervention
associativity
is performed automatically and without your intervention
count++
is performed automatically and without your intervention
+
is performed automatically and without your intervention
++count
is performed automatically and without your intervention
implicit cast
Question
Match between columns
has the lowest precedence of the unifying types
%=
has the lowest precedence of the unifying types
mixed expression
has the lowest precedence of the unifying types
long double
has the lowest precedence of the unifying types
char
has the lowest precedence of the unifying types
associativity
has the lowest precedence of the unifying types
count++
has the lowest precedence of the unifying types
+
has the lowest precedence of the unifying types
++count
has the lowest precedence of the unifying types
implicit cast
Question
Match between columns
has the highest precedence of the unifying types
mixed expression
has the highest precedence of the unifying types
long double
has the highest precedence of the unifying types
%=
has the highest precedence of the unifying types
char
has the highest precedence of the unifying types
associativity
has the highest precedence of the unifying types
count++
has the highest precedence of the unifying types
+
has the highest precedence of the unifying types
++count
has the highest precedence of the unifying types
implicit cast
Question
Match between columns
for example, 3.2 * 2
mixed expression
for example, 3.2 * 2
long double
for example, 3.2 * 2
%=
for example, 3.2 * 2
char
for example, 3.2 * 2
associativity
for example, 3.2 * 2
count++
for example, 3.2 * 2
+
for example, 3.2 * 2
++count
for example, 3.2 * 2
implicit cast
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/51
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 2: Evaluating C Expressions
1
____ is not a valid operator in C++.

A) &
B) %=
C) ++
D) =+
D
2
You can isolate the last digit of a base-10 number by performing modulus with ____.

A) 1
B) 2
C) 10
D) 100
C
3
When you use the += operator, you may insert a space between the + and the =.
False
4
When an expression includes a(n) ____ operator, the mathematical operation takes place after the expression is evaluated.

A) prefix
B) postfix
C) unary
D) binary
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
5
Multiplication, division, and modulus are said to have higher ____ than addition or subtraction.

A) priority
B) unifying factor
C) cast value
D) arithmetic precedence
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
6
C++ provides ____ simple arithmetic operators for creating arithmetic expressions.

A) three
B) four
C) five
D) six
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
7
The result of evaluating 3.0 / 4 + 2.2 is ____.

A) 2
B) 2.2
C) 2.95
D) 2.99
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
8
When you mix data types in a binary arithmetic expression, the values on each side of the arithmetic operator are temporarily converted to a ____ type-the data type of the value that occupies more memory and to which all the types in the expression are converted.

A) unifying
B) standard
C) common
D) large
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
9
The result of evaluating 3 / 4 + 2.2 is ____.

A) 2
B) 2.2
C) 2.95
D) 2.99
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
10
The address operator (____) is a C++ unary operator that is not available for use in most other programming languages.

A) *
B) **
C) &
D) %
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
11
When more than one arithmetic operator is included in an expression, then multiplication, division, and modulus operations always occur before addition or subtraction.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
12
When an expression includes a(n) ____ operator, the mathematical operation takes place before the expression is evaluated.

A) prefix
B) postfix
C) unary
D) binary
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
13
The C++ modulus operator is ____.

A) &
B) #
C) !
D) %
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
14
When two operations with the same precedence appear in an arithmetic expression, the operations are carried out in order from either left to right or right to left based on their ____.

A) associativity
B) precedence
C) unifying factor
D) modulus
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
15
The modulus operator gives the remainder of integer division; it can be used only with integers.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
16
All precedence rules can be overridden with appropriately placed ____.

A) colons
B) semicolons
C) casts
D) parentheses
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
17
All arithmetic operators are binary.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
18
The associativity of arithmetic operations (if there are no parentheses in the expression) is from right to left.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
19
To ____ a value is to transform it to another data type.

A) reduce
B) cast
C) convert
D) unify
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
20
A(n) ____ is a digit added to a number (either at the end or at the beginning) that validates the authenticity of the number.

A) checksum
B) check digit
C) error detection code
D) CRC
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
21
Consider the following line of C++ code:
float g = 2.0f, h = 4.4f, i = 12.8f, floatResult;
What is the purpose of the lowercase f's (e.g. 2.0 f )?
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
22
A(n) ____________________ is a symbol that performs arithmetic.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
23
A(n) ____________________ is an operator that takes two operands, one on each side of the operator.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
24
A ____ expression is one that is interpreted to be true or false.

A) binary
B) mathematical
C) Boolean
D) unary
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
25
____________________ are those that require only one operand.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
26
When you use ____________________ in front of a variable name, you refer to the memory address of that variable rather than the contents of the variable.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
27
Write the following operators in order of precedence, from highest to lowest:
float
int
doable
char
unsigned long
long double
long
short
unsigned int
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
28
What is the hexadecimal numbering system? When is it typically used?
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
29
Explain what the following statement means: "If you will use a calculated value later in a program, it is inefficient not to store it."
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
30
Explain why using modulus with negative numbers can lead to unexpected results.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
31
What are the relational operators in C++?
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
32
The expression cout 2); yields ____ as output.

A) 0
B) 1
C) true
D) false
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
33
(4 - 4) = = 0 evaluates to ____.

A) 0
B) 1
C) true
D) false
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
34
The unary operator ____ is the not operator; it means "the opposite of," and essentially reverses the true/false value of an expression.

A) !
B) &
C) %
D) $
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
35
The two categories of shortcut arithmetic operators are ____________________ operators and increment and decrement operators.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
36
How can you perform an explicit cast?
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
37
____ operators evaluate the relationship between operands; you use them with Boolean expressions.

A) Relational
B) Logical
C) Boolean
D) Mathematical
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
38
A(n) ____________________ is a deliberate cast (as opposed to an automatic one).
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
39
What should you keep in mind when dividing integers?
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
40
!5 evaluates to ____.

A) -1
B) 0
C) 1
D) N/A
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
41
Match between columns
positive value operator when used alone in front of an operand
mixed expression
positive value operator when used alone in front of an operand
long double
positive value operator when used alone in front of an operand
%=
positive value operator when used alone in front of an operand
char
positive value operator when used alone in front of an operand
associativity
positive value operator when used alone in front of an operand
count++
positive value operator when used alone in front of an operand
+
positive value operator when used alone in front of an operand
++count
positive value operator when used alone in front of an operand
implicit cast
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
42
Match between columns
postfix increment operator
mixed expression
postfix increment operator
long double
postfix increment operator
%=
postfix increment operator
char
postfix increment operator
associativity
postfix increment operator
count++
postfix increment operator
+
postfix increment operator
++count
postfix increment operator
implicit cast
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
43
Match between columns
prefix increment operator
mixed expression
prefix increment operator
long double
prefix increment operator
%=
prefix increment operator
char
prefix increment operator
associativity
prefix increment operator
count++
prefix increment operator
+
prefix increment operator
++count
prefix increment operator
implicit cast
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
44
What is a common C++ programming error when comparing two values in C++?
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
45
Match between columns
modulus and assign operator
mixed expression
modulus and assign operator
long double
modulus and assign operator
%=
modulus and assign operator
char
modulus and assign operator
associativity
modulus and assign operator
count++
modulus and assign operator
+
modulus and assign operator
++count
modulus and assign operator
implicit cast
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
46
What are static fields?
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
47
Match between columns
rule that dictates the order in which an operator works with its operands
mixed expression
rule that dictates the order in which an operator works with its operands
long double
rule that dictates the order in which an operator works with its operands
%=
rule that dictates the order in which an operator works with its operands
char
rule that dictates the order in which an operator works with its operands
associativity
rule that dictates the order in which an operator works with its operands
count++
rule that dictates the order in which an operator works with its operands
+
rule that dictates the order in which an operator works with its operands
++count
rule that dictates the order in which an operator works with its operands
implicit cast
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
48
Match between columns
is performed automatically and without your intervention
mixed expression
is performed automatically and without your intervention
long double
is performed automatically and without your intervention
%=
is performed automatically and without your intervention
char
is performed automatically and without your intervention
associativity
is performed automatically and without your intervention
count++
is performed automatically and without your intervention
+
is performed automatically and without your intervention
++count
is performed automatically and without your intervention
implicit cast
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
49
Match between columns
has the lowest precedence of the unifying types
%=
has the lowest precedence of the unifying types
mixed expression
has the lowest precedence of the unifying types
long double
has the lowest precedence of the unifying types
char
has the lowest precedence of the unifying types
associativity
has the lowest precedence of the unifying types
count++
has the lowest precedence of the unifying types
+
has the lowest precedence of the unifying types
++count
has the lowest precedence of the unifying types
implicit cast
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
50
Match between columns
has the highest precedence of the unifying types
mixed expression
has the highest precedence of the unifying types
long double
has the highest precedence of the unifying types
%=
has the highest precedence of the unifying types
char
has the highest precedence of the unifying types
associativity
has the highest precedence of the unifying types
count++
has the highest precedence of the unifying types
+
has the highest precedence of the unifying types
++count
has the highest precedence of the unifying types
implicit cast
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
51
Match between columns
for example, 3.2 * 2
mixed expression
for example, 3.2 * 2
long double
for example, 3.2 * 2
%=
for example, 3.2 * 2
char
for example, 3.2 * 2
associativity
for example, 3.2 * 2
count++
for example, 3.2 * 2
+
for example, 3.2 * 2
++count
for example, 3.2 * 2
implicit cast
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 51 flashcards in this deck.