A file must be ________ before data can be written to or read from it.
A) closed
B) opened
C) buffered
D) initialized
Front
B) opened
Back
A file ________ is a small holding section of memory that file-bound information is first written to.
A) name
B) number
C) buffer
D) segment
Front
C) buffer
Back
The statements written by the programmer are called:
A) Syntax
B) Object code
C) Source code
D) Runtime libraries
Front
C) Source code
Back
Which is true about the following statement?
cout << setw(4)<< num4 << " ";
A) It allows four spaces for the value in the variable num4.
B) It outputs "setw(4)" before the value in the variable num4.
C) It should use setw(4) to output the value in the variable num10.
D) It inputs up to four characters stored in the variable num4.
Front
A) It allows four spaces for the value in the variable num4.
Back
How many times will the following loop display "Hello"?
for (int i = 1; i < 20; i++)
cout << "Hello!" << endl;
A) 20
B) 19
C) 21
D) An infinite number of times
Front
B) 19
Back
When the increment operator precedes its operand, as in ++num1, the expression is in this mode.
A) postfix
B) prefix
C) preliminary
D) binary
Front
B) prefix
Back
What is the value of average after the following code executes?
double average = 1.0 + 2.0 + 3.0 / 3.0;
A) 2.0
B) 4.0
C) 1.5
D) 6.0
Front
B) 4.0
Back
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?
A) name = Jane;
B) name = "Jane";
C) name = 'Jane';
D) name = (Jane);
Front
B) name = "Jane";
Back
What statement best describes a variable and its primary purpose?
A) A variable is a structured, general-purpose language designed primarily for teaching programming.
B) A variable is a collection of eight bits.
C) A variable is a word that has a special meaning to the compiler.
D) A variable is a named storage location in the computer's memory used for holding a piece of information.
E) A variable is a "line" of code in the body of a program, which may change.
Front
D) A variable is a named storage location in the computer's memory used for holding a piece of information.
Back
You can use these to override the rules of operator precedence in a mathematical expression.
A) [Brackets]
B) (Parentheses)
C) {Braces}
D) The escape character \
Front
B) (Parentheses)
Back
The programming process consists of several steps, which include:
A) Input, Processing, and Output
B) Key Words, Operators, and Punctuation
C) Design, Creation, Testing, and Debugging
D) Syntax, Logic, and Error Handling
Front
C) Design, Creation, Testing, and Debugging
Back
In a C++ program, two slash marks ( // ) indicate:
A) The end of statement
B) The beginning of a comment
C) The end of the program
D) The beginning of a block of code
Front
B) The beginning of a comment
Back
Which of the following is not one of the five major components of a computer system?
A) Preprocessor
B) The CPU (central processing unit)
C) Main memory
D) Input/Output device
E) Secondary storage device
Front
A) Preprocessor
Back
________ represent storage locations in the computer's memory.
A) Literals
B) Variables
C) Comments
D) Integers
Front
B) Variables
Back
What is the value of the following expression? true || true
A) true
B) false
C) -1
D -2
Front
A) true
Back
The first step in using the string class is to #include the ________ header file.
A) iostream
B) cctype
C) cmath
D) string
Front
D) string
Back
This is a control structure that causes a statement or group of statements to repeat.
A) decision statement
B) constant
C) loop
D) cout object
Front
C) loop
Back
This operator represents the logical AND.
A) ++
B) | |
C) &&
D) @
E) None of these
Front
C) &&
Back
Computer programs are also known as:
A) hardware
B) firmware
C) Correct answer
D) software
E) silverware
Front
C) Software
Back
________ reads a line of input, including leading and embedded spaces, and stores it in a string object.
A) cin.get
B) getline
C) cin.getline
D) get
Front
getline
Back
When this operator is used with string operands it concatenates them, or joins them together.
A) &
B) *
C) %
D) +
Front
D) +
Back
Whereas < is called a relational operator, x < y is called a(n) ________.
A) Arithmetic operator
B) Relative operator
C) Relational expression
D) Largeness test
E) None of these
Front
C) Relational expression
Back
When the final value of an expression is assigned to a variable, it will be converted to:
A) The smallest C++ data type
B) The largest C++ data type
C) The data type of the variable
D) The data type of the expression
Front
C) The data type of the variable
Back
An Integrated Development Environment typically consists of:
A) A text editor
B) A compiler
C) A debugger
D) All of the above
E) None of the above
Front
D) All of the above
Back
The function, pow(x, 5.0), may require this header file.
A) cstdlib
B) cmath
C) cstring
D) iostream
E) iomanip
Front
B) cmath
Back
In C++ the = operator indicates:
A) equality
B) assignment
C) subtraction
D) negation
E) None of these
Front
B) assignment
Back
When a relational expression is false, it has the value ________.
A) one
B) zero
C) zero, one, or minus one
D) less than zero
E) None of these
Front
B) zero
Back
Which statement is equivalent to the following?
x = x * 2
A) x * 2;
B) x *= 2;
C) x = x * x;
D) None of these
Front
B) x *= 2;
Back
This operator takes an operand and reverses its truth or falsehood.
A) ||
B) relational
C) arithmetic
D) !
E) None of these
Front
D) !
Back
Character constants in C++ are always enclosed in ________.
A) [brackets]
B) "double quotations marks"
C) 'single quotation marks'
D) {braces}
E) (parentheses)
Front
'single quotation marks'
Back
This is a set of rules that must be followed when constructing a program.
A) Syntax
B) Punctuation
C) Portability
D) Operators
E) Key Words
Front
A) Syntax
Back
The ________ causes a program to wait until information is typed at the keyboard and the Enter key is pressed.
A) Output stream
B) cin object
C) cout object
D) Preprocessor
Front
B) cin object
Back
Which data type typically requires only one byte of storage?
A) short
B) int
C) float
D) char
E) double
Front
D) char
Back
At the heart of a computer is its central processing unit. The CPU's job is:
A) To fetch instruction
B) To carry out the operations commanded by the instructions
C) To produce some outcome or resultant information
D) All of the above
E) None of the above
Front
D) All of the above
Back
This statement may be used to stop a loop's current iteration and begin the next one.
A) break
B) terminate
C) re-iterate
D) continue
Front
D) continue
Back
What is the value of number after the following statements execute?
int number = 10;
number += 5;
number -= 2;
number *= 3;
A) 3
B) 30
C) 39
D) 2
Front
C) 39
Back
What will the value of x be after the following statements execute?
int x;
x = 18.0 /4;
A) 4.5
B) 4
C) 0
D) unknown
Front
B) 4
Back
This is a variable that is regularly incremented or decremented each time a loop iterates.
A) constant
B) counter
C) control statement
D) null terminator
Front
B) counter
Back
Internally, the CPU consists of two parts:
A) The Output Device and the Input Device
B) The Software and the Hardware
C) The Control Unit and the Arithmetic and Logic Unit
D) The Single-task Device and the Multi-task
Device
Front
C) The Control Unit and the Arithmetic and Logic Unit
Back
This loop is a good choice when you know how many times you want the loop to iterate in advance of entering the loop.
A) do-while
B) while
C) for
D) infinite
Front
C) for
Back
This is used to mark the end of a complete C++ programming statement.
A) Pound Sign
B) Semicolon
C) Data type
D) Void
Front
B) Semicolon
Back
These are operators that add and subtract one from their operands.
A) plus and minus
B) ++ and --
C) binary and unary
D) condional and relational
Front
B) ++ and --
Back
The ________ is/are used to display information on the computer's screen.
A) Opening and closing braces
B) Opening and closing quotation marks
C) cout object
D) Backslash
Front
C) cout object
Back
In memory, C++ automatically places a ________ at the end of string literals.
A) Semicolon
B) Quotation marks
C) Null terminator
D) Newline escape sequence
E) None of the above
Front
C) Null terminator
Back
A for statement contains three expressions: initialization, test, and
A) update
B) reversal
C) null
D) validation
Front
A) update
Back
This is used in a program to mark the beginning or ending of a statement, or separate items in a list.
A) Separators
B) Punctuation
C) Operators
D) Key Words
Front
B) Punctuation
Back
A(n) ________ is a set of instructions that the computer follows to solve a problem.
A) Compiler
B) Linker
C) Program
D) Operator
E) None of the above
Front
C) Program
Back
If you want a user to enter exactly 20 values, which loop would be the best to use?
A) do-while
B) for
C) while
D) infinite
Front
B) for
Back
This step will uncover any syntax errors in your program.
A) Editing
B) Compiling
C) Linking
D) Executing
Front
B) Compiling
Back
To use the rand() function, you must #include this header file in your program.
A) iostream
B) iomanip
C) iorand
D) cstdlib