BE Computer Engineering (IOE, TU) Object Oriented Programming (IOE, CT 501) Question Paper 2078
This is the official BE Computer Engineering (IOE, TU) Object Oriented Programming (IOE, CT 501) question paper for 2078, as set in the regular annual examination. It carries 80 full marks and a time allowance of 180 minutes, across 12 questions. On Kekkei you can attempt this Object Oriented Programming (IOE, CT 501) past paper online with a timer, get instant AI feedback and step-by-step solutions, and track the topics where you lose marks — completely free. Whether you are revising for your BE Computer Engineering (IOE, TU) Object Oriented Programming (IOE, CT 501) exam or solving previous years' question papers, this 2078 paper is a great way to practise under real exam conditions.
Section A: Long Answer Questions
Attempt all / any as specified.
(a) Define a class and an object. Explain the difference between data members and member functions with a suitable example. [4]
(b) Write a complete C++ program to define a class Distance having data members feet and inches. Include a parameterized constructor to initialize the object, a member function to add two Distance objects, and a function to display the result. Demonstrate the use of the this pointer in your program. [8]
(a) What is meant by virtual function? Explain how run-time polymorphism is achieved in C++ using virtual functions and base class pointers. [5]
(b) Write a C++ program that defines a base class Shape with a virtual function area(). Derive classes Circle and Rectangle from it, override area() in each, and use an array of base class pointers to compute and display the area of different shapes. [7]
(a) State the rules and restrictions for operator overloading in C++. Why can some operators not be overloaded? [4]
(b) Write a C++ program to create a class Complex for complex numbers and overload the + and * operators to add and multiply two complex numbers respectively. Implement at least one operator using a friend function. [8]
(a) Explain the exception handling mechanism in C++ using try, catch, and throw. How can multiple catch blocks be used to handle different types of exceptions? [6]
(b) Write a C++ program that reads integers from a file named data.txt, computes their sum, and writes the result to result.txt. The program must throw and handle an exception if the input file cannot be opened. [6]
Section B: Short Answer Questions
Attempt all / any as specified.
Differentiate between a constructor and a destructor. Explain the concept of a copy constructor with an example and state when the default copy constructor leads to problems (shallow copy).
Explain the different types of inheritance supported in C++ with neat diagrams. Discuss the ambiguity problem that arises in multiple inheritance and how it is resolved using virtual base classes.
What are function templates and class templates? Write a function template maximum() that returns the largest of two values of any data type, and show how it is invoked for int and double arguments.
What is a pure virtual function? Define an abstract base class with an example and explain why an object of an abstract class cannot be instantiated.
Explain the difference between text mode and binary mode file handling in C++. Describe the use of the file pointers and the functions seekg(), seekp(), and tellg() for random access in files.
Explain the meaning of static data members and static member functions of a class. Write a short program that uses a static data member to count the number of objects created from a class.
Distinguish between overloading a unary operator using a member function and using a friend function. Write a program segment to overload the unary ++ operator (prefix form) for a Counter class.
Write short notes on: (a) the catch(...) block (catch-all handler), and (b) rethrowing an exception.