Skip to content
IT-304 · Object Oriented Programming & Methodology/Unsolved PYQ Paper

IT-304 Object Oriented Programming and Methodology - Dec 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
    aWhat are the unique advantages of an object-oriented programming paradigm?
    How to answer
    • Definition of OOP paradigm
    • Key advantages: modularity, code reusability through inheritance, data security/encapsulation
    • Ease of maintenance and scalability
    • Real-world modeling capability
  2. 7 Marks
    bExplain about call by reference and return by reference with program.
    How to answer
    • Explanation and syntax of call by reference (& operator)
    • Example code for call by reference (e.g., swap function)
    • Explanation and syntax of return by reference
    • Example code showing function call on LHS of assignment
    • Precautions (not returning reference to local variable)
  3. 7 Marks
    aWrite a program to explain the concept of array of objects.
    How to answer
    • Concept and syntax of array of objects: ClassName obj[size];
    • C++ program defining a class (e.g., Student or Employee)
    • Instantiation of array of objects
    • Loops to take input and display details for each element
  4. 7 Marks
    bIn C++, a variable can be declared anywhere in the scope. What is the significance of this feature?
    How to answer
    • Difference from traditional C (C89 requiring declarations at top of block)
    • Declaration close to first use improves readability and maintainability
    • Scope reduction and optimal resource utilization/lifetime management
    • Initialization at definition point avoids uninitialized states
  5. 7 Marks
    aHow does a C++ structure differ from a C++ Class?
    How to answer
    • Default access specifier for members: public in struct vs private in class
    • Default access specifier for inheritance: public in struct vs private in class
    • Syntactic similarities: both can have member functions, constructors, destructors
    • Tabular comparison summary
  6. 7 Marks
    bWhat is Constructor? Write a program to explain copy constructor and its use.
    How to answer
    • Definition of constructor and its characteristics
    • Definition and syntax of copy constructor: ClassName(const ClassName &obj)
    • Situations when copy constructor is invoked (initialization, pass-by-value, return-by-value)
    • Complete C++ program showing explicit copy constructor
  7. 14 Marks
    Describe the mechanism of accessing data members and member functions in the following cases: a) Inside the main program b) Inside a member function of the same class c) Inside a member function of another class
    How to answer
    • Case a: Accessing public members via object dot operator (obj.member) or pointer arrow operator (ptr->member); private members inaccessible
    • Case b: Direct access by name inside member functions of same class (or implicitly through this pointer)
    • Case c: In another class: dependent on relationship; requires object dot notation for public members, or friend declaration / inheritance for protected/private access
    • Code snippets illustrating each scenario
  8. 7 Marks
    aExplain Access Specifiers with respect to inheritance.
    How to answer
    • Role of access specifiers (public, protected, private) in base classes
    • Visibility modes of inheritance: public, protected, private derivation
    • Visibility table showing how base members are inherited under each mode
    • Accessibility rules for derived class members and derived class objects
  9. 7 Marks
    bWrite a C++ program for calculating the area of rectangle and circle using run time polymorphism.
    How to answer
    • Base class Shape with a virtual function (e.g., virtual void calculate_area())
    • Derived classes Rectangle and Circle overriding calculate_area()
    • Use of base class pointers pointing to derived class objects
    • Demonstration of runtime dispatch through base pointer in main()
  10. 7 Marks
    aIn what order are the class constructors called when a derived class object is created?
    How to answer
    • General rule: Base class constructors are called before derived class constructors
    • Order in multiple inheritance: order of derivation list in class header
    • Order with virtual base classes: virtual base classes initialized first
    • Order of member object constructors before derived class body
    • Contrast with destructor execution order (reverse order)
  11. 7 Marks
    bExplain function overloading with example.
    How to answer
    • Definition of function overloading (multiple functions same name, different signatures)
    • Rules: differentiated by number, types, or sequence of arguments (not return type alone)
    • Illustrative C++ code example (e.g., add(int, int) and add(double, double))
    • How compiler resolves calls at compile time
  12. 7 Marks
    aHow is Polymorphism achieved at? i) Compile time ii) Run time
    How to answer
    • Definition of polymorphism
    • Compile-time polymorphism: static binding via function overloading and operator overloading
    • Run-time polymorphism: dynamic binding via virtual functions and inheritance
    • Role of vptr and vtable in runtime polymorphism
  13. 7 Marks
    bExplain, with an example, how you would create space for an array of objects using pointers.
    How to answer
    • Dynamic memory allocation using new operator: ClassName *ptr = new ClassName[size];
    • Accessing member functions using pointer arithmetic or array indexing: ptr[i].method()
    • Memory deallocation using delete[] operator
    • C++ code example demonstrating allocation, usage, and deallocation
  14. 7 Marks
    aWhat are Exceptions? What are the differences between synchronous and asynchronous exceptions?
    How to answer
    • Definition of an exception (abnormal runtime condition/event)
    • Synchronous exceptions: caused by program instructions (e.g., division by zero, out-of-range array access)
    • Asynchronous exceptions: caused by events beyond program control (e.g., hardware faults, keyboard interrupts, disk read error)
    • Key differences table
  15. 7 Marks
    bExplain overloaded function templates with suitable example program.
    How to answer
    • Concept of template overloading (multiple template definitions or mixing template with standard function)
    • Template resolution rules (exact non-template match preferred over template)
    • Complete C++ program example showing overloaded templates
    • Explanation of output showing which version is called
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