Assignment
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 
char 
float
20.Variables contained within a block, ie, starting with a { and ending with a } are global variables. 
True 
False
21.If an identifier is declared as a variable in each of two blocks, one within the other, then these are two different variables with the same name. One variable exists only within the inner block and cannot be accessed outside of the inner block. The other variable exists only in the outer block and cannot be accessed in the inner block. The two variables are distinct, so changes made to one of these variables will have no effect on the other of these two variables. 
True 
False
22.A block is some C++ code enclosed in braces. The variables declared in a block are local to the block and so the variable names can be used outside of the block for something else. 
True 
False
23.Which of the following has the highest precedence? 
* (Multiply) 
&&
== 
Unary minus
24.The // is used for _______________ 
marking the start of a multi-line comment 
dividing doubles 
making a single line comment, or commenting at the end of a line 
This is not part of C++!!!
25.Which of the follow will always execute the body of the loop at least once, regardless of the condition.
a for loop 
a switch statement 
a do-while loop 
a while loop
26.By default, cin uses whitespace as the data separator. 
True 
False
27.The iomanipsetfill() needs to be "turned off." Meaning, it is set only for the output statement you are currently within. 
True 
False
28.In order to use setfill(), or any of the other items, you must include  and be using cout only. 
True 
False
29.A byte is 16 bits.
True 
False
30.In order to shift the value in an integer variaible x one bit to the left, you would use x <<= 1; 
True 
False
31.C++ automatically initialized variables to ______________ 
1 
-1 
Junk values 
0
32.Which of the following iomanip functions does not need to be "turned off" if you use it? 
setfill
oct
setprecision
setw
33.A short int has 32 bits on a 32 bit machine. 
True 
False
34.The data range of a int and an unsigned int are the same.
True 
False
35.Masking operations work only on integer and integer-like variables 
True 
False
36.while( i = 0)
cout<<"Hello"<Will iterate indefinitely.
True 
False
37.Assignments can be done within a while, if, or do-while condition. 
True 
False
38.Assuming that x and y are ints,
x ^= y;
y ^= x;
x ^= y;
will __________________
cause a random value to appear in x and y 
do nothing. Will not compile! 
Swap the values of the variables x and y 
will make x and y the same value
39.A for statement requires all three parts, separated by semi-colons, to have a statement within them. 
True 
False
40.The comma operator allows you to put multiple statement on one line ending with a semi-colon. 
True 
False
41.in order to use cin, you must include fstream
True 
False
42.The number of digits in an integer is one less than the log base 10 of the number. 
True 
False
43.In standard C++, you can use either && or and for a logical AND in an if statement
True 
False
44.In standard C++, you can use an || or an or in an if statement condition. 
True 
False
45.The sign bit of an integer is bit number 0 in C++. 
True 
False
46.When converting from double to integer, it is not possible to lose information. 
True 
False
47.The log10 function works only on doubles or floats. 
True 
False
48.A while statement cannot be nested within an if statement 
True 
False
49.The else statement is required on all if statements; 
True 
False
50.for(int i = 0; i < 100000; i++);
is a valid C++ statement
True 
False.