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

CY-305 Object Oriented Programming and Methodology - Jun 2024 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
    aDescribe the various control statement with example.
    How to answer
    • Classification into selection (if, if-else, switch), iteration (for, while, do-while), and jump (break, continue, goto, return)
    • Syntax and purpose of each statement type
    • Code snippets or simple code examples for each category
  2. 7 Marks
    bDiscuss and compare run time and compile time polymorphism.
    How to answer
    • Definition of polymorphism and its two primary types
    • Explanation of compile-time polymorphism (function overloading, operator overloading)
    • Explanation of run-time polymorphism (virtual functions, function overriding)
    • Comparison table based on binding time, execution speed, and mechanism
  3. 7 Marks
    aWhat is meant by abstract class?
    How to answer
    • Definition of abstract class (a class that cannot be instantiated directly)
    • Concept of pure virtual functions ($=0$ in C++)
    • Role as a base class/interface for derived classes
    • Short syntax/declaration example
  4. 7 Marks
    bWhat is constructor? Is it mandatory to use constructor in a class.
    How to answer
    • Definition and properties of a constructor (special member function with class name, no return type)
    • Types of constructors (default, parameterized, copy)
    • Explanation of whether it is mandatory (not strictly mandatory to define manually, as the compiler supplies a default constructor if none is declared)
  5. 7 Marks
    aExplain public, private and protected access specifiers and show their visibility when they are inherited as public, private and protected?
    How to answer
    • Definitions of public, private, and protected visibility within a class
    • Inheritance access table showing base class members vs derivation modes (public, protected, private)
    • Explanation of accessibility of inherited members in derived classes and from objects
  6. 7 Marks
    bDefine operator overloading? Explain how to overload unary operator and binary operator?
    How to answer
    • Definition of operator overloading and syntax of `operator` function
    • Overloading unary operator (syntax, member vs friend function, parameter rules, example like `++` or `-`)
    • Overloading binary operator (syntax, parameters required, example like `+` or `==`)
  7. 14 Marks
    Write short notes on (any two): i) Exception handling ii) New and delete iii) Polymorphism
    How to answer
    • Exception handling: try, catch, and throw blocks mechanism and advantages
    • New and delete: Dynamic memory management in C++, allocation and deallocation of single objects and arrays
    • Polymorphism: Concept of multiple forms, compile-time vs run-time mechanisms
  8. 7 Marks
    aWhat do you mean by Array Index Out of Bounds Exception and Null Pointer Exception?
    How to answer
    • Definition and cause of ArrayIndexOutOfBoundsException with an example index access
    • Definition and cause of NullPointerException when dereferencing null references/pointers
    • How these exceptions can be avoided or caught
  9. 7 Marks
    bWhat are member functions? Explain with example.
    How to answer
    • Definition of member functions (functions declared inside a class that operate on class data)
    • Defining member functions: inside the class vs outside the class using scope resolution operator (`::`)
    • Example C++ class demonstrating member function declaration, definition, and invocation
  10. 14 Marks
    Write a program having student as an abstract class and create many derived classes such as engineering, science medical etc. from the student class. Create their objects and process them.
    How to answer
    • Declare abstract class `Student` with at least one pure virtual function (e.g., `virtual void process() = 0;`)
    • Derive classes `Engineering`, `Science`, and `Medical`, overriding the pure virtual function
    • Implement `main()` function: create objects or pointers to base class, call member methods
  11. 7 Marks
    aWrite an interactive program for manipulating object of distance class. Support member functions for adding and subtracting distance members of two objects?
    How to answer
    • Define `Distance` class with members (e.g., feet and inches or meters)
    • Implement member functions `add(Distance)` and `subtract(Distance)` handling unit normalization
    • Provide interactive user interface in `main()` to input distances, perform operations, and display results
  12. 7 Marks
    bExplain virtual function and write its purpose.
    How to answer
    • Definition of virtual function (member function declared with `virtual` keyword in base class)
    • Purpose: Enabling dynamic/late binding and achieving run-time polymorphism
    • Mechanism: Brief mention of vtable and vptr
  13. 14 Marks
    Write short notes on (any two): a) Access modifiers b) Abstract base classes c) Association
    How to answer
    • Access modifiers: public, private, protected keywords restricting scope/visibility of class members
    • Abstract base classes: Base classes designed for inheritance containing pure virtual methods
    • Association: Relationship between two independent classes representing a 'has-a' or 'uses-a' connection without ownership
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