Question
Which of the following is NOT true about abstract classes? Abstract classes are usually the parent in an inheritance hierarchy. You can instantiate an abstract
-
Which of the following is NOT true about abstract classes?
Abstract classes are usually the parent in an inheritance hierarchy.
You can instantiate an abstract class using the new keyword. (Instantiate = make an object from)
The term abstract is used in front of the class name to make the class abstract.
Abstract classes may have zero or more abstract methods.
QUESTION 2
-
Which of the following lines of code is the correct way to set up an abstract method in an abstract class?
public abstract double getArea();
public double getArea;
public double getArea(){
};
public abstract double getArea(){
return double;
}
QUESTION 3
-
An abstract method in an abstract class MUST be defined in any concrete subclass that inherits from the abstract class.
True
False
QUESTION 4
-
How is an abstract item marked in UML?
Abstract items should be in all CAPS in UML.
Abstract items should be bold in UML.
Abstract items should be underlined in UML.
Abstract items should be italicized in UML.
QUESTION 5
-
Which keyword is used when you want to use an interface in your class?
implements
extends
uses
inherits
QUESTION 6
-
Why might you choose to utilize the Comparable interface?
So that you can later use Collections.sort() to put the items in your Array/ArrayList in a specific order.
So you can compare the code in one class to the code in another class.
So you can put all of your classes in order.
So you can compare apples and oranges.
QUESTION 7
-
Interfaces never have instance fields.
True
False
QUESTION 8
-
A class can only utilize one interface.
True
False
QUESTION 9
-
In which of the following scenarios would it be best to make the class abstract?
A stand-alone class that will never have child classes inheriting from it.
A child class in an inheritance hierarchy that should remain concrete.
A class that will provide functionality for several unrelated classes.
A parent class in an inheritance hierarchy that should never be instantiated.
QUESTION 10
-
Which TWO of the four principles of object-oriented programming are more focused on the idea of hiding data or unnecessary information from others who may use your classes?
Inheritance
Polymorphism
Encapsulation
Abstraction
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