Java Ch 9
17. True or False: A superclass inherits members of the subclass.
False
19. True or False: If a subclass constructor does not explicitly call a superclass constructor, Java will not call any of the superclass's constructors.
False
20. True or False: An object of a superclass can access members declared in a subclass.
False
22. True or False: When a method is declared with the final modifier, it must be overridden in a subclass.
False
23. True or False: A superclass has a member with package access. A class that is outside the superclass's package but inherits from the superclass can access this member.
False
27. True or False: A class can implement only one interface.
False
28. True or False: An interface reference variable cannot reference any object that implements that interface, regardless of its class type.
False
18. True or False: The super statement that calls the superclass constructor can be written only in the subclass's constructor.
True
21. True or False: The superclass constructor always executes before the subclass constructor.
True
24. True or False: Protected members of a class are directly accessed by methods of the class or methods of a subclass.
True
25. True or False: A subclass reference variable can reference an object of the superclass.
True
26. True or False: When a class contains an abstract method, the class cannot be instantiated.
True
9. A method in a subclass having the same name as a method in the superclass but a different signature, is an example of a. overloading b. overriding c. composition d. an error
a. overloading
15. Abstract methods must be a. overridden b. overloaded c. deleted and replaced with real methods d. declared as private
a. overridden
4. These are two of the most useful members of the Object class. a. toString and equals methods b. toString and compareTo methods c. equals and valueOf methods d. equals and split methods
a. toString and equals methods
5. This key word refers to an object's superclass. a. super b. base c. this d. parent
b. base
8. A method in a subclass having the same signature as a method in the superclass is an example of a. overloading b. overriding c. composition d. an error
b. overriding
10. This access specifier is not accessible to all other classes in the same package. a. public b. private c. protected d. no modifier
b. private
13. When a class implements an interface, it must a. overload all of the methods listed in the interface b. provide all of the methods that are listed in the interface, with the exact signatures specified c. not have a constructor d. be an abstract class
b. provide all of the methods that are listed in the interface, with the exact signatures specified
1. In an inheritance relationship, this is the general class. a. subclass b. superclass c. derived class d. child class
b. superclass
16. Abstract classes cannot a. be used as superclasses b. have abstract methods c. be instantiated d. have fields
c. be instantiated
14. Fields in an interface are a. final b. static c. both final and static d. not allowed
c. both final and static
2. In an inheritance relationship, this is the specialized class. a. superclass b. base class c. subclass d. parent class
c. subclass
12. With this type of binding, the Java Virtual Machine determines at runtime which method to call, depending on the type of the object that a variable references. a. static b. early c. flexible d. dynamic
d. dynamic
3. This key word indicates that a class inherits from another class. a. derived b. specialized c. based d. extends
d. extends
6. instanceof is a[n] a. method b. identifier c. class d. operator
d. operator