Object Oriented Programming
CSE · Midterm · Fall 25
Paper 1 of 4By MD. ABDUR ROUF ROKONSwitch
Paper 1 of 4
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 & Engineering
Midterm Examination, Fall 2025
Course Code: CSE221, Course Title: Object Oriented Programming
Level: 2 Term: 2
Time: 01:30 Hrs
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. | Explain the concepts of classes and objects in Java (or OOP) with suitable real-life examples, illustrating how they represent real-world entities and their characteristics. | 03 | CO1
2. | Predict the output of the following program below.
class A {
A() {
System.out.println("A's Constructor");
}
void show() {
System.out.println("Show from A");
}
}
class B extends A {
B() {
System.out.println("B's Constructor");
}
void show() {
System.out.println("Show from B");
}
}
public class Test {
public static void main(String[] args) {
A obj = new B();
obj.show();
}
}
| 02 | CO2
3. a) | A financial organization is developing a Banking Transaction System using Object-Oriented Programming concepts to efficiently manage customer accounts. Each Account includes attributes such as accountNo, holderName, and balance, along with methods to deposit and withdraw money. To handle specialized account operations, the organization introduces a single subclass, SavingsAccount, which extends Account by adding an additional attribute interestRate and a method calculateInterest() that computes and adds interest to the account balance. Now draw a UML Class Diagram to represent the attributes, methods, and single inheritance relationship between the Account and SavingsAccount classes | 05 | CO3
3. b) | In a Ride Fare Estimation System, the company needs to calculate ride fares under different conditions such as fixed fare and discounted fare for special customers. Analyze the scenario and identify a suitable Object-Oriented programming concept that can make the fare calculation more flexible and reusable. Then, write a short Java code snippet to demonstrate your identified concept. | 03 | CO3
4. a) | A software company is developing a Smart Transportation Management System using Object-Oriented Programming concepts to efficiently manage information about different types of vehicles such as Car and ElectricCar. Each Vehicle possesses attributes like vehicleNo, brand, and mileage. The Car class inherits from Vehicle and introduces an additional attribute fuelType along with a method displayDetails() that presents the car's information. Furthermore, the ElectricCar class extends the Car class by adding a new attribute batteryCapacity and overrides the displayDetails() method to incorporate battery-related details
* Demonstrate the inheritance in the above scenario.
* Use method overriding to redefine the displayDetails() method.
* In your main() method, create an object of ElectricCar and display its details. | 10 | CO2
4. b) | Explain conceptually how inheritance in this scenario allows method access and reuse. | 02 | CO2