Tribhuwan University

Institute of Science and Technology

2080.1

Bachelor Level / First Year / Second Semester / Science

Bachelors in Information Technology (BIT153)

(Object Oriented Programming)

Full Marks: 60

Pass Marks: 24

Time: 3 Hours

Candidates are required to give their answers in their own words as for as practicable.

The figures in the margin indicate full marks.

Section A

Long Answers Questions

Attempt any TWO questions.
[2*10=20]
1.
Why object oriented programming is known as bottom up approach? Explain different features of object oriented programming. [3+7]
2.
Differentiate between single level inheritance and multiple inheritance? Write a C++ program to calculate the percentage of a student using multi-level inheritance. Accept the marks of three subjects in base class "Capture". Derive class "Total" from "capture" which should include a function to find the total marks obtained and derive class "Final" from "Total" which should calculate and display the percentage of student. [3+7]
3.
Why data conversion is needed? How Conversion between objects of different classes is carried out. Write a program containing classes Kilogram and Gram to convert Gram to Kilogram. (1 Kilogram = 1000 grams) [2+4+4]
Section B

Short Answers Questions

Attempt any Eight questions.
[8*5=40]
4.
What is constructor? Write a program to demonstrate constructor overloading in C++. [1+4]
5.
What is function overloading? Explain with an example. [5]
6.
What is the role of protected access specifiers in inheritance? Explain with example. [5]
7.
Differentiate between virtual function and pure virtual function with an example. [5]
8.
What is friend function? Write a program to add any two private numbers of two different classes using friend function. [1+4]
9.
What is operator overloading? Explain with an example. [5]
10.
Illustrate Exception handling in C++ using try, throw and catch statements. [5]
11.
Write a program that writes objects to a binary file and reads objects from the same file. [5]
12.
What is function template? Write a program to demonstrate the use of function template that returns the greatest among integers, and float passed to it. [1+4]