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
In an infinite while loop, the while expression (the decision maker) is
initially false, but after the first iteration it is always true
FALSE
The while loop:
j = 0;
while (j <= 10)
j++;
terminates if j > 10
TRUE
A sentinel-controlled while loop is an event-controlled while loop
whose termination depends on a special value.
TRUE
A loop is a control structure that causes certain statements to execute
over and over.
TRUE
To read data from a file of an unspecified length, an EOF-controlled
loop is a good choice.
TRUE
When a while loop terminates, the control first goes back to the
statement just before the while statement, and then the control goes
to the statement immediately following the while loop.
FALSE
An identifier can be any sequence of digits and letters.
FALSE
In C++, there is no difference between a reserved word and a predefined identifier
FALSE
A C++ identifier can start with a digit.
FALSE
The operands of the modulus operator must be integers.
TRUE
If a = 4; and b = 3;, then after the statement a = b; the value of b is still 3.
TRUE
In the statement cin»_space; y;, y can only be an int or a double variable.
FALSE
In an output statement, the newline character may be a part of the string.
TRUE
The following is a legal C++ program:
int main()
{
return 0;
}
TRUE
In a mixed expression, all the operands are converted to floating-point numbers.
FALSE
Suppose x = 5. After the statement y = x++; executes, y is 5 and x is 6.
TRUE
Suppose a = 5. After the statement ++a; executes, the value of a is still
5 because the value of the expression is not saved in another variable.
FALSE
The first device known to carry out calculations was the Pascaline
FALSE - answer: abacus
Modern-day computers can accept spoken-word instructions but cannot
imitate human reasoning.
FALSE - answer: and can imitate human reasoning through artificial intelligence.
In ASCII coding, every character is coded as a sequence of 8 bits.
TRUE
A compiler translates a high-level program into assembly language.
FALSE - answer: translates high-level program (source code) into machine code
The arithmetic operations are performed inside CPU, and if an error is found, it outputs the logical errors
FALSE - answer: compiler (not sure of this answer)
A sequence of 0s and 1s is called a decimal code.
FALSE - answer: binary code or binary number
A linker links and loads the object code from main memory into the CPU
for execution.
FALSE - answer: A linker is a program that combines the object program with other programs in the library and is used in the program to create the executable code.
Development of a C++ program includes six steps.
True
A program written in a high-level programming language is called a source program.
True
ZB stands for zero byte
False. Zettabyte (sextillion)
The first step in the problem-solving process is to analyze the problem
True