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 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?
Free
(Multiple Choice)
4.9/5
(42)
Correct Answer:
D
A method that has no implementation is called a/an ____ method.
Free
(Multiple Choice)
4.9/5
(45)
Correct Answer:
D
You are creating a Motorcycle class which is supposed to use an interface named Measurable. Which of the following class declaration statements will accomplish this?
Free
(Multiple Choice)
4.9/5
(41)
Correct Answer:
B
Which of the following indicates that the Motorcycle class is a subclass of the Vehicle class?
(Multiple Choice)
4.9/5
(42)
A class from which you cannot create objects is called a/an ____.
(Multiple Choice)
4.9/5
(33)
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.7/5
(35)
You are creating a Vessel class which is supposed to use an interface named Measurable. Which of the following class declaration statements will accomplish this?
(Multiple Choice)
4.7/5
(44)
With a few exceptions, instance variables of classes should always have ___ access.
(Multiple Choice)
4.8/5
(40)
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.9/5
(39)
Consider the following code snippet:
Public class BankAccount implements Comparable<BankAccount>
{ . . .
Public int compareTo(T other)
{
What is wrong with this code?
(Multiple Choice)
4.9/5
(32)
Consider the following code snippet:
Public class Score
{
Private String name;
) . .
Public boolean equals(Object otherScore)
{
Return name.equals(otherScore.name);
}
) . .
}
What is wrong with this code?
(Multiple Choice)
4.8/5
(41)
To ensure that an instance variable can only be accessed by the class that declared it, the variable should be declared as ____.
(Multiple Choice)
5.0/5
(35)
Consider the following code snippet:
Public class Coin
{
) . .
Public boolean equals(Coin otherCoin)
{
) . .
}
) . .
}
What is wrong with this code?
(Multiple Choice)
4.8/5
(33)
When declared as protected, data in an object can be accessed by ____.
(Multiple Choice)
4.7/5
(44)
Consider the following code snippet:
Public class Motorcycle extends Vehicle
{
Private String model;
) . .
Public Motorcycle(int numberAxles, String modelName)
{
Model = modelName;
Super(numberAxles);
}
}
What does this code do?
(Multiple Choice)
4.9/5
(43)
Consider the following code snippet:
Public interface Sizable
{
Double size;
Double getSize();
}
What is wrong with this code?
(Multiple Choice)
4.8/5
(36)
You are creating a Motorcycle class which is supposed to be a subclass of the Vehicle class. Which of the following class declaration statements will accomplish this?
(Multiple Choice)
4.8/5
(34)
Consider the following code snippet:
Public void deposit(double amount)
{
TransactionCount ++;
Super.deposit(amount);
}
Which of the following statements is true?
(Multiple Choice)
4.9/5
(34)
Showing 1 - 20 of 99
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)