Java Chapter 6 UPDATED ACTUAL Exam Questions and
CORRECT Answers
1) One or more objects may be created from a(n):
A) field
B) class
C) method
D) instance - Answer: B
2) Class objects normally have ________ that perform useful operations on their data, but
primitive
variables do not.
A) fields
B) instances
C) methods
D) relationships - Answer: C
3) In the cookie cutter metaphor, think of the ________ as a cookie cutter and ________ as the
cookies.
A) object; classes
B) class; objects
C) class; fields
D) attribute; methods - Answer: B
4) Which of the following are classes from the Java API?
A) Scanner
,B) Random
C) PrintWriter
D) All of the above - Answer: D
5) When you are working with a ________, you are using a storage location that holds a piece of
data.
A) primitive variable
B) reference variable
C) numeric literal
D) binary number - Answer: A
6) What is stored by a reference variable?
A) A binary encoded decimal
B) A memory address
C) An object
D) A string - Answer: B
7) Most programming languages that are in use today are:
A) procedural
B) logic
C) object-oriented
D) functional - Answer: C
8) Java allows you to create objects of this class in the same way you would create primitive
variables.
A) Random
B) String
C) PrintWriter
, D) Scanner - Answer: B
9) A UML diagram does not contain:
A) the class name
B) the method names
C) the field names
D) object names - Answer: D
10) Data hiding, which means that critical data stored inside the object is protected from code
outside the
object, is accomplished in Java by:
A) using the public access specifier on the class methods
B) using the private access specifier on the class methods
C) using the private access specifier on the class definition
D) using the private access specifier on the class fields - Answer: D
11) For the following code, which statement is NOT true?
public class Sphere
{
private double radius;
public double x;
private double y;
private double z;
}
A) x is available to code that is written outside the Circle class.
B) radius is not available to code written outside the Circle class.
C) radius, x, y, and z are called members of the Circle class.
CORRECT Answers
1) One or more objects may be created from a(n):
A) field
B) class
C) method
D) instance - Answer: B
2) Class objects normally have ________ that perform useful operations on their data, but
primitive
variables do not.
A) fields
B) instances
C) methods
D) relationships - Answer: C
3) In the cookie cutter metaphor, think of the ________ as a cookie cutter and ________ as the
cookies.
A) object; classes
B) class; objects
C) class; fields
D) attribute; methods - Answer: B
4) Which of the following are classes from the Java API?
A) Scanner
,B) Random
C) PrintWriter
D) All of the above - Answer: D
5) When you are working with a ________, you are using a storage location that holds a piece of
data.
A) primitive variable
B) reference variable
C) numeric literal
D) binary number - Answer: A
6) What is stored by a reference variable?
A) A binary encoded decimal
B) A memory address
C) An object
D) A string - Answer: B
7) Most programming languages that are in use today are:
A) procedural
B) logic
C) object-oriented
D) functional - Answer: C
8) Java allows you to create objects of this class in the same way you would create primitive
variables.
A) Random
B) String
C) PrintWriter
, D) Scanner - Answer: B
9) A UML diagram does not contain:
A) the class name
B) the method names
C) the field names
D) object names - Answer: D
10) Data hiding, which means that critical data stored inside the object is protected from code
outside the
object, is accomplished in Java by:
A) using the public access specifier on the class methods
B) using the private access specifier on the class methods
C) using the private access specifier on the class definition
D) using the private access specifier on the class fields - Answer: D
11) For the following code, which statement is NOT true?
public class Sphere
{
private double radius;
public double x;
private double y;
private double z;
}
A) x is available to code that is written outside the Circle class.
B) radius is not available to code written outside the Circle class.
C) radius, x, y, and z are called members of the Circle class.