Exam 9: Inheritance

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

Consider the following code snippet: Consider the following code snippet:   Which of the following statements is correct? Which of the following statements is correct?

(Multiple Choice)
5.0/5
(37)

Suppose the abstract class Message is defined below Suppose the abstract class Message is defined below   A concrete subclass of Message, called FrenchMessage, is defined.Which methods must FrenchMessage define? A concrete subclass of Message, called FrenchMessage, is defined.Which methods must FrenchMessage define?

(Multiple Choice)
4.8/5
(28)

What reserved word in a method definition ensures that subclasses cannot override the method?

(Multiple Choice)
4.9/5
(38)

Consider the Counter class below. Consider the Counter class below.

(Multiple Choice)
4.8/5
(33)

Consider the following code snippet: Consider the following code snippet:   What is wrong with this code? What is wrong with this code?

(Multiple Choice)
4.9/5
(41)

Consider the following code snippet: Consider the following code snippet:   What does this code do? What does this code do?

(Multiple Choice)
4.9/5
(33)

Consider the hierarchy of classes shown below. Consider the hierarchy of classes shown below.   What is the superclass of the class TelevisionShow? What is the superclass of the class TelevisionShow?

(Multiple Choice)
5.0/5
(42)

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.9/5
(28)

Consider the following code snippet: Consider the following code snippet:   If the Programmer class inherits from the Employee class, and only the Employee class has an implementation of the increaseSalary method, which statement is correct? If the Programmer class inherits from the Employee class, and only the Employee class has an implementation of the increaseSalary method, which statement is correct?

(Multiple Choice)
4.9/5
(37)

Consider the following code snippet: Consider the following code snippet:   Assume that the Programmer class inherits from the Employee class, and only the Employee class has an implementation of the toString() method.Which of the following statements is correct? Assume that the Programmer class inherits from the Employee class, and only the Employee class has an implementation of the toString() method.Which of the following statements is correct?

(Multiple Choice)
4.8/5
(36)

What reserved word in a class definition ensures that subclasses cannot be created from the class?

(Multiple Choice)
4.8/5
(31)

Consider the following code snippet: Consider the following code snippet:

(Multiple Choice)
4.7/5
(37)

Consider the following class hierarchy: Consider the following class hierarchy:   Which of the following code fragments is NOT valid in Java? Which of the following code fragments is NOT valid in Java?

(Multiple Choice)
4.8/5
(42)

Consider the following code snippet: Consider the following code snippet:   What is wrong with this code? A)The return statement should use the == operator instead of the equals method. B)The parameter in the equals method should be declared as Coin otherCoin. C)otherCoin must be cast as a Coin object before using the equals method. D)There is nothing wrong with this code. What is wrong with this code? A)The return statement should use the == operator instead of the equals method. B)The parameter in the equals method should be declared as Coin otherCoin. C)otherCoin must be cast as a Coin object before using the equals method. D)There is nothing wrong with this code.

(Not Answered)
This question doesn't have any answer yet
Ask our community

Consider the classes shown below: Consider the classes shown below:

(Multiple Choice)
4.8/5
(33)

What is the term used for a subclass that defines a method with the same name as a method in its superclass, but with different parameter types?

(Multiple Choice)
4.8/5
(42)

Consider the following code snippet: Consider the following code snippet:   Which of the following statements is true? Which of the following statements is true?

(Multiple Choice)
4.9/5
(36)

Why is the following code, which assumes ChoiceQuestion is a subclass of Question, considered poor strategy? Why is the following code, which assumes ChoiceQuestion is a subclass of Question, considered poor strategy?

(Multiple Choice)
4.9/5
(42)

Consider the classes shown below: Consider the classes shown below:

(Multiple Choice)
4.9/5
(42)

Which of the following statements about classes is true?

(Multiple Choice)
4.8/5
(38)
Showing 21 - 40 of 99
close modal

Filters

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