Deck 6: Introduction to Defining Classes

Full screen (f)
exit full mode
Question
The combining of data and behavior into a single software package is called ____.

A) instantiation
B) modification
C) encapsulation
D) identification
Use Space or
up arrow
down arrow
to flip the card.
Question
A constructor method indicates how to initialize a new object.
Question
When a Java program is executing, memory for data is allocated within objects.
Question
A class template can include more than one constructor, provided each has a unique parameter list.
Question
When a new class is created, it includes the characteristics of its superclass through a process called inheritance. ____________________
Question
A variable of a primitive type is thought of as a box that contains a pointer to an object. ____________________
Question
A(n) ____ is a runtime entity that contains data and responds to messages.

A) object
B) class
C) package
D) method
Question
The process of creating a new object is called ____.

A) instantiation
B) modification
C) encapsulation
D) identification
Question
Finding run-time errors in a program is more difficult when there are several classes instead of just one.
Question
Java programmers must instruct the program to delete objects explicitly.
Question
The purpose of a message is to pass information to a method.
Question
Class definitions usually begin with the keyword private.
Question
When sending messages, a client only needs to know the server's identity. ____________________
Question
When a Java program is executing, the computer's memory is holding all of the following EXCEPT ____.

A) all class templates in their compiled form
B) an object's state
C) variables that refer to objects
D) objects as needed
Question
An argument is a value passed to a method when it is invoked. ____________________
Question
In the hierarchy of Java classes, if class A is immediately above class B, A is the subclass or child of class B.
Question
An object has ____, as defined by the methods of its class.

A) state
B) identity
C) scope
D) behavior
Question
Shadowing is when a local variable and an instance variable have the same name.
Question
Do not use a variable until you have assigned its initial value.
Question
An object must have its own unique identity, which distinguishes it from all other objects in the computer's memory. ____________________
Question
In the code ____, i and j are memory locations that have not yet been initialized, but which will hold integers.

A) i = int; j = int;
B) int i, j;
C) int = i, j;
D) i = ?; j = ?;
Question
FIGURE 6-2 <strong>FIGURE 6-2   In Figure 6-2 above, the program ____.</strong> A) is executing B) has a run-time error C) is showing its output D) is compiling <div style=padding-top: 35px>
In Figure 6-2 above, the program ____.

A) is executing
B) has a run-time error
C) is showing its output
D) is compiling
Question
In a method, the return type should be ____ when the method returns no value.

A) void
B) null
C) 0
D) { }
Question
All of the following are true about constructors, EXCEPT ____.

A) if a class has more than one constructor, all of the constructors must have the same name
B) if a class template contains no constructors, the JVM provides a primitive default constructor
C) a class is harder to use when it has a variety of constructors
D) all of the above are true
Question
When a class includes several constructors, the code for them can be simplified by ____ them.

A) defining
B) combining
C) instantiating
D) chaining
Question
A(n) ____________________ is a description of a task that is performed in response to a message.
Question
All classes have a similar structure, consisting of all of the below parts EXCEPT ____.

A) the class's name and some modifying phrases
B) a description of the instance variables
C) one or more constructor methods
D) methods that specify how an object responds to variables
Question
____ is used to set up a skeletal, incomplete, but running program during program development.

A) { }
B) A stub
C) A placeholder
D) A helper method
Question
A(n) ____________________ is a software package or template that describes the characteristics of similar objects.
Question
It is the role of ____ to contain data and to respond to messages.

A) packages
B) methods
C) classes
D) objects
Question
An object has ____________________, which is another way of saying that at any particular moment its instance variables have particular values.
Question
A program can detect and respond to mouse events by attaching ____ objects to a panel.

A) clicker
B) listener
C) button
D) helper
Question
Messages that change an object's state are called ____________________.
Question
Defining a(n) ____ for a shape allows a user to manipulate it by changing its color, position, or size.

A) class
B) object
C) parameter
D) method
Question
Parameters listed in a method's definition are called ____ parameters.

A) header
B) actual
C) formal
D) argument
Question
The ____ of a variable is the region of the program within which it can validly appear in lines of code.

A) lifetime
B) block
C) scope
D) parameter
Question
In the hierarchy of Java classes, at the root of the hierarchy is a class called ____.

A) Object
B) Child
C) Base
D) Subclass
Question
Ana tells Pratik that a circle's attributes include all of the following EXCEPT ____.

A) color
B) circumference
C) center point
D) radius
Question
FIGURE 6-1 <strong>FIGURE 6-1   Figure 6-1 above shows the Student variable before and after it has been assigned the value ____.</strong> A) void B) 0 C) null D) \ <div style=padding-top: 35px>
Figure 6-1 above shows the Student variable before and after it has been assigned the value ____.

A) void
B) 0
C) null
D) \
Question
Variables declared within any compound statement enclosed in braces are said to have ____ scope.

A) initial
B) infinite
C) local
D) block
Question
Identify the letter of the choice that best matches the phrase or definition.
a.Garbage collection
b.Reference type
c.Public
d.Information hiding
e.Helper method
When the server's data requirements and the implementation of its methods are concealed from the client.
Question
Identify the letter of the choice that best matches the phrase or definition.
a.Garbage collection
b.Reference type
c.Public
d.Information hiding
e.Helper method
A process in which unreferenced objects are removed from memory.
Question
Identify the letter of the choice that best matches the phrase or definition.
a.Garbage collection
b.Reference type
c.Public
d.Information hiding
e.Helper method
Includes String, Student, Scanner, and other classes.
Question
Identify the letter of the choice that best matches the phrase or definition.
a.Garbage collection
b.Reference type
c.Public
d.Information hiding
e.Helper method
Used when a task is broken into subtasks.
Question
Identify the letter of the choice that best matches the phrase or definition.
a.Garbage collection
b.Reference type
c.Public
d.Information hiding
e.Helper method
A type of visibility modifier.
Question
A(n) ____________________ variable is declared in order to have temporary working storage for data in a method.
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/46
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 6: Introduction to Defining Classes
1
The combining of data and behavior into a single software package is called ____.

A) instantiation
B) modification
C) encapsulation
D) identification
C
2
A constructor method indicates how to initialize a new object.
True
3
When a Java program is executing, memory for data is allocated within objects.
True
4
A class template can include more than one constructor, provided each has a unique parameter list.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
5
When a new class is created, it includes the characteristics of its superclass through a process called inheritance. ____________________
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
6
A variable of a primitive type is thought of as a box that contains a pointer to an object. ____________________
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
7
A(n) ____ is a runtime entity that contains data and responds to messages.

A) object
B) class
C) package
D) method
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
8
The process of creating a new object is called ____.

A) instantiation
B) modification
C) encapsulation
D) identification
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
9
Finding run-time errors in a program is more difficult when there are several classes instead of just one.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
10
Java programmers must instruct the program to delete objects explicitly.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
11
The purpose of a message is to pass information to a method.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
12
Class definitions usually begin with the keyword private.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
13
When sending messages, a client only needs to know the server's identity. ____________________
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
14
When a Java program is executing, the computer's memory is holding all of the following EXCEPT ____.

A) all class templates in their compiled form
B) an object's state
C) variables that refer to objects
D) objects as needed
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
15
An argument is a value passed to a method when it is invoked. ____________________
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
16
In the hierarchy of Java classes, if class A is immediately above class B, A is the subclass or child of class B.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
17
An object has ____, as defined by the methods of its class.

A) state
B) identity
C) scope
D) behavior
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
18
Shadowing is when a local variable and an instance variable have the same name.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
19
Do not use a variable until you have assigned its initial value.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
20
An object must have its own unique identity, which distinguishes it from all other objects in the computer's memory. ____________________
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
21
In the code ____, i and j are memory locations that have not yet been initialized, but which will hold integers.

