Deck 2: Evaluating C Expressions
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Match between columns
Question
Match between columns
Question
Match between columns
Question
Question
Match between columns
Question
Question
Match between columns
Question
Match between columns
Question
Match between columns
Question
Match between columns
Question
Match between columns
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/51
Play
Full screen (f)
Deck 2: Evaluating C Expressions
1
____ is not a valid operator in C++.
A) &
B) %=
C) ++
D) =+
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
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
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
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
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
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
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
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) %
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
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) %
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
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
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
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
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 )?
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
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
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
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
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) $
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
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
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
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
42
Match between columns
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
43
Match between columns
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
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
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
48
Match between columns
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
49
Match between columns
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
50
Match between columns
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
51
Match between columns
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck