Exam 9: Inheritance
Exam 1: Introduction98 Questions
Exam 2: Using Objects76 Questions
Exam 3: Implementing Classes103 Questions
Exam 4: Fundamental Data Types125 Questions
Exam 5: Decisions120 Questions
Exam 6: Loops128 Questions
Exam 7: Arrays and Array Lists118 Questions
Exam 8: Designing Classes95 Questions
Exam 9: Inheritance101 Questions
Exam 10: Interfaces85 Questions
Exam 11: Inputoutput and Exception Handling109 Questions
Exam 12: Object-Oriented Design104 Questions
Exam 13: Recursion110 Questions
Exam 14: Sorting and Searching109 Questions
Exam 15: The Java Collections Framework110 Questions
Exam 16: Basic Data Structures104 Questions
Exam 17: Tree Structures110 Questions
Exam 18: Generic Classes75 Questions
Exam 19: Graphical User Interfaces76 Questions
Exam 20: Streams and Binary Inputoutput82 Questions
Exam 21: Multithreading82 Questions
Exam 22: Internet Networking74 Questions
Exam 23: Relational Databases75 Questions
Exam 24: XML74 Questions
Exam 25: Web Applications75 Questions
Select questions type
If a subclass contains a method with the same name as a method in its superclass, but with different parameter types, the subclass method is said to ____ the method of the superclass.
(Multiple Choice)
4.8/5
(38)
Which of the following statements about superclasses and subclasses is true?
(Multiple Choice)
4.8/5
(41)
If a subclass uses the same method name but different parameter types for a method that appears in its superclass, ____.
(Multiple Choice)
4.8/5
(39)
Consider the following code snippet:
Int numAxles = 4;
String s = "Number of axles is " + numAxles;
Which of the following statements is correct?
(Multiple Choice)
4.7/5
(37)
Consider the hierarchy of classes shown below.
Which represent valid class headers that would be found in this hierarchy?

(Multiple Choice)
4.8/5
(38)
Consider the following code snippet: Employee anEmployee = new Programmer();
AnEmployee.increaseSalary(2500);
If the Programmer class inherits from the Employee class, and both classes have an implementation of the increaseSalary method with the same set of parameters and the same return type, which statement is correct?
(Multiple Choice)
4.8/5
(43)
Consider the classes shown below: public class Parent
{
Private int value = 100;
Public int getValue()
{
Return value;
}
}
Public class Child extends Parent
{
Private int value;
Public Child(int number)
{
Value = number;
}
}
What is the output of the following lines of code?
Child kid = new Child(-14);
Child kid2 = new Child(21);
System.out.println(kid.getValue() + " "
+ kid2.getValue());
(Multiple Choice)
4.8/5
(36)
Consider the classes shown below: public class Parent
{
Public int getValue()
{
Return 24;
}
Public void display()
{
System.out.print(getValue() + " ");
}
}
Public class Child extends Parent
{
Public int getValue()
{
Return -7;
}
}
Using the classes above, what is the output of the following lines of code?
Parent kid = new Child();
Parent adult = new Parent();
Kid)display();
Adult.display();
(Multiple Choice)
4.9/5
(27)
You are creating a class inheritance hierarchy about motor vehicles that will contain classes named Vehicle, Auto, and Motorcycle. Which of the following statements is correct?
(Multiple Choice)
4.7/5
(26)
You are creating a Motorcycle class which is supposed to inherit from the Vehicle class. Which of the following class declaration statements will accomplish this?
(Multiple Choice)
4.9/5
(35)
Consider the following class hierarchy: public class Vehicle
{
Private String type;
Public Vehicle(String type)
{
This.type = type;
}
Public String getType()
{
Return type;
}
}
Public class LandVehicle extends Vehicle
{
Public LandVehicle(String type)
{
) . .
}
}
Public class Auto extends LandVehicle
{
Public Auto(String type)
{
) . .
}
}
Which of the following code fragments is NOT valid in Java?
(Multiple Choice)
4.8/5
(32)
Consider the following code snippet: public class Vehicle
{
Private String manufacturer;
) . .
Public void setVehicleClass(double numberAxles)
{
) . .
}
}
If a Motorcycle class is created as a subclass of the Vehicle class, which of the following statements is correct?
(Multiple Choice)
4.8/5
(45)
Consider the following code snippet: public class Auto extends Vehicle
{
) . .
Public Auto(int numberAxles)
{
Super(numberAxles);
}
}
What does this code do?
(Multiple Choice)
4.9/5
(35)
Consider the following class hierarchy: public class Vehicle
{
Private String type;
Public Vehicle(String type)
{
This.type = type;
}
Public String displayInfo()
{
Return type;
}
}
Public class LandVehicle extends Vehicle
{
Public LandVehicle(String type)
{
) . .
}
}
Public class Auto extends LandVehicle
{
Public Auto(String type)
{
) . .
}
Public String displayAutoType()
{
Return _____;
}
}
Complete the code in the Auto class method named displayAutoType to return the type data.
(Multiple Choice)
4.9/5
(37)
Consider the Counter class below. public class Counter
{
Public int count = 0;
Public int getCount()
{
Return count;
}
Public void increment()
{
Count++;
}
}
Using the class above and the variables declared below, what is the value of num1.equals(num2)?
Counter num1 = new Counter();
Counter num2 = num1;
(Multiple Choice)
4.9/5
(31)
With a few exceptions, instance variables of classes should always have ___ access.
(Multiple Choice)
4.9/5
(34)
Consider the following inheritance hierarchy diagram:
Which of the following statements is correct?

(Multiple Choice)
4.9/5
(36)
Suppose the abstract class Message is defined below public abstract class Message {
Private String value;
Public Message(String initial)
{
Value = initial;
}
Public String getMessage()
{
Return value;
}
Public abstract String translate();
}
A concrete subclass of Message, FrenchMessage, is defined. Which methods must FrenchMessage define?
(Multiple Choice)
4.7/5
(39)
Showing 61 - 80 of 101
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)