TRUE OR FALSE Flashcards
The extraction operator»_space; skips all leading whitespace characters when searching for the next data in the input stream
TRUE
In the statement cin»_space; x;, x must be a variable.
TRUE
The statement cin»_space; x»_space; y; requires the input values for x and y to appear on the same line.
FALSE
The statement cin»_space; num; is equivalent to the statement num»_space; cin;
FALSE
You generate the newline character by pressing the Enter (return) key
on the keyboard.
FALSE
The function ignore is used to skip certain input in a line.
TRUE
The result of a logical expression cannot be assigned to an int variable
FALSE
In a one-way selection, if a semicolon is placed after the expression in
an if statement, the expression in the if statement is always true.
TRUE
Every if statement must have a corresponding else.
FALSE
The expression in the if statement:
if (score = 30)
grade = ‘A’;
always evaluates to true.
TRUE
The expression:
(ch >= ‘A’ && ch <= ‘Z’)
evaluates to false if either ch < ‘A’ or ch >= ‘Z’.
TRUE
Suppose the input is 5. The output of the code:
cin»_space; num;
if (num > 5)
cout «_space;num;
num = 0;
else
cout «_space;“Num is zero” «_space;endl;
is: Num is zero
TRUE
The expression in a switch statement should evaluate to a value of the
simple data type.
TRUE
The expression !(x > 0) is true only if x is a negative number.
TRUE
In C++, both ! and != are logical operators.
FALSE
The order in which statements execute in a program is called the flow of control.
TRUE
In a counter-controlled while loop, it is not necessary to initialize the
loop control variable.
FALSE
It is possible that the body of a while loop may not execute at all
FALSE