Tribhuwan University

Institute of Science and Technology

2079

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.
What do we need template? Why the program terminate after the occurrence of exception? Describe the types of constructor. [4+6]
2.
Differentiate between abstract class and concrete class. Write a program to create a class named 'Quadratic' that represents a function of the form f(x) = ax + bx +C, where x is a real variable and a, b, c are real constants. The class must satisfy the following requirements: a. A constructor should be provided that takes the values of a, b and c as arguments. All three of these arguments should default to zero. b. A function that takes a single argument x return the value of f(x). c. All data members should be private. [2+8]
3.
Explain the chain of constructor and destructor between sub classes and super classes during inheritance with example. Create a class named 'Point' with data members x and y. Overload the + operator to add the value of two objects of this class. [5+5]
Section B

Short Answers Questions

Attempt any Eight questions.
[8*5=40]
4.
Can we use object oriented concept using structure instead of classes? Justify your opinion. [5]
5.
In which case default argument is used? Describe with an example. [5]
6.
What is the task of static data members and function? Illustrate with an example. [5]
7.
Differentiate between aggregation and inheritance. Why do we need virtual base class? [5]
8.
Define stream. How do you read the text from file? Describe. [5]
9.
Explain the features of OOP. [5]
10.
Define namespace. List any two manipulators with their uses. [5]
11.
Why do we need friend class? How can we define member function outside the class? [5]
12.
Explain the use of pure virtual function with example. [5]