10 Total Mark: 10 X 1 10: NPTEL Online Certification Courses Indian Institute of Technology Kharagpur
10 Total Mark: 10 X 1 10: NPTEL Online Certification Courses Indian Institute of Technology Kharagpur
10 Total Mark: 10 X 1 10: NPTEL Online Certification Courses Indian Institute of Technology Kharagpur
For each of the following questions one or more of the given options are correct. Choose the
correct options.
QUESTION 1:
Consider the following statement taken from the requirements specification of an a student
academic grade computation software: "A student is either a postgraduate student or an
undergraduate student." Assuming that the relevant classes present in the design solution are
Student, PGStudent, and UGStudent, what can be said about the relationship between the two
classes Student and UGStudent?
a. Association
b. Generalization-specialization
c. Containment
d. Polymorphism
e. Dependency
QUESTION 2:
Consider the following sentence: “A rupee consists of 100 paisa”. From an analysis of the sentence,
identify the relation between the two classes Paisa and Rupee that can be inferred from the
sentence.
a. Inheritance
b. Association
c. Dependency
d. Aggregation
e. Composition
Detailed Solution:
QUESTION 3:
Consider the sentence: “A college has many Students.” Which one of the following best
characterizes the relationship between the College class and the Student class?
a. Inheritance
b. Specialization
c. Association
d. Composition
e. Dependency
Detailed Solution:
There is an association relationship between College class and Student class.
NPTEL Online Certification Courses
Indian Institute of Technology Kharagpur
QUESTION 4:
Which one of the following can be said about the links existing between the objects of the Student
and Book classes?
a. Links between objects of the two classes Student and Book get defined during
system initialization and do not change thereafter during system run
b. Links between the objects of the two classes Student and Book usually get
dynamically formed and resolved as system execution proceeds
c. Links between objects belonging to the two classes Student and Book are
statically defined during compile time
d. Links between objects belonging to the two classes Student and Book are
statically defined during compile time but may change during runtime
e. Links between objects belonging to the two classes Student and Book can form
during program execution, but none of the links gets dissolved
Correct Answer: b. Links between the objects of the two classes Student and Book usually get
dynamically formed and resolved as system execution proceeds
Detailed Solution:
As a student can borrow many books, links between the objects of the two classes Student and
Book usually get dynamically formed and resolved as system execution proceeds.
QUESTION 5:
Consider the following programming situation. A certain class C1 has a method whose parameter
list includes an object of class C2 as a parameter. Which one of the following types of relations
exists between the classes C1 and C2?
a. Inheritance
b. Aggregation
c. Dependency
d. Composition
e. Association
Detailed Solution:
There is a dependency relation between C1 and C2. Please refer slide 52 of week 3 lecture material
for more information with example.
NPTEL Online Certification Courses
Indian Institute of Technology Kharagpur
QUESTION 6:
Which one of the following class diagrams corresponds to the given code.
a. A
b. B
c. C
d. D
e. Both C and D
Correct Answer: a. A
Detailed Solution:
Figure A represents the give code segment. Please refer slide 19 of week 3 lecture material for
more details.
NPTEL Online Certification Courses
Indian Institute of Technology Kharagpur
QUESTION 7:
Consider the statement: "An employee is either a worker or a manager." Assuming that Employee
and Manager to be two classes, what can be said about the relationship between these two classes?
a. Association
b. Generalization-specialization
c. Containment
d. Polymorphism
e. Aggregation
QUESTION 8:
Consider the sentence: “A book has many pages”. Which of the following best characterizes the
relationship between the Book class and the Page class?
a. Inheritance
b. Specialization
c. Composition
d. Association
e. Dependency
QUESTION 9:
This class diagram is equivalent to which one of the following class diagrams.
a. A
b. B
c. C
d. D
e. Both C and D
Correct Answer: a. A
Detailed Solution:
Association classes are implemented as shown in figure A for the given diagram. Please refer slide
18 of week 3 lecture material for more details.
NPTEL Online Certification Courses
Indian Institute of Technology Kharagpur
QUESTION 10:
Consider that the class Student is associated to the class Course. A Java program implementing the
classes is given below.
From this diagram, the multiplicity of the association at the Course end of the class diagram can be
most appropriately be inferred to be which one of the following.
a. 300
b. 1..300
c. 5..300
d. 6
e. 1..5
Detailed Solution:
From the code segment, it can be inferred that a student can enroll up to 5 courses. Therefore, the
cardinality as Course class is 1..5.
************END***********