Object Oriented Programming
CSE · Midterm · Spring 25
Batch ALL
Read the questions as text
Read off the PDF by AI, so it may have mistakes. The PDF is the original.
Daffodil International University
Faculty of Science & Information Technology
Department of Computer Science and Engineering
Midterm Examination, Spring 2025
Course Code: CSE221, Course Title: Object Oriented Programming
Level: 2 Term: 2 Batch: ALL
Time: 1.5 Hours
Marks: 25
Answer ALL Questions
[The figures in the right margin indicate the full marks and corresponding course outcomes. All portions of each question must be answered sequentially.]
1. a) Explain how the concepts of Encapsulation, Inheritance, and Polymorphism contribute to solving real-world problems. Provide one real-world example for each concept demonstrating its application and benefit. | 3 | CO1
1. b) Consider the following UML Class Diagram representing a "University System" where: [Figure: UML Class Diagram showing Department, Professor, and Course classes with associations] | 7 | CO2
- A Department has multiple Professors.
- Each Professor teaches multiple Courses.
- Each Course has a Course Code and Credit Hours.
Task:
- Implement the above scenario in Java by:
- Defining classes Department, Professor, and Course.
- Establishing appropriate association relationships between the classes.
- Implementing methods to:
- Add a professor to a department.
- Assign courses to a professor.
- Display department details, including professors and their assigned courses.
[N.B. Java collection class may be used as needed or simple association]
(Full correct implementation: 7 marks, Partial correctness: 4-5 marks, Minor issues: 2-3 marks)
2. a) Differentiate between a class and an object in Java. Provide suitable Java code snippets to illustrate your answer. | 2 | CO1
2. b) Design a Library Management System where: | 8 | CO2
- The Library contains multiple Books.
- Each Book is associated with one Author.
- The Library manages memberships for Members, who can borrow multiple books.
Task:
- Draw a UML Class Diagram covering the association relationships between the classes Library, Book, Author, and Member.
- Include attributes such as bookTitle, ISBN, authorName, and memberID. [assume appropriate data type]
- Indicate multiplicities for associations. [e.g. 1 to many or 1 to 1 etc]
(Full correct implementation: 8 marks, Partial correctness: 5-6 marks, Minor issues: 3-4 marks)
3. Problem Solving (Analysis & Synthesis Level) | 5 | CO2
Problem Scenario:
You are tasked with designing a system for an Online Shopping Platform. The platform includes:
- A Customer who can place multiple Orders.
- Each Order contains multiple Products.
- Each Product has a productID, productName, and price.
- The Customer has details such as customerID, name, and address.
Task:
- Analyze the problem specification.
- Design a UML Class Diagram to represent the system, ensuring correct association relationships between classes.
- Explain the multiplicity in associations and how the Encapsulation principle can be applied in this context.