Tribhuwan University

Institute of Science and Technology

2080.1

Bachelor Level / First Year / Second Semester / Science

B.Sc in Computer Science and Information Technology (CSC166)

(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.
Write a program to create a class named height with data members meter(int) and centimeter(int). Overload the binary + operator using friend function to add two heights.[10]
2.
What is destructor? List its characteristics. Explain the use of default copy constructor with an appropriate example.[10]
3.
Write a program to realize the above hierarchy. Create necessary member functions (constructor) to initialize and display necessary information.
question image
[10]
Section B

Short Answers Questions

Attempt any Eight questions.
[8*5=40]
4.
Define object. What are the benefits of Object Oriented Programming Language? [5]
5.
Explain the significance of type conversion. How do we achieve dynamic memory allocation in C++? Explain with an example. [5]
6.
Create two classes Rupee and Dollar respectively. Write conversion operator to convert between Rupee and Dollar assuming that 1 dollar equals 133 rupees. Write a main program that allows the user to enter an amount in either currency and then converts it to other currency and displays the result. [5]
7.
Difference between compile time and run time polymorphism. [5]
8.
Explain function template overloading with suitable example. [5]
9.
Write a program that stores information of employees in a file and displays the file's content in ascending order of their salary. [5]
10.
What is the benefit of passing object as arguments? Write a program to create a class named actor with data members name and rating. Initialize the data members and display those names whose rating is greater than 5 using the concept of constant object. [5]
11.
Explain the practical implication of protected specifier in inheritance. List advantages and disadvantages of inheritance. [5]
12.
Write short notes on: a. This pointer b. ios member function [5]