C++ Programming - Exam 1
single quotation marks (' ')
Character constants in C++ are always enclosed in ______________________.
software
Computer programs are also known as __________.
closing brace
For every opening brace ({) in a C++ program, there must be a ____________.
the beginning of a comment
In a C++ program, two slash marks (//) indicate ____________.
endl or \n
In a cout statement, which of the following will advance the output position to the beginning of the next line?
string literal
In the following statement, the characters Hello! are a(n) ________________. cout << "Hello!";
3 * 2
In the following statement, what will be executed first according to the order of precedence? result = 6 - 3 * 2 + 7 - 10 / 2;
secondary storage
Programs are normally stored in ________________ and loaded into main memory as needed.
fetch
The CPU's control unit retrieves the next instruction in a sequence of program instructions from main memory in the __________ stage.
>>, <<
The ______ operator always follows the cin object, and the _____ operator follows the cout object.
cin object
The ______________ causes a program to wait until information is typed at the keyboard and the [Enter] key is pressed.
Control Unit
The _______________ decodes an instruction and generates an electronic signal.
#include directive
The ________________- causes the content of another file to be inserted into a program.
cout object
The __________________ is(are) used to display information on the computer's screen.
to identify the location of a byte in memory
The purpose of a memory address is _______________.
the Control Unit and the Arithmetic and Logic Unit
The two parts of the CPU are ________________.
the physical components that make up a computer
What does the term hardware refer to?
4.0
What is the value of average after the following code executes? double average; average = 1.0 + 2.0 + 3.0 / 3.0;
125.0
What is the value of cube after the following code executes? double cube, side; side = 5.0; cube = pow(side, 3.0);
5
What is the value of result after the following statement executes? result = (3 * 5) % 4 + 24 / (15 - (7 - 4));
13
What is the value of x after the following code executes? int x = 0; int y = 5; int z = 4; x = x + y + z * 2;
0
What is the value of x after the following code executes? int x; x = 3 / static_cast<int>(4.5 + 6.4);
The result is 25
What will be displayed after the following statements execute? int num1 = 5; int num2 = 3; cout << "The result is " << (num1 * num2 + 10) << endl;
Four score and seven years ago
What will the following code display? cout << "Four\n" << "score\n"; cout << "and" << "\nseven"; cout << "\nyears" << " ago" << endl;
MondayTuesdayWednesday
What will the following code display? cout << "Monday"; cout << "Tuesday"; cout << "Wednesday";
Roses are redand violets/nare blue
What will the following code display? cout << "Roses" << "are red"; cout "and" << "violets/n" cout << "are" << "blue" << endl;
The number is number
What will the following code display? int number = 23; cout << "The number is " << "number" << endl;
none of these
When C++ is working with an operator, it strives to convert operands to the same type. This is known as ____________.
source code
When a programmer saves to a file the statements he or she writes to create a program, these statements are ____________.
in the keyboard buffer
When a user types values at the keyboard, those values are first stored ____________________.
overflows
When a variable is assigned a number that is too large for its data type, it ___________.
the data type of the variable
When the final value of an expression is assigned to a variable, it will be converted to _________________.
\t
Which control sequence is used to skip over to the next horizontal tab stop?
printer
Which of the following is NOT a common input device? keyboard, mouse, digital camera, all are common input devices, printer
the preprocessor
Which of the following is NOT one of the major components of a computer system? main memory, input/output devices, secondary storage, the CPU, the preprocessor
the header file iostream
Which of the following must be included in any program that uses the cin object?
the header file iostream
Which of the following must be included in any program that uses the cout object?
cin >> base >> height;
Which of the following will allow the user to input the valuse 15 and 20 and have them stored in variables named base and height respectively?
computer; in main memory
A ______________ stores a program while it is running ______________.
output device
A computer monitor is a type of _____________.
algorithm
A set of well-defined steps for performing a task of solving a problem is known as a(n) ___________.
preprocessor directive
A statement that starts with a hashtag (or pound) symbol (#) is called a _______________.
RAM
A volatile type of memory tha tis used for temporary storage is _______.
variable
A(n) _____________ represents a storage location in the computer's memory.
program
A(n) ___________________ is a set of instructions that the computer follows to solve a problem.
left to right
Associativity is either right to left or ____________.
to fetch instructions, to carry out the operations commanded by the instructions, to produce some outcome or resultant information
At the heart of a computer is its central processing unit. The CPU's job is __________________.
literals
Data items whose values do NOT change while the program is running are ____________.
decode
During which stage does the central processing unit analyze the instruction and encode it in the form of a number, and then generate an electronic signal?
function named main
Every complete C++ program must have a _______________________.