Deck 8: Console Input and Output

Full screen (f)
exit full mode
Question
If you choose to use the method clone in your code,you must ___________ the clone method.
(a)overload
(b)encapsulate
(c)override
(d)protect
Use Space or
up arrow
down arrow
to flip the card.
Question
A class that has at least one abstract method is called an:
(a)concrete class
(b)encapsulated class
(c)abstract class
(d)private class
Question
An abstract method cannot be modified by:
(a)public
(b)protected
(c)private
(d)none of the above
Question
Polymorphism refers to the ability to associate many meanings to one method through dynamic binding.
Question
Late binding refers to the method definition being associated with the method invocation when the method is invoked at run time.
Question
Assigning an object of an ancestor class to a descendent class is called:
(a)static binding
(b)dynamic binding
(c)upcasting
(d)downcasting
Question
A class with no abstract methods is called a
(a)concrete class
(b)encapsulated class
(c)abstract class
(d)private class
Question
The clone method has ________ parameters.
(a)zero
(b)one
(c)two
(d)three
Question
The clone method return type is:
(a)the same as the cloned object
(b)Object
(c)String
(d)none of the above
Question
Java allows an instance of an abstract class to be instantiated.
Question
Assigning an object of a derived class to a variable of a base class is called:
(a)static binding
(b)dynamic binding
(c)upcasting
(d)downcasting
Question
Java does not use late binding for methods marked as:
(a)final
(b)static
(c)private
(d)all of the above
Question
You cannot create an object using a/an:
(a)superclass constructor
(b)subclass constructor
(c)ancestor class constructor
(d)abstract class constructor
Question
__________ refers to the ability to associate many meanings to one method name by means of the late binding mechanism.
(a)Inheritance
(b)Encapsulation
(c)Polymorphism
(d)None of the above
Question
The principals of object oriented programming include:
(a)encapsulation
(b)inheritance
(c)polymorphism
(d)all of the above
Question
____________ refers to the process of associating a method definition with a method invocation.
(a)Binding
(b)Encapsulation
(c)Inheritance
(d)Polymorphism
Question
A method marked as final means the compiler uses ________ binding.
(a)dynamic
(b)early
(c)late
(d)none of the above
Question
Early binding enables the compiler to be more efficient.
Question
An abstract class must have the modifier ___________ included in the class heading.
(a)static
(b)abstract
(c)final
(d)private
Question
__________ binding refers to the method definition being associated with the method invocation when the code is compiled.
(a)Dynamic
(b)Late
(c)Early
(d)None of the above
Question
Java uses late binding with private methods,methods marked final,or static methods.
Question
What are the advantages of polymorphism?
Question
What is wrong with the following method definition?
public abstract void doSomething(int count)
Question
Implement the base class in the shoe hierarchy in number 8 above.
Question
Derive a class named Boots from the base class created in number 9 above.
Question
Explain the difference between early and late binding.
Question
What is polymorphism and how does it relate to late binding?
Question
The method clone has one parameter and should return a copy of the calling object.
Question
Why should the instanceOf operator be used in conjunction with downcasting?
Question
Write a decision statement to determine if an object should be downcast.
Question
Draw an inheritance hierarchy to represent a shoe object.The base class should have derived classes of Dress Shoes,Tennis Shoes and Boots.
Question
Derive a class named Tennis Shoes from the base class created in number 9 above.
Question
The final modifier is included before the definition of the method,then the method can be redefined in a derived class.
Question
Downcasting should be used only in situations where it makes sense.
Question
Derive a class named Dress Shoes from the base class created in number 9 above.
Question
The type of the variable naming an object determines which method names can be used in an invocation with that calling object.
Question
What is an abstract method?
Question
An abstract class is a class that has some methods without complete definitions.
Question
Describe the limitations of the copy constructor.
Question
An abstract method serves as a placeholder for a method that must be defined in all derived classes.
Question
Override the clone method inherited in the Tennis Shoes class created in number 11 above.
Question
Override the clone method inherited in the Dress Shoes class created in number 10 above.
Question
Override the clone method inherited in the Boots class created in number 12 above.
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/43
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 8: Console Input and Output
1
If you choose to use the method clone in your code,you must ___________ the clone method.
(a)overload
(b)encapsulate
(c)override
(d)protect
C
2
A class that has at least one abstract method is called an:
(a)concrete class
(b)encapsulated class
(c)abstract class
(d)private class
C
3
An abstract method cannot be modified by:
(a)public
(b)protected
(c)private
(d)none of the above
C
4
Polymorphism refers to the ability to associate many meanings to one method through dynamic binding.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
5
Late binding refers to the method definition being associated with the method invocation when the method is invoked at run time.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
6
Assigning an object of an ancestor class to a descendent class is called:
(a)static binding
(b)dynamic binding
(c)upcasting
(d)downcasting
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
7
A class with no abstract methods is called a
(a)concrete class
(b)encapsulated class
(c)abstract class
(d)private class
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
8
The clone method has ________ parameters.
(a)zero
(b)one
(c)two
(d)three
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
9
The clone method return type is:
(a)the same as the cloned object
(b)Object
(c)String
(d)none of the above
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
10
Java allows an instance of an abstract class to be instantiated.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
11
Assigning an object of a derived class to a variable of a base class is called:
(a)static binding
(b)dynamic binding
(c)upcasting
(d)downcasting
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
12
Java does not use late binding for methods marked as:
(a)final
(b)static
(c)private
(d)all of the above
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
13
You cannot create an object using a/an:
(a)superclass constructor
(b)subclass constructor
(c)ancestor class constructor
(d)abstract class constructor
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
14
__________ refers to the ability to associate many meanings to one method name by means of the late binding mechanism.
(a)Inheritance
(b)Encapsulation
(c)Polymorphism
(d)None of the above
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
15
The principals of object oriented programming include:
(a)encapsulation
(b)inheritance
(c)polymorphism
(d)all of the above
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
16
____________ refers to the process of associating a method definition with a method invocation.
(a)Binding
(b)Encapsulation
(c)Inheritance
(d)Polymorphism
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
17
A method marked as final means the compiler uses ________ binding.
(a)dynamic
(b)early
(c)late
(d)none of the above
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
18
Early binding enables the compiler to be more efficient.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
19
An abstract class must have the modifier ___________ included in the class heading.
(a)static
(b)abstract
(c)final
(d)private
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
20
__________ binding refers to the method definition being associated with the method invocation when the code is compiled.
(a)Dynamic
(b)Late
(c)Early
(d)None of the above
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
21
Java uses late binding with private methods,methods marked final,or static methods.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
22
What are the advantages of polymorphism?
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
23
What is wrong with the following method definition?
public abstract void doSomething(int count)
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
24
Implement the base class in the shoe hierarchy in number 8 above.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
25
Derive a class named Boots from the base class created in number 9 above.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
26
Explain the difference between early and late binding.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
27
What is polymorphism and how does it relate to late binding?
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
28
The method clone has one parameter and should return a copy of the calling object.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
29
Why should the instanceOf operator be used in conjunction with downcasting?
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
30
Write a decision statement to determine if an object should be downcast.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
31
Draw an inheritance hierarchy to represent a shoe object.The base class should have derived classes of Dress Shoes,Tennis Shoes and Boots.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
32
Derive a class named Tennis Shoes from the base class created in number 9 above.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
33
The final modifier is included before the definition of the method,then the method can be redefined in a derived class.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
34
Downcasting should be used only in situations where it makes sense.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
35
Derive a class named Dress Shoes from the base class created in number 9 above.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
36
The type of the variable naming an object determines which method names can be used in an invocation with that calling object.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
37
What is an abstract method?
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
38
An abstract class is a class that has some methods without complete definitions.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
39
Describe the limitations of the copy constructor.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
40
An abstract method serves as a placeholder for a method that must be defined in all derived classes.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
41
Override the clone method inherited in the Tennis Shoes class created in number 11 above.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
42
Override the clone method inherited in the Dress Shoes class created in number 10 above.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
43
Override the clone method inherited in the Boots class created in number 12 above.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 43 flashcards in this deck.