CS 150
Main memory is an ordered sequence of cells called_______________.
Memory cell
Which of the following is a legal identifier?
program_1
If a C++ arithmetic expression has no parentheses, operators are evaluated from left to right.
true
Main memory is directly connected to the CPU
true
A control structure alters the normal sequential flow of execution in a program
true
In C++, both ! and != are relational operators.
true
In a counter-controlled while loop, the loop control variable must be initialized before the loop
true
In the case of the sentinel-controlled while loop, the first item is read before the while loop is entered.
true
Main memory is directly connected to the CPU.
true
Suppose we declare a variable sum as an int. The statement " sum += 7; " is equivalent to the statement " sum = sum + 7; "
true
Suppose we declare a variable sum as an int. The statement "sum += 7;" is equivalent to the statement " sum = sum + 7; ".
true
Suppose x is 5 and y is 7. Choose the value of the following expression(x != 7) && (x <= y)
true
The manipulator setprecision formats the output of floating-point numbers to a specified number of decimal places.
true
The number of input data extracted by cin and >> depends on the number of variables appearing in the cin statement.
true
The output of the following C++ code is 2 3 4 5. n = 1; while (n < 5) { n==; cout << n << " ";
true
To input data from a file, the program must include the header file fstream.
true
When computer power is turned off, everything in main memory is lost.
true
Which of the following is the "not equal to" relational operator?
!=
___ is a valid char value.
'A'
Which of the following expressions correctly determines that x is greater than 10 and less than 20?
(x>10)&&(x<20)
Main memory is called ____.
. random access memory
The following while loop terminates when j >= 20.j = 0; while (j < 20) J++;
10
What is the output of the following C++ code? num = 10; while (num > 10) { num = num - 2; } cout << num << endl;
10
Suppose j, sum, and num are int variables, and the input is 6 4 1 4 -1. What is the output of the code? sum = 0; cin >> num; for (int j = 1; j <= 3; j++) { sum = sum + num; cin >> num; } cout << sum << endl;
15
Suppose sum and num are int variables, and the input is 1 5 6 3 -1. What is the output of the following code? sum = 0; cin >> num; while (num != -1) { sum = sum + num; cin >> num; } cout << sum << endl;
15
___ is a valid int value.
46259
Suppose that x = 55.68, y = 476.859, and z = 23.8216. What is the output of the following statements?cout << fixed << showpoint;cout << setprecision(3);cout << x << ' ' << y << ' ' << setprecision(2) << z << endl;
55.680 476.859 23.82
Which of the following expressions correctly determines that x is greater than 10 and less than 20?
: 10 < x && x < 20
Which of the following is a relational operator?
==
__ represent information with a sequence of 0s and 1s.
digital signals
Which of the following loops is guaranteed to execute at least once?
do ....while loop
What is the output of the following C++ code? num = 10; while (num > 10) num = num - 2; cout << num << endl;: 10 ____ loops are called posttest loops
do...while
____ loops are called posttest loops
do...while
An example of a floating point data type is ___
double
In an output statement, each occurrence of endl advances the cursor to the end of the current line on an output device.
false
The following for loop executes 5 times. for (i = 0; i <= 5; i++) cout << i;:
false
The result of a logical expression cannot be assigned to an int variable, but it can be assigned to a bool variable.
false
Which of the following will cause a logical error if you are attempting to compare x to 5?
if (x = 5)
When you want to process only partial data, you can use the stream function ____ to discard a portion of the input.
ignore
. A loop that continues to execute endlessly is called a(n) ____ loop.
infinite
You can use either a(n) ____ or a ____ to store the value of a logical expression
int,bool
A program called a(n) ____ combines the object program with the programs from libraries.
linker
A program that loads an executable program into main memory is called a(n) ____.
loader
In ____ structures, the computer repeats particular statements a certain number of times depending on some condition(s).
looping
In C++, the dot is an operator called the ____ operator.
member access
main memory is an ordered sequence of items, called ____.
memory cells
When one control statement is located within another, it is said to be __
nested
When one control statement is located within another, it is said to be ____.
nested
A(n) ____ consists of data and the operations on those data.
object
n a C++ program, one and two are double variables and input values are 10.5 and 30.6. After the statement cin >> one >> two; executes, ____.
one = 10.5, two = 30.6
The devices that the computer uses to display results are called ____ devices
output
When computer power is turned off, everything in main memory is lost.
output devices
A(n) ____ is an arbitrary value that, when read, stops the execution of a loop
sentinel
Dividing a problem into smaller subproblems is called ____ design.
structured
Suppose that sum and num are int variables and sum = 5 and num = 10. After the statement sum += num executes, ____.
sum = 15
The ____ rules of a programming language tell you which statements are legal, or accepted, by the programming language.
syntax
C++ tokens include special symbols, word symbols, and identifiers.
true
Entering a char value into an int variable causes serious errors, called input failure
true
In C++, && has a higher precedence than ||.
true
The control statements in the for loop include the initial statement, loop condition, and update statement
true
The following loop is an infinite loop count = 5; cout << 'St'; do { cout << 'o'; count--; } while (count <= 5):
true
The following while loop terminates when j >= 20. j = 0; while (j < 20) J++;
true
You can use the function getline to read a string containing blanks.
true
for loop is a repetition structure in C++?
true
in C++, both == and != are relational operators
true
suppose P and Q are logical expressions. The logical expression P && Q is true if both P and Q are true.
true
to develop a program to solve a problem, you start by analyzing the problem.
true
you can use the function getline to read a string containing blanks.
true
nformation stored in main memory must be transferred to some other device for permanent storage
TRUE
What is the initial statement in the following for loop? int i; for (i = 1; i < 20; i++) cout << "Hello World"; cout << "!" << endl; : cout << "Hello World" : i= 1 Which executes first in a do...while loop?:
The Statement
Suppose that alpha and beta are int variables and alpha = 5 and beta = 10. After the statement alpha *= beta; executes, ____.
alpha = 50
Suppose that alpha and beta are int variables. The statement alpha = beta--; is equivalent to the statement(s) ____.
alpha = beta;
Suppose that alpha and beta are int variables and alpha = 5 and beta = 10. After the statement alpha *= beta; executes, ____.
alpha=50
The digit 0 or 1 is called a binary digit, or ____
bit
A sequence of eight bits is called a ____.
byte
The get function presented in this chapter only reads values of type _____________
char
Which header file contains the sqrt function?
cmath
Assume you have three int variables: x = 2, y = 6, and z. Choose the value of z in the following expression: z = (y / x > 0) ? x ; y;.
2
The value of the expression 17 % 7 is ____
3
he value of the expression 33/10, assuming both values are integral data types, is _
3
The expression static_cast<int>(9.9) evaluates to ____
9
When reading data into a char variable, after skipping any leading whitespace characters, the extraction operator >> finds and stores only the next character; reading stops after a single character.
true
Suppose that x is an int variable and y is a double variable. The input is: 10 20.7 Choose the values after the following statement executes: cin >> x >> y;.
x=10. y=20.7
The programming language C++ evolved from ___
C
Suppose that x and y are int variables, ch is a char variable, and the input is: 4 2 A 12Choose the values of x, y, and ch after the following statement executes:cin >> x >> ch >> y;a. x=4,ch=2,y=12c. x=4,ch='',y=2b. x = 4, ch = A, y = 12d. This statement results in input failure
D
Which of the following is the newline character?
\n
Which of the following is a reserved word in C++?
char
Choose the values after the following statement executes
cin >> x >> y;. : C. x = 10, y = 0.5
A program called a(n) ____ translates instructions written in high-level languages into machine code.
compiler
A comma is also called a statement terminatior
false
A mixed arithmetic expression contains all operands of the same type
false
An operator that has only one operand is called a unique operator.
false
Comments are for the compiler, not the reader
false
In C++, both ! and != are relational operators
false
Programs do not have to be loaded into main memory before they are executed.
false
Suppose found = true and num = 6. The value of the expression (!found) || (num > 6) is
false
The device that stores information permanently (unless the device becomes unusable or you change the information by rewriting it) is called primary storage.
false
The devices that feed data and programs into computers are called output devices
false
The expression (x >= 0 && x <= 100) evaluates to false if either x < 0 or x >= 100
false
The operators !, &&, and || are called relational operators
false
The statement in the body of a while loop acts as a decision maker.
false
When the computer is turned off, everything in secondary memory is lost
false
When you compile your program, the compiler identifies the logic errors and suggests how to correct them
false
peek returns next character from input stream and removes it.
false
The term GB refers to ____
gigabyte