COSC 1435 Exam 2
The statements in the body of a while loop may never be executed, whereas the statements in the body of a do- while loop will be executed:
at least once
The ________ causes a program to wait until information is typed at the keyboard and the Enter key is pressed.
cin object
This manipulator causes the field to be left-justified with padding spaces printed to the right.
left
This type of variable is defined inside a function and is not accessible outside the function.
local
A function ________ eliminates the need to place a function definition before all calls to the function.
prototype
When used as parameters, these types of variables allow a function to access the parameter's original argument.
reference
Whereas < is called a relational operator, x < y is called a(n) ________.
relational expression
The ________ of a variable is limited to the block in which it is declared.
scope
True/False: It is possible to define a file stream object and open a file in one statement.
true
True/False: The term "bit" stands for binary digit.
true
True/False: When the fixed manipulator is used, the value specified by the setprecision manipulator will be the number of digits to appear after the decimal point.
true
This operator takes an operand and reverses its truth or falsehood.
!
Which of the following is a preprocessor directive?
#include <iostream>
This is a volatile type of memory, used for temporary storage.
RAM
True/False: Global variables are initialized to zero by default.
True
Which character signifies the beginning of an escape sequence?
\
The programmer usually enters source code into a computer using:
a text editor
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?
decode
A function ________ contains the statements that make up the function.
definiton
Which of the following defines a double-precision floating point variable named payCheck?
double paycheck;
True/False: A function's return data type must be the same as the function's parameter(s).
false
True/False: A local variable and a global variable may not have the same name within the same program.
false
True/False: The fixed manipulator causes a number to be displayed in scientific notation.
false
This stream manipulator forces cout to print the digits in fixed-point notation.
fixed
This is a variable, usually a bool or an int, that signals when a condition exists.
flag
To allow file access in a program, you must #include this header file.
fstream
________ must be included in any program that uses the cout object.
iostream
These operators connect two or more relational expressions into one, or reverse the logic of an expression.
logical operators
This is a control structure that causes a statement or group of statements to repeat.
loop
To write data to a file, you define an object of this data type.
ofstream
This manipulator is used to establish a field width for the value immediately following it.
setw
The statements written by the programmer are called:
source code
In programming terms, a group of characters inside a set of quotation marks is called a(n):
string literal
True/False: A static variable that is defined within a function is initialized only once, the first time the function is called.
true
True/False: A while loop's body can contain multiple statements, as long as they are enclosed in braces.
true
True/False: You should be careful when using the equality operator to compare floating point values because of potential round-off errors.
true
What is the value of the following expression? true || true
true
A for statement contains three expressions: initialization, test, and
update
You may define a ________ in the initialization expression of a for loop.
variable
Programmer-defined names of memory locations that may hold data are:
variables
Which of the following expressions will determine whether x is less than or equal to y?
x <= y
True/False: An initialization expression may be omitted from the for loop if no initialization is required.
true
True/False: If you want to stop a loop before it goes through all its iterations, the break statement may be used.
true
True/False: The cin << statement will stop reading input when it encounters a newline character.
true
True/False: The preprocessor executes after the compiler.
false
If a function does not have a prototype, default arguments may be specified in the function ________.
header
To read data from a file, you define an object of this data type.
ifstream
This means to increase a value by one.
increment
Characters or symbols that perform operations on one or more operands are:
operators
The do- while loop is a(n) ________ loop that is ideal in situations where you always want the loop to iterate at least once.
post-test
True/False: You may nest while and do-while loops, but you may not nest for loops.
false