COMP 150 Final EXAM part 2
This operator takes an operand and reverses its truth or falsehood
!
You can use these to override the rules of operator precedence in a mathematical expression.
(parentheses)
Assume that x is an int variable. What value is assigned to x after the following assignment is executed? x=-3+4%6/5;
-3
What is the value of number after the following statements execute?
15
In the following C++ statement, what will be executed first according to the order of precedence? result=6-3*2+7-10/2;
3*2
This operator is used in C++ to represent equality
==
The __________ operator always follows the cin object, and the _____________ operator follows the cout object
>>,<<
The default section is required in a switch statement
FALSE
The following code correctly determines whether x contains a value in the range of 0 through 100. if(x>=0 && <=100)
FALSE
When a program uses the setw manipulator, the iosetwidth header file must be included in a preprocessor directive
FALSE
As a rule of style, when writing an if statement you should indent the conditionally-executed statements
TRUE
When C++ is working with an operator it strives to convert the operands to the same type. T/F
TRUE
Without this statement appearing in a switch construct, the program "falls through" all of the statements below the one with the matching case expression.
break
The _________ causes a program to wait until information is typed at the keyboard and the Enter key is pressed.
cin object
Relational operators allow you to ____________ numbers.
compare
If you intend to place a block of statements within an if statement, you must place these around the block.
curly braces{}
____________ reads a line of input including leading and embedded spaces, and stores it in a string object.
getline
In any program that uses the cin object, you must include the
iostream header file
Which statement is equivalent to the following? number +=1;
number=number+1;
The ____________ of a variable is limited to the block which it is declared
scope
This manipulator is used to establish a field width for the value immediately following it.
setw
What is the value of the following expression? false || true
true
Which statement is equivalent to the following? x=x*2;
x*=2;
Which of the following expressions will determine whether x is less than or equal to y? x>y x<=y x>=y x=<y
x<=y
This operator is known as the logical OR operator
||