Quiz 4
This operator takes an operand and reverses its truth or falsehood
!
This operator represents the logical AND
&&
What will the following program display? #include <iostream> using namespace std; int main() { int a = 0, b = 2, x = 4, y = 0; cout << (a == b) << " "; cout << (a != b) << " "; cout << (b <=x) << " "; cout << (y > a) << endl; return 0; }
0 1 1 0
What will be the value of result after the following code has been executed? int a = 60, b = 15, result = 10; if (a = b) result *= 2;
20
Which value can be entered to cause the following code segment to display the message "That number is acceptable."
99
This operator is used in C++ to represent equality
==
Input values should always be checked for (Hint: make one or more selections)
Appropriate range Reasonableness Division by zero, if division is taking place
What will the following segment of code output if 11 is entered at the keyboard? int number; cin >> number; if (number > 0) cout << "C++"; else cout << "Soccer"; cout << " is "; cout << "fun" << endl;
c++ is fun
Relational operators allow you to ____________ numbers.
compare
When an if statement is placed within the conditionally-executed code of another if statement, this is known as:
nesting