Question
1. Java interfaces a. can contain final variables that are initialized with a value b. can contain multiple abstract methods. c. can serve as reference
1. Java interfaces
a. can contain final variables that are initialized with a value
b. can contain multiple abstract methods.
c. can serve as reference data types
d. All the above.
e. a and b
f. a and c
2. If the class Turkey implements the Edible interface, then the relationship between Turkey and Edible is:
a. has-a
b. aggregation
c. is-a
d. a and b
e. None of the above
3. Class members with this modifier can potentially be accessed outside of the package.
a. protected
b. private
c. public
d. default
e. All the above
f. a and c
g. a, c, d
4. In the following problem, the class Apple inherits from the class Fruit. Which of the following is true?
public Apple( String name ) {
super();
//Other code for the Apple constructor goes here.
} a. The italicized line calls one of the Fruit constructors.
b. The italicized line could have been omitted.
c. The above Apple constructor would be explicitly called by any subclasses of Apple when needed.
d. All the above.
e. a and b
5. The Java programming language:
a. Allows a class to directly inherit from multiple superclasses.
b. Allows a class to implement multiple interfaces.
c. Allows a class to both extend a class and implement an interface.
d. All the above.
e. b and c
f. None of the above
6. What can you deduce from the following statement?
Shape rect = new Rectangle(); a. Shape is definitely abstract.
b. Shape is definitely concrete.
c. Rectangle is definitely concrete.
d. The properties and behaviors of Shape are a subset of those of Rectangle.
e. a, c, d
f. c and d
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started