Bachelors Level/First Year/Second Semester/Science bit/second semester/object oriented programming/syllabus wise questions

Bachelors In Information Technology

Institute of Science and Technology, TU

Object Oriented Programming (BIT153)

Year Asked: 2080, syllabus wise question

Basics of C++ programming
1.
Differentiate between function overloading and function overriding in C++. [5]
Class and Objects
1.
What is constructor? Explain its types with suitable example. How is the constructor called in a derived class in C++? [6+4]
2.
What is friend function? Write a program to add private member of two different classes using friend function. [5]
3.
Write a program to demonstrate returning object from functions in C++. [5]
4.
How 'this' pointer is used to resolve name conflict between local variable and member variable in C++? Explain with example. [5]
5.
Illustrate the use of static variable with a simple program. [5]
File and Streams
1.
Write a Program to read and write values through object using File Handling. [5]
Function Templates and Exception Handling
1.
What is exception handling? Explain types of exception handling and explain with suitable example. [5]
2.
What do you mean by class template in C++? Write a program in C++ containing function template which determines the greater number between two integer inputs and two floating point inputs. [5]
Inheritance
1.
What is the difference between public, private and protected inheritance in C++? [5]
Operator Overloading
1.
What is operator overloading? Write a complete C++ program to overload + operator to add two objects of class 'Time'. [10]
Virtual Function, Polymorphism, and other C++ Features
1.
What is Polymorphism in Object Oriented Programming? Implement a class Employee with a virtual function CalculateSalary() that returns the salary of the employee. Create two derived classes HourlyEmployee and SalariedEmployee. Override the CalculateSalary() function in both derived classes to calculate the salary of an hourly employee and a salaried employee respectively. Write a program that creates objects of both derived classes and calls the CalculateSalary() function for each. [10]