x
Info
x
Warning
x
Danger
 / 
 / 
 / 
Multiple Choice    Which of the following appropriately modeled using an

Question : Multiple Choice    Which of the following appropriately modeled using an : 2043793

Multiple Choice

  1.    Which of the following is appropriately modeled using an inheritance hierarchy?
    1.                That an athlete is a person
    2.                That a bird has a wing
    3.                That an employee has a boss
    4.                That an engine is part of a car

  1.    Which is the correct declaration for the class SportsCar?
    1.                public class SportsCar extends Vehicle { . . . }
    2.                public class Vehicle extends SportsCar { . . . }
    3.                public class SportsCar extends Car { . . . }
    4.                public class Car extends Vehicle { . . . }

  1.    If the instance variable declaration, private int _passengers; appears in class Car where would the statement _passengers = 5; be valid?
    1.                in the definition of classes Vehicle and Car.
    2.                in the definition of classes SportsCar and Car.
    3.                in the definition of classes Vehicle, Car, and SportsCar
    4.                only in the definition of class Car.

  1.    If the instance variable declaration, protected java.awt.Color _color; appears in class Vehicle where would the statement _color = java.awt.BLUE; be valid?
    1.                only in the definition of class Vehicle.
    2.                in the definition of classes Vehicle and Car but not in SportsCar.
    3.                in the definition of classes Car and SportsCar but not in Vehicle.
    4.                in the definition of classes Vehicle, Car, and SportsCar.

  1.    Given that each of the three classes has a move method which accepts two integers as parameters, which move method would be invoked by the following statement in the SportsCar class definition.

super.move(5, 0);

  1.                The move method of Vehicle.
  2.                The move method of Car.
  3.                The move method of SportsCar.
  4.                The statement is ambiguous and will result in an error.

  1.    Which class's constructor is invoked by the following statement located in the definition of the Car class.

super();

  1.                The constructor with no parameters of the Vehicle class.
  2.                The constructor with no parameters of the Car class.
  3.                The constructor with no parameters of the SportsCar class.
  4.                This statement does not invoke a constructor.
  1.    What is the purpose of defining an abstract method?
    1.                It provides a default method implementation of that method if the subclasses don't define it.
    2.                It forces all superclasses to define that method with the specified signature if they are not to be abstract classes.
    3.                It forces all subclasses to define that method with the specified signature if they are not to be abstract classes.
    4.                It allows the subclasses of the class from being instantiated.

  1.    The UML symbol which shows that an instance variable or method is protected is:
    1.               
    2.                +
    3.                #
    4.                %

  1.    How do we make an object respond to clicking the mouse while it is on top of the object?
    1.                We don't need to do anything special, it just responds.
    2.                We need to make the object a subclass of the Mouse class.
    3.                We need to make the object a superclass of the Mouse class.
    4.                We need to write a mouseClicked method inside of the class of that object specifying what the object is to do when a mouse click occurs on the object.

  1. The term pseudo-inheritance refers to:
    1.                Subclasses inheriting the private properties of the superclass without "knowing it" or being able to access them directly.
    2.                Superclasses inheriting the private properties of the subclass without "knowing it" or being able to access them directly.
    3.                Subclasses inheriting the methods of the superclass.
    4.                Superclasses inheriting the methods of the subclasses.

Solution
5 (1 Ratings )

Solved
Computer Science 2 Years Ago 170 Views
This Question has Been Answered!
Unlimited Access Free
Explore More than 2 Million+
  • Textbook Solutions
  • Flashcards
  • Homework Answers
  • Documents
Signup for Instant Access!
Ask an Expert
Our Experts can answer your tough homework and study questions
154368 Computer Science Questions Answered!
Post a Question