Deck 4: More Object Concepts
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Match between columns
Question
Match between columns
Question
Match between columns
Question
Match between columns
Question
Match between columns
Question
Question
Match between columns
Question
Match between columns
Question
Match between columns
Question
Match between columns
Question
Match between columns
Question
Match between columns
Question
Match between columns
Premises:
Responses:
optional classes
inner block
comes into scope
class methods
overloading
Math class
composition
Java.time
constant
nested
scope level
shadowing
NaN
enumeration
package
Question
Match between columns
Question
Question
Match between columns
Question
Question
Match between columns
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/84
Play
Full screen (f)
Deck 4: More Object Concepts
1
You can overload methods correctly by providing different parameter lists for methods with the same name.
True
2
____ involves using one term to indicate diverse meanings, or writing multiple methods with the same name but with different parameter lists.
A) Referencing
B) Overloading
C) Nesting
D) Signing
A) Referencing
B) Overloading
C) Nesting
D) Signing
B
3
If you give the same name to a class's instance field and to a local method variable, the instance variable overrides the method's local variable.
False
4
When you write your own constructors, you cannot write versions that receive parameters.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
5
It is illegal to declare the same variable name more than once within a block.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
6
When they have the same name, variables within ____ of a class override the class's fields.
A) packages
B) statements
C) fields
D) methods
A) packages
B) statements
C) fields
D) methods
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
7
A method can receive ____ arguments, even if it is defined as needing double arguments.
A) string
B) integer
C) constructor
D) send
A) string
B) integer
C) constructor
D) send
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
8
It is a convenience to be able to use one reasonable name for ____ that are functionally identical except for argument types.
A) arguments
B) classes
C) tasks
D) packages
A) arguments
B) classes
C) tasks
D) packages
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
9
A disadvantage of Java is the large memory requirements to store a separate copy of each variable and method for each instantiation of a class.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
10
When you properly ____ a method, you can call it providing different argument lists, and the appropriate version of the method executes.
A) declare
B) overload
C) name
D) delete
A) declare
B) overload
C) name
D) delete
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
11
When you overload a Java method, you write multiple methods with a shared name.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
12
A locally declared variable always ____ another variable with the same name elsewhere in the class.
A) creates
B) masks
C) deletes
D) uses
A) creates
B) masks
C) deletes
D) uses
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
13
Fields declared to be static are not always final .
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
14
An alternative to importing a class is to import an entire package of classes.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
15
When you multiply an int and a double , the result is the int .
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
16
When an application contains just one version of a method, you can call the method using a(n) ____ of the correct data type.
A) parameter
B) scope
C) output
D) constructor
A) parameter
B) scope
C) output
D) constructor
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
17
Object-oriented programmers use the term ____ when a child class contains a field or method that has the same name as one in the parent class.
A) out of scope
B) ambiguous
C) override
D) parent friendly
A) out of scope
B) ambiguous
C) override
D) parent friendly
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
18
A variable comes into existence, or ____, when you declare it.
A) goes out of scope
B) comes into scope
C) overrides scope
D) is referenced
A) goes out of scope
B) comes into scope
C) overrides scope
D) is referenced
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
19
Within any class or method, the code between a pair of curly braces is called a(n) ____.
A) overload
B) argument
C) scope
D) block
A) overload
B) argument
C) scope
D) block
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
20
A block can exist entirely within another block or entirely outside and separate from another block, and sometimes blocks can overlap.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
21
The ____ statement notifies the program that you will be using the data and method names that are part of the imported class or package.
A) use
B) package
C) class
D) import
A) use
B) package
C) class
D) import
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
22
In a Java ____statement, you use a wildcard symbol to represent all the classes in a package.
A) import
B) enumeration
C) package
D) default constructor
A) import
B) enumeration
C) package
D) default constructor
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
23
When calling this() from a constructor, it must be the ____ statement within the constructor.
A) first
B) ending
C) second
D) indented
A) first
B) ending
C) second
D) indented
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
24
You can use ____ arguments to initialize field values, but you can also use arguments for any other purpose.
A) object
B) constructor
C) data
D) field
A) object
B) constructor
C) data
D) field
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
25
It is not necessary to create an instance of the Math class because the constants and methods of the class are ____.
A) void
B) final
C) static
D) public
A) void
B) final
C) static
D) public
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
26
When you ____methods, you risk creating an ambiguous situation-one in which the compiler cannot determine which method to use.
A) use static variables in
B) use class variables in
C) finalize
D) overload
A) use static variables in
B) use class variables in
C) finalize
D) overload
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
27
If a class's only constructor requires an argument, you must provide an argument for every ____ of the class that you create.
A) parameter
B) type
C) object
D) method
A) parameter
B) type
C) object
D) method
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
28
When you pass a(n) ____, you pass a memory address.
A) reference
B) class variable
C) value
D) static variable
A) reference
B) class variable
C) value
D) static variable
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
29
The reference to an object that is passed to any object's nonstatic class method is called the ____.
A) magic number
B) this reference
C) literal constant
D) reference
A) magic number
B) this reference
C) literal constant
D) reference
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
30
____ variables are variables that are shared by every instantiation of a class.
A) Integer
B) Instance
C) Class
D) Time
A) Integer
B) Instance
C) Class
D) Time
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
31
The ____ package contains is implicitly imported into Java programs and is the only automatically imported, named package.
A) javax.swing
B) java.lang
C) JOptionPane
D) System
A) javax.swing
B) java.lang
C) JOptionPane
D) System
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
32
Due to automatic type promotion, when a method with a double parameter is passed an integer, the integer will be promoted to a(n) ____.
A) integer
B) short
C) boolean
D) double
A) integer
B) short
C) boolean
D) double
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
33
When an object of one class is a data field within another class, they are related by ____.
A) extension
B) scope
C) composition
D) is-a
A) extension
B) scope
C) composition
D) is-a
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
34
A(n) ____ is simply a folder that provides a convenient grouping for classes.
A) constructor
B) block
C) composition
D) package
A) constructor
B) block
C) composition
D) package
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
35
The compiler determines which version of a method to call by the method's ____.
A) name
B) signature
C) output
D) constructor
A) name
B) signature
C) output
D) constructor
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
36
You can use the asterisk (*) as a ____, which indicates that it can be replaced by any set of characters.
A) magic number
B) wildcard symbol
C) character symbol
D) placeholder
A) magic number
B) wildcard symbol
C) character symbol
D) placeholder
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
37
When you instantiate an object from a class, ____ is reserved for each instance field in the class.
A) a constructor
B) a signature
C) memory
D) a field name
A) a constructor
B) a signature
C) memory
D) a field name
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
38
A(n) ____ block begins immediately after the method declaration and ends at the end of the method.
A) inner
B) outer
C) nested
D) overlapped
A) inner
B) outer
C) nested
D) overlapped
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
39
If you want all objects to share a single nonchanging value, then the field is static and ______.
A) end
B) final
C) permanent
D) class
A) end
B) final
C) permanent
D) class
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
40
Another name for a nonstatic member class is a(n) ____.
A) static member class
B) inner class
C) local class
D) anonymous class
A) static member class
B) inner class
C) local class
D) anonymous class
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
41
Because the square root of a negative number is not defined, what is the result of this statement: System.out.println (Math.sqrt(-16));
A) Runtime error message
B) Syntax error
C) NaN
D) -4
A) Runtime error message
B) Syntax error
C) NaN
D) -4
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
42
The java.lang package is implicitly imported into every program you write. The classes it contains are ____ that provide the basis of the Java programming language.
A) optional classes
B) static classes
C) fundamental classes
D) anonymous classes
A) optional classes
B) static classes
C) fundamental classes
D) anonymous classes
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
43
Match between columns
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
44
Match between columns
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
45
Match between columns
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
46
Match between columns
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
47
Match between columns
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
48
____ are local classes that have no identifier.
A) Anonymous classes
B) Nonstatic member classes
C) Local classes
D) static member classes
A) Anonymous classes
B) Nonstatic member classes
C) Local classes
D) static member classes
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
49
Match between columns
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
50
Match between columns
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
51
Match between columns
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
52
Match between columns
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
53
Match between columns
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
54
Match between columns
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
55
Match between columns
Premises:
Responses:
optional classes
inner block
comes into scope
class methods
overloading
Math class
composition
Java.time
constant
nested
scope level
shadowing
NaN
enumeration
package
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
56
Match between columns
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
57
A Java variable's scope level is its ____.
A) constructor
B) class method
C) block
D) fundamental class
A) constructor
B) class method
C) block
D) fundamental class
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
58
Match between columns
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
59
The methods of LocalDate include getMonth() and getDayOfWeek() . Each of these methods returns a(n) ____, which is a data type that consists of a list of values.
A) array
B) constant
C) shadow array
D) enumeration
A) array
B) constant
C) shadow array
D) enumeration
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
60
Match between columns
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
61
Describe the impact that blocks and methods have on variables with the same name.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
62

Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
63
Describe how a Java variable comes into and out of scope.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
64
What does it mean when a variable overrides another variable?
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
65

Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
66
What is automatic type promotion in method calls? Give an example of how this works.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
67
Describe a block and define an outer block and an inner block.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
68
What is the difference between class variables and instance variables?
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
69
What is overloading a method? What conditions must be satisfied in the parameter lists of an overloaded method?
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
70
public class StudentScores
{
private int ScoreOne;
private int ScoreTwo;
private int ScoreThree;
____
____
____
____
____
}
Using the code above, fill in the blank lines provided to create a constructor that will require parameters for the three score data fields. Be sure to include the necessary brackets and semicolons.
{
private int ScoreOne;
private int ScoreTwo;
private int ScoreThree;
____
____
____
____
____
}
Using the code above, fill in the blank lines provided to create a constructor that will require parameters for the three score data fields. Be sure to include the necessary brackets and semicolons.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
71
What does a programmer need to know in order to use two variables with the same name in a class?
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
72

Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
73
What is a reference and what is the meaning of the keyword this ?
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
74

Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
75
int aMethod(int x)
void aMethod(int x)
In the above statements, explain why these two methods are illegal in the class.
void aMethod(int x)
In the above statements, explain why these two methods are illegal in the class.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
76
What is the phenomenon called shadowing?
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
77

Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
78
List and describe the four types of nested classes.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
79
List the three things you can do that allow you to use prewritten classes.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
80
Explain the java.lang package and why it is important.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck