Time: 2 Hours Maximum Marks: 50
Instructions:
• Attempt all questions.
• Write clean, well-structured, and properly indented code.
• Include comments wherever necessary.
• Demonstrate proper use of OOP principles.
Section A – Core Programming (30 Marks)
Q1. Class & Object + Constructor (10 Marks)
Create a class Student with the following:
– Data members: id, name, marks
– Constructor to initialize values
– Method displayDetails()
In the main method:
– Create at least 3 student objects
– Display their details
Q2. Inheritance & Method Overriding (10 Marks)
Create a class hierarchy:
– Base class: Shape (Method: area())
– Derived classes: Circle (use radius), Rectangle (use length & breadth)
Override area() method in both classes and calculate respective areas.
Q3. Encapsulation + Getter/Setter (10 Marks)
Create a class BankAccount:
– Private variables: accountNumber, balance
– Public methods: deposit(amount), withdraw(amount), getters and setters
In main:
– Perform deposit and withdrawal operations
– Display final balance
Section B – Advanced OOP Concepts (20 Marks)
Q4. Abstract Class / Interface (10 Marks)
Create an interface Vehicle with methods: start(), stop().
Implement it in Car and Bike.
Demonstrate calling methods using interface reference.
Q5. Polymorphism + Dynamic Method Dispatch (10 Marks)
Create a class Employee with method calculateSalary().
Create subclasses FullTimeEmployee and PartTimeEmployee.
Override calculateSalary() and demonstrate dynamic method dispatch.
Bonus (Optional – 5 Marks)
Create a program demonstrating exception handling.
Handle division by zero using try-catch.
Marking Scheme
• Logic & correctness – 20 marks
• Use of OOP concepts – 15 marks
• Code structure & readability – 10 marks
• Output & execution – 5 marks