Programming 1 Final Exam: MC questions
Java automatically stores a ________ value in all uninitialized static member variables.
0
Variables are classified according to their ________.
data types
An item that separates other items is known as a ________.
delimiter
The ________ loop is ideal in situations where you always want the loop to iterate at least once.
do-while
Another term for an object of a class is a(n) ________.
instance
A reference variable stores a(n) ________.
memory address
________ operators are used to determine whether a specific relationship exists between two values.
Relational
In Java, when a character is stored in memory, it is actually the ________ that is stored.
Unicode number
The ________ method removes an item from an ArrayList at a specific index.
remove
A(n) ________ is a special value that cannot be mistaken as a member of a list of data items and signals that there are no more data items to be processed.
sentinel
You can use the ________ method to replace an item at a specific location in an ArrayList.
set
An object's ________ is simply the data that is stored in the object's fields at any given moment.
state
Static methods can only operate on ________ fields.
static
When the + operator is used with strings, it is known as the ________.
string concatenation operator
Which of the following is the method you can use to determine whether a file exists?
the File class's exists method
A program is a sequence of instructions stored in ________.
the computer's memory
The ________ loop allows the user to decide on the number of iterations.
user controlled loop
Which of the following are pre-test loops?
while, for
The "has a" relationship is sometimes called a(n) ________ because one object is part of a greater whole.
whole-part relationship
The binary search algorithm ________.
will cut the portion of the array being searched in half each time it fails to locate the search value
If the this variable is used to call a constructor, ________.
a compiler error will result if it is not the first statement of the constructor
Which of the following is a value that is written into the code of a program?
a literal
RAM is usually ________.
a volatile type of memory, used for temporary storage
In all but very rare cases, loops must contain, within themselves ________.
a way to terminate
Which of the following is a software entity that contains data and procedures?
an object
When working with the PrintWriter class, which of the following import statements should you have near the top of your program?
import java.io.*;
When an argument is passed to a method ________.
its value is copied into the method's parameter variable
The ArrayList class is in the ________ package.
java.util
________ is the term for the relationship created by object aggregation.
"Has a"
The original name for Java was ________.
Oak
If you prematurely terminate an if statement with a semicolon, the compiler will ________.
not display an error message and assume you are placing a null statement there
A constructor is a method that ________.
performs initialization or setup operations