Exam 9: Inheritance and Interfaces
Exam 1: Introduction96 Questions
Exam 2: Fundamental Data Types103 Questions
Exam 3: Decisionseasy99 Questions
Exam 4: Loops100 Questions
Exam 5: Methods94 Questions
Exam 6: Arrays and Arraylists100 Questions
Exam 7: Inputoutput and Exception Handling100 Questions
Exam 8: Objects and Classes101 Questions
Exam 9: Inheritance and Interfaces99 Questions
Exam 10: Graphical User Interfaces54 Questions
Exam 11: Advanced User Interfaces91 Questions
Exam 12: Object-Oriented Design100 Questions
Exam 13: Recursion100 Questions
Exam 14: Sorting and Searching99 Questions
Exam 15: The Java Collections Framework100 Questions
Exam 16: Basic Data Structures94 Questions
Exam 17: Tree Structures100 Questions
Exam 18: Generic Classes78 Questions
Exam 19: Streams and Binary Inputoutput82 Questions
Exam 20: Multithreading82 Questions
Exam 21: Internet Networking74 Questions
Exam 22: Relational Databases75 Questions
Exam 23: XML74 Questions
Exam 24: Web Applications74 Questions
Select questions type
Consider the following code snippet:
Public class Employee
{
) . .
Public void setDepartment(String deptName)
{
) . .
}
}
Public class Programmer extends Employee
{
) . .
Public void setProjectName(String projName)
{
) . .
}
Public void setDepartment(String deptName)
{
) . .
}
}
Which of the following statements is NOT correct?
(Multiple Choice)
4.8/5
(35)
To override a superclass method in a subclass, the subclass method ____.
(Multiple Choice)
4.8/5
(43)
Consider the following code snippet that appears in a subclass:
Public void deposit(double amount)
{
TransactionCount ++;
Deposit(amount);
}
Which of the following statements is true?
(Multiple Choice)
4.9/5
(35)
If a class has an abstract method, which of the following statements is NOT true?
(Multiple Choice)
4.7/5
(46)
Consider the following code snippet:
Public class Vehicle
{
) . .
Public void setVehicleClass(double numberAxles)
{
) . .
}
}
Public class Auto extends Vehicle
{
) . .
Public void setVehicleClass(int numberAxles)
{
) . .
}
}
Which of the following statements is correct?
(Multiple Choice)
4.7/5
(33)
Which of the following can potentially be changed when implementing an interface?
(Multiple Choice)
4.8/5
(42)
Consider the following code snippet:
Employee programmer = new Employee(10254, "exempt");
String s = programmer.toString();
Assume that the Employee class has not implemented its own toString() method. What value will s contain when this code is executed?
(Multiple Choice)
4.8/5
(35)
Consider the following code snippet:
Employee anEmployee = new Programmer();
AnEmployee.increaseSalary(2500);
Assume that 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 class's increaseSalary method is to be executed is determined by ____.
(Multiple Choice)
4.9/5
(41)
Consider the following code snippet:
Public class Vessel
{
) . .
Public void setVesselAtrributes()
{
) . .
}
}
Public class Speedboat extends Vessel
{
) . .
Public void setVesselAtrributes()
{
) . .
}
}
Which of the following statements is correct?
(Multiple Choice)
4.8/5
(37)
You are creating a Motorcycle class that is supposed to be a subclass of the Vehicle class. Which of the following class declaration statements will accomplish this?
(Multiple Choice)
4.9/5
(30)
Consider the following code snippet:
Public interface Sizable
{
Int LARGE_CHANGE = 100;
Int SMALL_CHANGE = 20;
Void changeSize();
}
Which of the following statements is true?
(Multiple Choice)
4.9/5
(38)
Consider the following code snippet:
Public class Vessel
{
Private String manufacturer;
) . .
Public void setVesselClass(double engineRPM)
{
) . .
}
}
If a Speedboat class is created as a subclass of the Vessel class, which of the following statements is correct?
(Multiple Choice)
4.8/5
(35)
Consider the following code snippet:
Public class Coin
{
Private String name;
) . .
Public boolean equals(Object otherCoin)
{
Return name.equals(otherCoin.name);
}
) . .
}
What is wrong with this code?
(Multiple Choice)
4.8/5
(38)
Insert the missing code in the following code fragment. This fragment is intended to call the Vessel class's method.
Public class Vessel
{
) . .
Public void set VesselClass(double vesselLength)
{
) . .
}
}
Public class SpeedBoat extends Vessel
{
) . .
Public SpeedBoat()
{
_______________;
}
}
(Multiple Choice)
4.9/5
(38)
Which of the following could be used in place of an interface to handle operations on different classes?
(Multiple Choice)
4.8/5
(37)
Which of the following statements about an interface is true?
(Multiple Choice)
4.9/5
(34)
Consider the following code snippet:
Public interface Sizable
{
Int LARGE_CHANGE = 100;
Void changeSize();
}
Which of the following indicates how to use the constant LARGE_CHANGE in your program?
(Multiple Choice)
4.7/5
(38)
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
(30)
The ____ reserved word in a method definition ensures that subclasses cannot override this method.
(Multiple Choice)
4.7/5
(39)
Showing 61 - 80 of 99
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)