Deck 13: Interfaces and Inner Classes
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
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/32
Play
Full screen (f)
Deck 13: Interfaces and Inner Classes
1
In Java,a derived class can have ________ base classes).
A)one
B)two
C)three
D)there is no limit
A)one
B)two
C)three
D)there is no limit
A
2
An interface is a type.
True
3
The Comparable interface is in the ______________ package.
A)java.util
B)java.io
C)java.awt
D)java.lang
A)java.util
B)java.io
C)java.awt
D)java.lang
D
4
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
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
5
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
A)Final
B)Static
C)Void
D)Protected
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
6
The method that must be implemented in a class using the Comparable interface is:
A)public Object compareToObject other)
B)public Boolean compareToObject other)
C)public int compareToObject other)
D)none of the above
A)public Object compareToObject other)
B)public Boolean compareToObject other)
C)public int compareToObject other)
D)none of the above
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
7
An interface and all of its method headings are normally declared to be:
A)public
B)private
C)protected
D)package access
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
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
9
Any constant variables defined in an interface must be defined as:
A)public
B)private
C)protected
D)package access
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
10
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
11
A class may only implement one interface.
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
12
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
13
Inner classes available outside the scope of their outer class are modified by the keyword:
A)Public
B)Private
C)Protected
D)Package access
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
14
An interface may contain:
A)instance variables
B)primitive variables
C)constant variables
D)all of the above
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
15
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
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
16
A class that uses an interface must use the keyword:
A)Extends
B)Inherits
C)Super
D)Implements
A)Extends
B)Inherits
C)Super
D)Implements
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
17
The compareTo method should return _____________ if the calling object equals the parameter.
A)A negative number
B)Zero
C)A positive number
D)Null
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
18
When using the clone method from an inherited base class you should account for a _________ exception.
A)CloneNotFoundException
B)CloneEmptyException
C)CloneNotSupportedException
D)CloneNotEmptyException
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
19
A common use of inner classes is :
A)clean up
B)set up
C)helper
D)all of the above
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
20
A Java interface is an example of:
A)encapsulation
B)abstraction
C)polymorphism
D)all of the above
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
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
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
23
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
24
What are the rules of total ordering?
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
25
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
26
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
27
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
28
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
29
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
30
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
31
What is an anonymous class?
Unlock Deck
Unlock for access to all 32 flashcards in this deck.
Unlock Deck
k this deck
32
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