Skip to content
CS-305 · Object Oriented Programming & Methodology/Unsolved PYQ Paper

CS-305 Object Oriented Programming and Methodology - Dec 2023 Question Paper

Under each question, How to answer lists the points an answer should cover, outlined by CampusPrep from the syllabus. Check the details against your textbook.

  1. 7 Marks
    aWhat do you understand by Object Oriented Programming? What are the advantages of programming using object oriented? Explain and define various OOP concepts in brief.
    How to answer
    • Definition of Object Oriented Programming (OOP) paradigm based on objects containing data and code.
    • List key advantages: code reusability, modularity, data hiding/security, maintainability, easier problem mapping.
    • Briefly explain core concepts: Class, Object, Encapsulation, Abstraction, Inheritance, Polymorphism, and Message Passing.
  2. 7 Marks
    bHow procedure oriented programming approach is different with object oriented programming approach?
    How to answer
    • Tabular comparison between POP and OOP.
    • Core differences: Data vs Function focus, Bottom-up vs Top-down approach.
    • Security aspects: Data hiding in OOP vs global data access in POP.
    • Code reusability via inheritance in OOP vs functions in POP.
  3. 7 Marks
    aDraw and explain object diagram for hospital management system.
    How to answer
    • Draw UML object diagram showing instances (e.g., d1: Doctor, p1: Patient, r1: Room, b1: Bill, rec1: MedicalRecord).
    • Depict links/associations between objects with specific attribute values.
    • Explain key relationships and how objects interact within the hospital management system context.
  4. 7 Marks
    bExplain object model with example of ATM of a bank.
    How to answer
    • Define the object model and its role in software design (identifying classes, objects, attributes, operations).
    • Identify classes for ATM: ATM, Bank, Account, CardReader, CashDispenser, Customer, Transaction.
    • Draw and explain relationships (association, aggregation, inheritance) between these classes.
  5. 7 Marks
    aHow can we implement aggregation in OOP? Explain with an example.
    How to answer
    • Define Aggregation as a specialized form of association representing a 'HAS-A' relationship (weak containment).
    • Explain key characteristic: child can exist independently of parent.
    • Provide a code example in C++ (e.g., Class Address inside Class Employee using pointers/references).
    • Contrast briefly with composition (strong containment).
  6. 7 Marks
    bDiscuss and compare run time polymorphism and compile time polymorphism.
    How to answer
    • Define compile-time polymorphism (static binding/early binding) and mechanisms (function overloading, operator overloading).
    • Define run-time polymorphism (dynamic binding/late binding) achieved using inheritance and virtual functions.
    • Comparison table highlighting: Binding time, speed/overhead, flexibility, and implementation details.
  7. 7 Marks
    aWhat is constructor and destructor function? Explain with an example.
    How to answer
    • Define constructor: special member function with the same name as the class, invoked automatically upon object creation to initialize data.
    • Define destructor: special member function prefixed with tilde (~), invoked automatically when object goes out of scope to release resources.
    • Provide a concise C++ code example demonstrating both constructor and destructor calls.
  8. 7 Marks
    bUsing the concept of function overloading write a program in C++ to find the maximum of three integer numbers.
    How to answer
    • Brief explanation of function overloading principle (same function name, different parameter lists).
    • Write C++ code with overloaded `max` functions (e.g., `int max(int a, int b)` and `int max(int a, int b, int c)`).
    • Write `main()` function reading three integers, calling the overloaded function, and displaying the result.
  9. 14 Marks
    Differentiate between: a) Virtual and Pure virtual function b) Generalization and Specialization c) Encapsulation and Inheritance d) Function overloading and Function overriding
    How to answer
    • a) Virtual vs Pure virtual function: definition body vs '= 0', instantiability of base class vs abstract class.
    • b) Generalization vs Specialization: bottom-up extracting common features vs top-down creating specialized sub-entities.
    • c) Encapsulation vs Inheritance: binding data and functions together for data hiding vs acquiring properties from a base class for code reuse.
    • d) Function overloading vs Function overriding: same scope, different signatures, compile-time vs derived class scope, same signature, run-time.
  10. 7 Marks
    aWhat do you mean by exception? How exception is handled in C++? Explain with the help of an example?
    How to answer
    • Define exception as an unexpected runtime condition or error disrupting normal program flow.
    • Explain C++ exception handling mechanism using keywords: `try`, `catch`, and `throw`.
    • Provide a code example (e.g., division by zero) showing `try`, `throw`, and `catch` blocks.
  11. 7 Marks
    bWhat is Association? Explain the various forms of Association.
    How to answer
    • Define Association as a structural relationship between classes where objects communicate.
    • Explain forms/types: Uni-directional, Bi-directional, Reflexive/Unary, and specialized forms (Aggregation and Composition).
    • Mention multiplicity/cardinality (one-to-one, one-to-many, many-to-many) with simple UML notations.
  12. 7 Marks
    aWhat is Multithreading? Discuss its importance and application in OOP.
    How to answer
    • Define Multithreading: concurrent execution of two or more threads within a single process.
    • Discuss importance: maximum CPU utilization, responsiveness, parallel execution, improved resource sharing.
    • Explain applications in OOP: GUI applications, web servers, gaming, real-time simulation, concurrent data processing.
  13. 7 Marks
    bWhat is an abstract class in OOP and how do we implement it? Explain with an example.
    How to answer
    • Define abstract class: a class containing at least one pure virtual function that cannot be directly instantiated.
    • Explain implementation: declaring `= 0` in C++, requiring derived classes to override it.
    • Provide a C++ code example (e.g., base class `Shape` with pure virtual function `draw()`, derived classes `Circle` and `Rectangle`).
  14. 14 Marks
    Write short notes: a) Access modifiers b) Abstraction c) Interfaces d) String Handling in OOP
    How to answer
    • a) Access modifiers: public, private, protected keywords controlling visibility and accessibility of class members.
    • b) Abstraction: displaying only essential features while hiding internal implementation details.
    • c) Interfaces: blueprint of a class containing only abstract methods (pure virtual functions in C++), enabling loose coupling and multiple inheritance.
    • d) String Handling in OOP: string classes (e.g., `std::string` in C++) offering dynamic memory management, member functions, and overloaded operators (+, ==, etc.).
Go to where you left off?

Quick Add to Notes

Save questions, your own notes and screenshots into notes filed by unit. It takes a free account.

Create free account

Have an account? Log in