x
Info
x
Warning
x
Danger
 / 
 / 
 / 
Multiple Choice Use the UML diagram for the Trees hierarchy which

Question : Multiple Choice Use the UML diagram for the Trees hierarchy which : 2043803

Multiple Choice

Use the UML diagram for the Trees hierarchy which is attached to answer questions 1 through 5.

  1.    If we have a variable whose declared type is Tree and actual type is Maple, what messages can it perform?
    1.                Only grow.
    2.                All of the methods for class Maple, and for class Deciduous, and for class Tree.
    3.                Only the methods for class Maple
    4.                Only the methods for class Tree and for class Maple, but not the methods for class Deciduous.

  1.    If we have an object whose declared type is Tree and actual type is Oak that is passed the message dropLeaves, which dropLeaves method will it perform?
    1.                The dropLeaves method declared in class Deciduous
    2.                The dropLeaves method declared in class Oak
    3.                The dropLeaves method declared in class Maple
    4.                None of the above answers are correct because sending a dropLeaves message to this object is not valid.
  2.    If we have an object whose declared type is Conifer and actual type is Pine that is passed the message dropCones, which dropCones method will it perform?
    1.                The dropCones method declared in class Conifer
    2.                The dropCones method declared in class Pine
    3.                The dropCones method declared in class Spruce
    4.                None of the above answers are correct because sending a dropCones message to this object is not valid.

  1.    If we have an object whose declared type is Deciduous and actual type is Maple, which grow method will it perform?
    1.                The one which is defined in class Tree
    2.                The one which is defined in class Deciduous
    3.                The one which is defined in class Maple
    4.                None of the above answers are correct because sending a grow message to this object is not valid.
  2.    If we have an object whose declared type is Deciduous and actual type is Oak, which is passed the message changeColor(java.awt.Color.ORANGE), which changeColor method will it use?
    1.                The one which is defined in class Tree
    2.                The one which is defined in class Deciduous
    3.                The one which is defined in class Oak
    4.                None of the above answers are correct because sending a changeColor message with actual parameter java.awt.Color.ORANGE is not valid for this object.
  3.    If a method has a parameter of type Colorable that is passed an object of type WagonBody, which of the following messages are valid for it to receive?
    1.                Only the methods defined in Wagon
    2.                Only the methods defined in Wagon Body
    3.                Only the methods defined in both Rectangle and WagonBody
    4.                Only the methods defined in Colorable

  1.    If an object is declared type Draggable and actual type Wheel the message mouseDragged will be bound to which of the following mouseDragged methods?
    1.                The one defined in Ellipse
    2.                The one defined in Wheel
    3.                The one defined in Wagon
    4.                None of the above will be bound to the object by the message mouseDragged.

  1.    If an object is declared type Colorable and actual type WagonBody the message setColor will be bound to which of the following setColor methods?
    1.                The one defined in Wagon
    2.                The one defined in Colorable
    3.                The one defined in Rectangle
    4.                None of the above answers are correct because sending a setColor message to this object is not valid.
  2.    If an object is declared type Draggable and actual type Wagon the message move will be bound to which of the following move methods?
    1.                The one defined in Draggable
    2.                The one defined in WagonBody
    3.                The one defined in Wheel
    4.                The one defined in Wagon

  1. If a variable object1 is declared type Draggable which of the following instantiations is not valid?
    1.                object1 = new Draggable();
    2.                object1 = new Wagon();
    3.                object1 = new Wheel();
    4.                object1 = new WagonBody();

Solution
5 (1 Ratings )

Solved
Computer Science 3 Years Ago 174 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