wood burning stoves 2.0*
The moose likes OO, Patterns, UML and Refactoring and the fly likes IBM ICE Test question #5 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "IBM ICE Test question #5" Watch "IBM ICE Test question #5" New topic
Author

IBM ICE Test question #5

Yingtang Tang
Ranch Hand

Joined: Nov 27, 2001
Posts: 42
I continue the question postings of Ram Dhan Yadav K here. I am very confused about this question. Please offer your answer and understanding here. Thanks.
Q) A partial class diagram of a college course management application is shown in the exhibit. A student knows all of the instructors with whom s/he is registered with. Similarly, an instructor also knows all students who are registered with
him/her. A new requirement is added which specifies that an instructor can also be a student for some ourses. What is the BEST partial application redesign shown in the Figure as linked.
Single Select:
a) Design 'A'
b) Design 'B'
c) Design 'C'
d) Design 'D'
e) Design 'E'
Ram Dhan Yadav K
Ranch Hand

Joined: Aug 13, 2001
Posts: 321
Hi Tang,
In C, the Student and instructor are subclasses of Role. This is the best way of usage of inheritance.
Now a Candidate is associated to Role and that Role can be either student or Instructor or both from the association shown.
Hope this helps!


Ram Dhan Yadav (SCJP, SCWCD, SCJA-I, IBM EC(483))
"We are what we repeatedly do. Excellence, then, is not an act, but a habit."
maya
Greenhorn

Joined: Feb 02, 2002
Posts: 3
I think it would have been less confusing if the subclasses (in C) -- Student and Instructor had been named StudentRole and InstructorRole respectively.


maya
Craig Jackson
Ranch Hand

Joined: Mar 19, 2002
Posts: 405
I believe the answer is design (E). Because of polymophism and inheritance. And what I mean by that is that both the Student and the Instructor are subtypes of the base class Candidate... Therefore Student or Instructor "is a" Candidate.
But also keep in mind the question states a "student knows his/her instructors" and a "instructor knows his/her students" and now an instructor can be a student.
So we need an array or collection to store this information for each student-instructor(s) and instructor-students(s). But since Instructor and Student are Candidates the Array can be of type Candidate(SuperType).
So, Now we can can store those instructors that are also students.
So in my opinion I believe design (E) is the BEST partial application redesign.
Xyz Abx
Greenhorn

Joined: Jan 30, 2002
Posts: 12
The partial class diagram indicates that a student can list his registered instructors and instructor can list his registered students.The new requirement indicates that instructor able to register for other courses, that means Instructor able to list his registered students and registered instructors. Is it correct, if yes how design 'C' & 'E' satify the above requirement. Please correct me if anything goes wrong.
Craig Jackson
Ranch Hand

Joined: Mar 19, 2002
Posts: 405
I just wanted to elaborate more on why I chose design (E) instead of (C) or design (D) which is basically the same as (E).
I chose design (E) because it shows shared-aggregation(unfilled diamond) and design (D) does not.
The reason being is that the composite-whole(Role class) has an operation(getRegisteredCandidate()) that propagates to the aggregate element(Candidate class) and also because of shared-aggregation the aggregate-element(Candidate and any subtypes) does not have to depend on the composite-whole(Role class) for creation or deletion. And also the Candidate class can be referenced elsewhere in the design.
If there is anybody else with a different opinion or an alternate solution, please advise.
craig j.
garth schneider
Ranch Hand

Joined: Mar 20, 2002
Posts: 95
I just about went along with craig on this. But "e" can not be correct. The role class does not identify any one. It also does not allow for multi roles. You are either a instructor or a student not both.
C appears to be right. It has a base candidate class that identifies the individual and has the ablitie to have many roles (arrays of students or instructors for each role).
Xyz Abx
Greenhorn

Joined: Jan 30, 2002
Posts: 12
Hi cj jack,
can you please exaplain me, how design 'E' get the list of registered instructors for Instructor candiate, because instuctor can be register for other courses also, he wants to know what other instructors he registered. Can you also please exaplain me what wrong with design 'A'. Thanks in Advance.
CCR
Craig Jackson
Ranch Hand

Joined: Mar 19, 2002
Posts: 405
After searching the forum for this particular question, I have come to the conclusion that design (E) may not be the best answer. I now can see why design (C) would be the better design, finally. This is one of the harder questions for me to answer.
But hey, my original answer at least sounded good.
craig
Sangeeta Murthy
Greenhorn

Joined: Mar 28, 2002
Posts: 1
Hi,
I think everyone has agreed that C is the answer, but can anyone explain to me why it is not D ?
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: IBM ICE Test question #5
 
Similar Threads
On 486 - Best answers can be incomplete?
IBM question - Student, Instructor
IBM Pre-assessment test - Student,Instructor
Plz explain the answers of these questions
another 486 question -ugh!