Use LEFT and RIGHT arrow keys to navigate between flashcards;
Use UP and DOWN arrow keys to flip the card;
H to show hint;
A reads text to speech;
20 Cards in this Set
- Front
- Back
What relational operator is used in C++ to test for equality?
|
==
|
|
What relational operator is used in C++ to test for non-equality?
|
!=
|
|
Which symbol is used as a logical OR operator in C++?
|
||
|
|
Which symbol is used as a logical AND operator in C++?
|
&&
|
|
Evaluate the following as either true or false, where a = 0 and b = 10,
(a == 0) && (b < 30) |
true
|
|
Evaluate the following as either true or false, where a = 0 and b = 10,
(b < 15) && (a == 10) |
false
|
|
Evaluate the following as either true or false, where a = 0 and b = 10,
(a == 3) && (c <= d) |
false
It doesn't matter if you know the values for c and d since the left side evaluates to false. Review 'short-circuit evaluation'. |
|
What is an expression called that evaluates to either true or false?
|
a logical (Boolean) expression
|
|
What is the logical (Boolean) operator for NOT in C++?
|
!
|
|
What is the term used to refer to one control statement located within another control statement?
|
nested
|
|
Use the ternary operator, ?: , to rewrite the following conditional statement,
if (x >= y) total = x; else total = y; |
total = (x >= y) ? x : y;
|
|
Is it possible to have a stand-alone 'else' statement?
|
No. It is possible to have a single 'if' statement but every 'else' must have a related 'if' statement.
|
|
What does the break statement do within a switch block?
|
It will immediately exit the switch statement.
|
|
Will the following statement always evaluate to 'true'?
if (test = 50) grade = 'A'; |
Yes, because the assignment operator = is used, test will be set to 50 and always be true. Know the difference between the assignment operator and the equality operator ==.
|
|
What is a statement called that is enclosed within a pair of braces?
|
compound statement - it will be treated as a single statement.
|
|
A control structure alters the normal sequential flow of execution in a program.
|
true
|
|
In C++, all relational operators are evaluated before logical operators.
|
true
|
|
With short-circuit evaluation, the computer evaluates the logical expression from left to right.
|
true
|
|
Every if statement must have a corresponding else.
|
false
|
|
In a switch statement, every case must have a break.
|
false
|