• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

IBM question - Interface

 
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is the question:
Referring to the diagram in Figure Interface, which of the following are true? 2 correct answers(http://certify.torolab.ibm.com/figures/test486F13.gif )
a) Classes "X" and "Y" are subclasses of Mortgageable.
b) Instances of "X" and "Y" can be passed as parameters declared as type Mortgageable.
c) "X" and "Y" must implement a getAppraisedValue() method.
d) There are instances of Mortgageable in the production system.
My answer: a is wrong, b is right.
C, I'd like to say it's right, but "X" and "Y" could be abstract classes which means they don't have to implement the method.
D, might be right.
I guess I'm not sure if it's b,c or b,d.
Please help!


 
author
Posts: 3252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
D, might be right.
Nope, it can't be right - you can't instantiate an interface. Which leaves B and C.
- Peter
 
Ranch Hand
Posts: 1157
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I would lean towards B and C.
A is incorrect, as X and Y cannot be called the subclass of an interface.To be a subclass, it should satisfy "extends" relationship.This relationship is based on "implements".Note that dashed-line specialization indicates that "X" and "Y" are implementing the interface (Chapter 36, Section 36.3, Figure 36.4, Interfaces, Applying UML and Patterns, Craig Larman)
B is correct.We can draw an example from how Collection API is designed.You have java.util.List interface.The ArrayList implementation of this interface has methods/constructor which takes a Collection/List interface as a parameter.
C is correct.Note that "X" and "Y" can't be abstract classes.Abstract classes are indicated by italics in UML (Chapter 28, Section 28.6.1, Applying UML and Patterns, Craig Larman).Hence, "X" and "Y" must implement a getAppraisedValue() method.
D is incorrect.You can never get substantial evidence on the instances of Mortgageable (which means objects of "X" and "Y"!!) in the production system, from the UML artifact.
Hope this helps,
-- Sandeep
[This message has been edited by Desai Sandeep (edited May 16, 2001).]
 
Caroline Iux
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Desai Sandeep:

C is correct.Note that "X" and "Y" can't be abstract classes.Abstract classes are indicated by italics in UML


Absolutly true. Now I can see b,c is the right choice. Thanks!
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic