Exam 10: Polymorphism
Exam 1: Introduction64 Questions
Exam 2: Data and Expressions67 Questions
Exam 3: Using Classes and Objects49 Questions
Exam 4: Writing Classes53 Questions
Exam 5: Conditionals and Loops38 Questions
Exam 6: More Conditionals and Loops35 Questions
Exam 7: Object-Oriented Design44 Questions
Exam 8: Arrays45 Questions
Exam 9: Inheritance49 Questions
Exam 10: Polymorphism40 Questions
Exam 11: Exceptions39 Questions
Exam 12: Recursion55 Questions
Exam 13: Collections60 Questions
Select questions type
If you instantiate an abstract class, the class or object you wind up with
Free
(Multiple Choice)
4.9/5
(36)
Correct Answer:
E
A reference variable can refer to any object created from any class related to it by inheritance.
Free
(True/False)
4.9/5
(37)
Correct Answer:
True
One of the advantages of the linear search is that it does not require its data to be sorted.
Free
(True/False)
4.8/5
(38)
Correct Answer:
True
Code Example Ch 10-1
An int array stores the following values:
9 4 12 2 6 8 18
-Refer to Code Example Ch 10-1: Which of the following lists of numbers would accurately show the array after the first pass of the selection sort algorithm?
(Multiple Choice)
4.9/5
(34)
The type of the reference, not the type of the object, is used to determine which version of a method is invoked in a polymorphic reference.
(True/False)
4.9/5
(33)
What kind of performance can you expect if you perform a linear search on a sorted array?
(Multiple Choice)
4.8/5
(38)
A GUI control that allows the user to specify a numeric value within a bounded range is a spinner.
(True/False)
5.0/5
(39)
Both the insertion sort and the selection sort algorithms have efficiencies on the order of ________ where n is the number of values in the array being sorted.
(Multiple Choice)
4.8/5
(37)
Java allows one to create polymorphic references using inheritance and using interfaces.
(True/False)
4.8/5
(37)
Can a program exhibit polymorphism if it only implements early binding?
(Multiple Choice)
4.7/5
(43)
If classes C1 and C2 both implement an interface Cint, which has a method whichIsIt, and if C1 c = new C1(); is performed at one point of the program, then a later instruction
c.whichIsIt(); will invoke the whichIsIt method defined in C1.
(True/False)
5.0/5
(38)
Write an insertion sort method to sort an array of String values (instead of an array of int values). Assume the array is an instance data of the current class called list, and number is an int instance data that stores the number of elements currently stored in list.
(Essay)
4.8/5
(29)
Consider the code shown below. It contains a syntax error, preventing successful compilation and execution. What is the error?
public class Inherit
{
class Figure
{
void display()
{
System.out.println("Figure");
}
}
class Rectangle extends Figure
{
final void display()
{
System.out.println("Rectangle");
}
}
class Box extends Rectangle
{
void display() {
System.out.println("Box");
}
}
Inherit()
{
Figure f = new Figure();
Rectangle r = new Rectangle();
Box b = new Box();
b.display();
}
public static void main(String[] args)
{
new Inherit();
}
}
f.display();
r.display();
(Essay)
4.7/5
(32)
Demonstrate how the following array is sorted using selection sort. Show the array after each pass of the outer loop.
[16, 3, 12, 13, 8, 1, 18, 9]
(Essay)
4.8/5
(42)
The fact that the System.out.println() method is able to handle such a wide variety of objects, and print them correctly, is an example of the polymorphic nature of the println() method.
(True/False)
4.8/5
(27)
Is it possible to use both overloading and overriding in the same method?
(Essay)
4.9/5
(31)
A variable declared to be of one class can later reference an extended class of that class. This variable is known as
(Multiple Choice)
4.8/5
(33)
The spinner GUI control can allow the user to select values that are either numbers or strings.
(True/False)
4.9/5
(42)
Showing 1 - 20 of 40
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)