Exam 10: Polymorphism

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

Which of the following GUI components would you use to allow the user to select between a range of numeric alternatives?

(Multiple Choice)
4.8/5
(27)

Which of the following is a listener class for a JSlider?

(Multiple Choice)
4.7/5
(37)

Why is it almost always a good idea to implement a toString( ) method when you define a class?

(Essay)
5.0/5
(37)

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
(40)

Polymorphism is achieved by

(Multiple Choice)
4.9/5
(35)

The type of the reference, not the type of the object, is use to determine which version of a method is invoked in a polymorphic reference.

(True/False)
4.9/5
(42)

What does the following code do? Assume list is an array of int values, temp is some previously initialized int value, and c is an int initialized to 0. For (j=0; j < list.length; j++) If (list[j] < temp) c++;

(Multiple Choice)
4.9/5
(31)

Comparing the performance of selection sort and insertion sort, what can one say?

(Multiple Choice)
4.8/5
(43)

What is printed by the following code? public class Inherit { abstract class Speaker { abstract public void speak( ); } class Cat extends Speaker { public void speak( ) { System.out.println("Woof!"); } } class Dog extends Speaker { public void speak( ) { System.out.println("Meow!"); } } Inherit( ) { Speaker d = new Dog( ); Speaker c = new Cat( ); d.speak( ); c.speak( ); } public static void main(String[ ] args) { new Inherit( ); } }

(Multiple Choice)
4.9/5
(40)

Although insertion sort and selection sort have generally the same O(n²) performance, selection sort has an advantage of insertion sort. What is this advantage?

(Multiple Choice)
4.8/5
(33)
Showing 61 - 70 of 70
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)