A) i = int; j = int;
B) int i, j;
C) int = i, j;
D) i = ?; j = ?;
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
22
FIGURE 6-2 <strong>FIGURE 6-2   In Figure 6-2 above, the program ____.</strong> A) is executing B) has a run-time error C) is showing its output D) is compiling
In Figure 6-2 above, the program ____.

A) is executing
B) has a run-time error
C) is showing its output
D) is compiling
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
23
In a method, the return type should be ____ when the method returns no value.

A) void
B) null
C) 0
D) { }
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
24
All of the following are true about constructors, EXCEPT ____.

A) if a class has more than one constructor, all of the constructors must have the same name
B) if a class template contains no constructors, the JVM provides a primitive default constructor
C) a class is harder to use when it has a variety of constructors
D) all of the above are true
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
25
When a class includes several constructors, the code for them can be simplified by ____ them.

A) defining
B) combining
C) instantiating
D) chaining
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
26
A(n) ____________________ is a description of a task that is performed in response to a message.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
27
All classes have a similar structure, consisting of all of the below parts EXCEPT ____.

A) the class's name and some modifying phrases
B) a description of the instance variables
C) one or more constructor methods
D) methods that specify how an object responds to variables
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
28
____ is used to set up a skeletal, incomplete, but running program during program development.

A) { }
B) A stub
C) A placeholder
D) A helper method
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
29
A(n) ____________________ is a software package or template that describes the characteristics of similar objects.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
30
It is the role of ____ to contain data and to respond to messages.

A) packages
B) methods
C) classes
D) objects
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
31
An object has ____________________, which is another way of saying that at any particular moment its instance variables have particular values.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
32
A program can detect and respond to mouse events by attaching ____ objects to a panel.

A) clicker
B) listener
C) button
D) helper
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
33
Messages that change an object's state are called ____________________.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
34
Defining a(n) ____ for a shape allows a user to manipulate it by changing its color, position, or size.

A) class
B) object
C) parameter
D) method
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
35
Parameters listed in a method's definition are called ____ parameters.

A) header
B) actual
C) formal
D) argument
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
36
The ____ of a variable is the region of the program within which it can validly appear in lines of code.

A) lifetime
B) block
C) scope
D) parameter
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
37
In the hierarchy of Java classes, at the root of the hierarchy is a class called ____.

A) Object
B) Child
C) Base
D) Subclass
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
38
Ana tells Pratik that a circle's attributes include all of the following EXCEPT ____.

A) color
B) circumference
C) center point
D) radius
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
39
FIGURE 6-1 <strong>FIGURE 6-1   Figure 6-1 above shows the Student variable before and after it has been assigned the value ____.</strong> A) void B) 0 C) null D) \
Figure 6-1 above shows the Student variable before and after it has been assigned the value ____.

A) void
B) 0
C) null
D) \
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
40
Variables declared within any compound statement enclosed in braces are said to have ____ scope.

A) initial
B) infinite
C) local
D) block
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
41
Identify the letter of the choice that best matches the phrase or definition.
a.Garbage collection
b.Reference type
c.Public
d.Information hiding
e.Helper method
When the server's data requirements and the implementation of its methods are concealed from the client.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
42
Identify the letter of the choice that best matches the phrase or definition.
a.Garbage collection
b.Reference type
c.Public
d.Information hiding
e.Helper method
A process in which unreferenced objects are removed from memory.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
43
Identify the letter of the choice that best matches the phrase or definition.
a.Garbage collection
b.Reference type
c.Public
d.Information hiding
e.Helper method
Includes String, Student, Scanner, and other classes.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
44
Identify the letter of the choice that best matches the phrase or definition.
a.Garbage collection
b.Reference type
c.Public
d.Information hiding
e.Helper method
Used when a task is broken into subtasks.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
45
Identify the letter of the choice that best matches the phrase or definition.
a.Garbage collection
b.Reference type
c.Public
d.Information hiding
e.Helper method
A type of visibility modifier.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
46
A(n) ____________________ variable is declared in order to have temporary working storage for data in a method.
Unlock Deck
Unlock for access to all 46 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 46 flashcards in this deck.