Midterm 1010
What does the term hardware refer to?
the physical components that a computer is made of
In a C++ program, two slash marks ( // ) indicate:
the beginning of a comment
Internally, the CPU consists of two parts
the control unit and the arithmetic and logic unit
The ________ causes the contents of another file to be inserted into a program.
#include directive
What is the modulus operator?
%
What will the following code display?int x = 0, y = 1, z = 2;cout << x << y << z << endl;
012
What will be the value of x after the following statements execute?int x;x = 6/4;
1
What will be the value of x after the following statements execute?int x;x = 6%4;
2
What will the value of x be after the following statements execute?double x;x = 18.0 / 4;
4.5
A byte consists of
8 bits.
For every opening brace in a C++ program, there must be a:
Closing brace
________ are used to translate each source code instruction into the appropriate machine language instruction.
Compilers
This step will uncover any syntax errors in your program.
Compiling
What will the following code display?cout << "Midterms" << "are" << endl;cout << "fun";
Midtermsare Fun
What will the following code display?cout << "Monday";cout << "Tuesday";cout << "Wednesday";
MondayTuesdayWednesday
The following is a definition of a named constant tax_rate for a value of 0.095
None of the above const double tax_rate = 0.095;
Which of the following is not one of the five major components of a computer system?
Preprocessor
This is used to mark the end of a complete C++ programming statement.
Semicolon
Computer programs are also known as:
Software
In programming terms, a group of characters inside a set of quotation marks is called a:
String literal
This is a set of rules that must be followed when constructing a program.
Syntax
________ must be included in any program that uses the cout object.
The header file iostream
What will the following code display?int number = 7;cout << "The number is " << "number" << endl;
The number is number
The preprocessor executes after the compiler
The preprocessor executes first.
A CPU really only understands instructions that are written in machine language.
True
Escape sequences are always stored internally as a single character.
True
In C++, key words are written in all lowercase letters.
True
The name for a memory location that may hold data is:
Variable
________ represent storage locations in the computer's memory.
Variables
Which character signifies the beginning of an escape sequence?
\
This control sequence is used to cause the cursor to go to the next line for subsequent printing.
\n
An assignment statement that multiplies b by 4 and stores the result in a is ________________________.
a = b * 4;
Of the following which is an invalid C++ identifier?
account code
A variable whose value can be either true or false is of this data type.
bool
Which of the following defines a double-precision floating point variable named pay?
double pay;
Every complete C++ program must have a __________.
function named main
An example of a secondary storage device is:
hard disk
Three primary activities of a program are:
input, processing, and output
The following creates a variable to hold the number of students in any programming class.
int numberStudents;
How would you consolidate the following declaration statements into one statement?int x = 7;int y = 16;int z = 28;
int x = 7, y = 16, z = 28;
Assume that a program has the following string object definition:string name;Which of the following statements correctly assigns a string literal to the string object?
name = "Jane";
If you use a C++ keyword(reserved word) as an identifier, your program will:
not compile
A statement that starts with a # is called a:
preprocessor directive
The computer's main memory is commonly known as:
ram
A character literal is enclosed in ________ quotation marks, whereas a string literal is enclosed in ________ quotation marks.
single, double
The float data type is considered ________ precision, and the double data type is considered ________ precision.
single, double
This function in C++ allows you to identify how many bytes of storage on your computer system an integer data value requires.
sizeof
In the process of translating a source file into an executable file, which of the following is the correct sequence?
source code, preprocessor, modified source code, compiler, object code, linker, executable code
The first step in using the string class is to #include the ________ header file.
string
The purpose of a memory address is:
to identify the location of a byte in memory
A comment that extends over multiple lines must begin with a /* and end with a /*
A comment that extends over multiple lines must begin with a /* and end with a */
An Integrated Development Environment typically consists of:
A text editor, a a debugger, a compiler
A set of well-defined steps for performing a task or solving a problem is known as a(n):
Algorithm
A variable called "average" should be declared as an integer data type because it will probably hold data that contains decimal places.
An floating point data type (float or double) would be needed to data containing decimal places.
You must have a ____________ for every variable you intend to use in a program.
Definition
Machine language is an example of a high-level language.
False
These are used to declare variables that can hold real numbers.
Floating point data types
Assume that a program has the following variable definition:char letter;Which of the following statements correctly assigns the character Z to the variable?
Letter 'Z';
Which data type typically requires only one byte of storage?
char
The ________ is/are used to display information on the computer's screen.
cout object