Deck 13: Interfaces and Inner Classes

Full screen (f)
exit full mode
Question
The method that must be implemented in a class using the Comparable interface is:
(a)public Object compareTo(Object other)
(b)public Boolean compareTo(Object other)
(c)public int compareTo(Object other)
(d)none of the above
Use Space or
up arrow
down arrow
to flip the card.
Question
A class that uses an interface must use the keyword:
(a)Extends
(b)Inherits
(c)Super
(d)Implements
Question
If an inner class contains non static members,then the class name must be modified by the keyword:
(a)Final
(b)Static
(c)Void
(d)Protected
Question
The Comparable interface is in the ______________ package.
(a)java.util
(b)java.io
(c)java.awt
(d)java.lang
Question
A Java interface is an example of:
(a)encapsulation
(b)abstraction
(c)polymorphism
(d)all of the above
Question
A class that implements an interface but only gives definitions for some of the method headings given in the interface is called a/an:
(a)concrete class
(b)abstract class
(c)discrete class
(d)friendly class
Question
Inner classes available outside the scope of their outer class are modified by the keyword:
(a)Public
(b)Private
(c)Protected
(d)Package access
Question
Any constant variables defined in an interface must be defined as:
(a)public
(b)private
(c)protected
(d)package access
Question
Java interfaces are a way of simulating multiple inheritance.
Question
An interface specifies the headings and definitions for methods that must be defined in any class that implements the interface.
Question
When defining an inner class to be a helper class for an outer class,the inner classes access should be marked as:
(a)Public
(b)Private
(c)Protected
(d)Package access
Question
A class may only implement one interface.
Question
An interface may contain:
(a)instance variables
(b)primitive variables
(c)constant variables
(d)all of the above
Question
An interface is a type.
Question
When using the clone method from an inherited base class you should account for a _________ exception.
(a)CloneNotFoundException
(b)CloneEmptyException
(c)CloneNotSupportedException
(d)CloneNotEmptyException
Question
You can not derive an interface from a base interface.
Question
An interface and all of its method headings are normally declared to be:
(a)public
(b)private
(c)protected
(d)package access
Question
The compareTo method should return _____________ if the calling object equals the parameter.
(a)A negative number
(b)Zero
(c)A positive number
(d)Null
Question
In Java,a derived class can have ________ base class(es).
(a)one
(b)two
(c)three
(d)there is no limit
Question
A common use of inner classes is :
(a)clean up
(b)set up
(c)helper
(d)all of the above
Question
What are the semantics of the Comparable interface?
Question
Java source code that contains a class with an inner class,when compiled,will produce a separate .class file for the inner class.
Question
An interface can contain defined constants as well as method headings or instead of method headings.
Question
An inner class definition is local to the outer class definition.
Question
The compiler and the run-time system enforces semantics on the Comparable interface.
Question
What are the obligations of a class that implements a specific interface?
Question
Inner and outer classes do not have access to each other's private members.
Question
What are two advantages to using inner classes?
Question
What is an anonymous class?
Question
The Serializable interface is like all the other Java interfaces in that it contains defined constants and method headings.
Question
What are the rules of total ordering?
Question
Why does Java only allow the inheritance of only one base class?
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/32
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 13: Interfaces and Inner Classes
1
The method that must be implemented in a class using the Comparable interface is:
(a)public Object compareTo(Object other)
(b)public Boolean compareTo(Object other)
(c)public int compareTo(Object other)
(d)none of the above
C
2
A class that uses an interface must use the keyword:
(a)Extends
(b)Inherits
(c)Super
(d)Implements
D
3
If an inner class contains non static members,then the class name must be modified by the keyword:
(a)Final
(b)Static
(c)Void
(d)Protected
B
4
The Comparable interface is in the ______________ package.
(a)java.util
(b)java.io
(c)java.awt
(d)java.lang
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
5
A Java interface is an example of:
(a)encapsulation
(b)abstraction
(c)polymorphism
(d)all of the above
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
6
A class that implements an interface but only gives definitions for some of the method headings given in the interface is called a/an:
(a)concrete class
(b)abstract class
(c)discrete class
(d)friendly class
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
7
Inner classes available outside the scope of their outer class are modified by the keyword:
(a)Public
(b)Private
(c)Protected
(d)Package access
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
8
Any constant variables defined in an interface must be defined as:
(a)public
(b)private
(c)protected
(d)package access
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
9
Java interfaces are a way of simulating multiple inheritance.
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
10
An interface specifies the headings and definitions for methods that must be defined in any class that implements the interface.
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
11
When defining an inner class to be a helper class for an outer class,the inner classes access should be marked as:
(a)Public
(b)Private
(c)Protected
(d)Package access
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
12
A class may only implement one interface.
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
13
An interface may contain:
(a)instance variables
(b)primitive variables
(c)constant variables
(d)all of the above
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
14
An interface is a type.
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
15
When using the clone method from an inherited base class you should account for a _________ exception.
(a)CloneNotFoundException
(b)CloneEmptyException
(c)CloneNotSupportedException
(d)CloneNotEmptyException
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
16
You can not derive an interface from a base interface.
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
17
An interface and all of its method headings are normally declared to be:
(a)public
(b)private
(c)protected
(d)package access
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
18
The compareTo method should return _____________ if the calling object equals the parameter.
(a)A negative number
(b)Zero
(c)A positive number
(d)Null
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
19
In Java,a derived class can have ________ base class(es).
(a)one
(b)two
(c)three
(d)there is no limit
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
20
A common use of inner classes is :
(a)clean up
(b)set up
(c)helper
(d)all of the above
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
21
What are the semantics of the Comparable interface?
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
22
Java source code that contains a class with an inner class,when compiled,will produce a separate .class file for the inner class.
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
23
An interface can contain defined constants as well as method headings or instead of method headings.
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
24
An inner class definition is local to the outer class definition.
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
25
The compiler and the run-time system enforces semantics on the Comparable interface.
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
26
What are the obligations of a class that implements a specific interface?
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
27
Inner and outer classes do not have access to each other's private members.
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
28
What are two advantages to using inner classes?
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
29
What is an anonymous class?
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
30
The Serializable interface is like all the other Java interfaces in that it contains defined constants and method headings.
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
31
What are the rules of total ordering?
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
32
Why does Java only allow the inheritance of only one base class?
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 32 flashcards in this deck.