Computer Science class Quiz multiplechoice c++
1. A logical OR false if:
|
|
Only one input is true |
|
|
There is no such thing as an AND gate |
|
|
Neither input is true |
|
|
Both inputs are true |
2. A bitwise XOR is true if
|
|
Only one input is true |
|
|
There is no such thing as an OR gate |
|
|
Both inputs are true |
|
|
Either input is true |
3. The ! operator is true
|
|
If the input is true |
|
|
A NOT gate does not exist |
|
|
If there is no input |
|
|
If the input is false |
4. Which of the following is not a C++ looping structure
|
|
DO-UNTIL |
|
|
DO-WHILE |
|
|
While |
|
|
For |
5. In a for statement, there are two semi-colons. In which area of a for loop does the initialization of the control variable occur?
|
|
Between the first semicolon and the second semicolon |
|
|
The for loop does not do any tests |
|
|
After the second semicolon |
|
|
Before the first semicolon |
6. if(x == 2 |- y == 3)
{
//Do Something
}
The |- stands for
|
|
AND |
|
|
XOR |
|
|
OR |
|
|
No valid answer for this question! |
7. Which of the following statements will cause a switch statement or a loop to terminate immediately?
|
|
break |
|
|
halt |
|
|
stop |
|
|
continue |
8. In order to stop one case in a switch to fall through to the next case, you would use the ________________ statement
|
|
default |
|
|
break |
|
|
continue |
|
|
next case |
9. The default statement is used in a switch in order to provide
|
|
a case for anything that does not match any other case |
|
|
a case that might be executed if the single case above it is not executed. |
|
|
There is no such statement in C++! |
|
|
a case that is always executed |
10. Given that a bit pattern stored in the variable x is 00000101, what will x <<= 1 do to this bit pattern?
|
|
It would make it 00001010 |
|
|
Nothing. This does not exist in C++!! |
|
|
It would make it 00000010 |
|
|
It would make it 00000001 |
11. The continue statement causes a loop to
|
|
This is not a C++ statement! |
|
|
immediately go to the next iteration after completing the remaining steps in the loop |
|
|
immediately go to the next iteration without completing the remaining steps in the loop |
|
|
immediately terminate |
12. Which of the following escape characters will cause the a backspace character to be printed to the screen?
|
|
\n |
|
|
\b |
|
|
\r |
|
|
\t |
13. Which of the following is not a C++ data type?
|
|
All are |
|
|
float |
|
|
double |
|
|
char |
|
|
bool |
|
|
integer |
14. Which of the follow will always execute the body of the loop at least once, regardless of the condition.
|
|
a while loop |
|
|
a do-while loop |
|
|
a switch statement |
|
|
a for loop |
15. In a for statement, there are two semi-colons. In which area of a for loop does the testing occur?
|
|
The for loop does not do any tests |
|
|
Between the first semicolon and the second semicolon |
|
|
Before the first semicolon |
|
|
After the second semicolon |
16. Boolean expressions are evaluated similarily to the way arithmetic expressions are evaluated
|
|
True |
|
|
False |
17. A switch statement is not a good way to implement a menu for the user of your program
|
|
True |
|
|
False |
18. Indentation of code is required by the compiler in C++, and servers no useful purpose for the programmer.
|
|
True |
|
|
False |
19.
Which of the following is not a C++ data type?
|
|
int |
|
|
double |
|
|
bool |
|
|
whole |