Name the option. Question 1 Classes that are derived from an existing class thro
ID: 3719458 • Letter: N
Question
Name the option.
Question 1
Classes that are derived from an existing class through inheritance have a "has-a" relationship.
Question 1 options:
Question 2
A class can only be used as a superclass once.
Question 2 options:
Question 3
A subclass can extend only one superclass.
Question 3 options:
Question 4
A subclass can refer to...
Question 4 options:
the private instance variables of the superclass
the private instance methods of the superclass
the public instance methods of the superclass
none of the above
Question 5
What can an abstract class contain?
Question 5 options:
constructors, instance variables, instance methods, abstract methods, static methods, static variables
constructors, instance variables, instance methods, abstract methods,
abstract methods, static methods, static variables
instance variables, instance methods, abstract method
Question 6
What is the use of the keyword super in a subclass?
Question 6 options:
It provides access to the constructor of the superclass.
It provides access to an instance method of the superclass.
It provides access to a public instance variable of the superclass.
All of the above.
None of the above
Question 7
What is the purpose of a constructor in a subclass.
Question 7 options:
To initialize value of the subclasses' private and public instance variable through assignment statements (eg. this.x = 1)
To initialize the value of the subclasses' public and private instance variables and the superclasses' private and public instance variables through assignment statements. (super.x = 1; this.y = 2)
To use a super constructor to initialize the value of the superclasses' instance variables.
To initialize value of the subclasses' private and public instance variable through assignment statements (eg. this.x = 1) and
use a super constructor to initialize the value of the superclasses' instance variables.
Question 8
Abstract classes can not be instantiated.
Question 8 options:
Question 9
Which of the following is a correct implementation of polymorphism. Note, object B extends object A.
Question 9 options:
B obj1 = new A();
A ob1 = new A();
B obj1 = new B();
A obj1 = new B();
Question 10
Interfaces differ from Abstract class because:
Question 10 options:
a class can implement many interfaces, but can only extend one abstract class
abstract classes create a hierarchy but interfaces do not
interfaces can only contain abstract methods and no implementations
all of the above
Question 11
Given this code snippet,
what will this program print?
Question 11 options:
This code causes an error.
Mike
Mike
Bob
Bob
Mike
Mike
Bob
Bob
Mike
Bob
Question 12
Based on this code snippet
what does this program output?
Question 12 options:
Shape Rectangle Rectangle Circle
Shape Shape Shape Shape
Shape Shape Shape Circle
This code will error
Shape Rectangle Square Circle
Shape Rectangle Rectangle Oval
True FalseExplanation / Answer
Question 1 Answer) False
Explanation:- derived classes have a "is-a" relationship
Question 2 Answer) False
Explanation:- A class can be used as a superclass any number of times
Question 3 Answer) True
Question 4 Answer) the public instance methods of the superclass
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.