COP 3330 FINAL EXAM
QUESTIONS AND COMPLETE
SOLUTIONS
QUESTIONS AND ANSWERS
What are the two categories of data types in the Java programming language. ANSWER -
primitive and reference
In the Java programming language, the "char" primitive data type is. ANSWER -16 bits
What is the result of the 3rd statement below?
SomeType a = new SomeType();
SomeType b = new SomeType();
a = b;. ANSWER -Object reference "a" now refers to the same object referenced by "b"
Which of the following is the correct syntax for invoking the "getData" method (assuming
it has no arguments) for the object "myPet"?. ANSWER -myPet.getData( )
An object, once created, is called a(n) ______________ of its class.. ANSWER -instance
, A constructor is a method used to. ANSWER -initialize an object
What results from the following statement?
String f1, f2;. ANSWER -two object references are created
Which of the following operators is used to instantiate an object?. ANSWER -new
String is not a primitive type. ANSWER -true
The import statement causes the Java compiler to concatenate the contents of the imported
file to the file in which the statement is used.. ANSWER -false
The boolean expression in an if statement must be true or false, it cannot be numeric..
ANSWER -true
Assuming Dog is a class, the following Java statement creates a Dog object.
Dog fido;. ANSWER -false
string objjects are immutable. ANSWER -true
Set methods are commonly called mutators because they typically change a value..
ANSWER -true
In the following method, the first command line argument is referred to as args[1].
public static void main(String[] args)
QUESTIONS AND COMPLETE
SOLUTIONS
QUESTIONS AND ANSWERS
What are the two categories of data types in the Java programming language. ANSWER -
primitive and reference
In the Java programming language, the "char" primitive data type is. ANSWER -16 bits
What is the result of the 3rd statement below?
SomeType a = new SomeType();
SomeType b = new SomeType();
a = b;. ANSWER -Object reference "a" now refers to the same object referenced by "b"
Which of the following is the correct syntax for invoking the "getData" method (assuming
it has no arguments) for the object "myPet"?. ANSWER -myPet.getData( )
An object, once created, is called a(n) ______________ of its class.. ANSWER -instance
, A constructor is a method used to. ANSWER -initialize an object
What results from the following statement?
String f1, f2;. ANSWER -two object references are created
Which of the following operators is used to instantiate an object?. ANSWER -new
String is not a primitive type. ANSWER -true
The import statement causes the Java compiler to concatenate the contents of the imported
file to the file in which the statement is used.. ANSWER -false
The boolean expression in an if statement must be true or false, it cannot be numeric..
ANSWER -true
Assuming Dog is a class, the following Java statement creates a Dog object.
Dog fido;. ANSWER -false
string objjects are immutable. ANSWER -true
Set methods are commonly called mutators because they typically change a value..
ANSWER -true
In the following method, the first command line argument is referred to as args[1].
public static void main(String[] args)