Exam 10: Inheritance and Polymorphism
Exam 1: An Overview of Computers and Programming Languages50 Questions
Exam 2: Basic Elements of Java50 Questions
Exam 3: Introduction to Objects and Inputoutput50 Questions
Exam 4: Control Structures I: Selection50 Questions
Exam 5: Control Structures II: Repetition50 Questions
Exam 6: Graphical User Interface Gui and Object-Oriented Design OOD50 Questions
Exam 7: User-Defined Methods50 Questions
Exam 8: User-Defined Classes and Adts50 Questions
Exam 9: Arrays50 Questions
Exam 10: Inheritance and Polymorphism50 Questions
Exam 11: Handling Exceptions and Events50 Questions
Exam 12: Advanced Guis and Graphics49 Questions
Exam 13: Recursion50 Questions
Exam 14: Searching and Sorting50 Questions
Select questions type
The superclass inherits all its properties from the subclass.
Free
(True/False)
4.9/5
(34)
Correct Answer:
False
To determine whether a reference variable that points to an object is of a particular class type, Java provides the operator instanceof.
Free
(True/False)
4.9/5
(36)
Correct Answer:
True
Consider the following class definitions. public class BClass {private int x; public void set(int a) {x = a;} public void print() {System.out.print(x);}} public class DClass extends BClass {private int y; public void set(int a, int b) {//Postcondition: x = a; y = b;} public void print(){ }} Which of the following correctly redefines the method print of DClass? (i) public void print() {System.out.print(x + " " + y);} (ii) public void print() {super.print(); System.out.print(" " + y);}
Free
(Multiple Choice)
4.8/5
(33)
Correct Answer:
B
Suppose that the class Mystery is derived from the class Secret. Consider the following statements. Secret mySecret = new Secret(); Secret secRef; Mystery myMystery = new Mystery(); Mystery mysRef; secRef = myMystery; Which of the following statements is legal in Java? (i) mysRef = (Mystery) mySecret; (ii) mysRef = (Mystery) secRef;
(Multiple Choice)
4.8/5
(31)
Suppose that the class Mystery is derived from the class Secret. The following statements are legal in Java. Secret secRef; Mystery mysRef = new Mystery(); secRef = mysRef;
(True/False)
4.9/5
(35)
A subclass inherits all its data members from the superclass; it has none of its own.
(True/False)
4.9/5
(44)
The classes Reader and Writer are derived from the class ____.
(Multiple Choice)
4.9/5
(45)
In Java, stream classes are implemented using the inheritance mechanism.
(True/False)
4.9/5
(28)
Interfaces are defined using the reserved word interface and the reserved word class.
(True/False)
4.8/5
(49)
An abstract method is a method that has only the heading with no body.
(True/False)
4.9/5
(47)
If class Dog has a subclass Retriever, which of the following is true?
(Multiple Choice)
4.9/5
(32)
A subclass can directly access protected members of a superclass.
(True/False)
4.9/5
(30)
The class Object is directly or indirectly the superclass of every class in Java.
(True/False)
4.8/5
(36)
-Based on the diagram in the accompanying figure, which of the following members will Box NOT have direct access to?

(Multiple Choice)
4.8/5
(37)
Showing 1 - 20 of 50
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)