Tribhuwan University

Institute of Science and Technology

2076

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.
Explain the concept of operator overloading? List the operators that cannot be overloaded. Write programs to add two object of distance class with data members feet and inch by using member function and friend function.[10]
2.
Explain types of polymorphism briefly. Write down roles of polymorphism. How can we achieve dynamic polymorphism briefly? Write down roles of polymorphism. How can we achieve dynamic polymorphism? Explain with example.[10]
3.
Write a program according to the specification given below:- Create a class Teacher with data members id & subject and member functions for reading and displaying data members.- Create another class Staff with data members id & position, and member functions for reading and displaying data members.- Derive a class Coordinator from Teacher and Staff and the class must have its own data member department and member functions for reading and displaying data members.- Create two object of Coordinator class and read and display their details.[10]
Section B

Short Answers Questions

Attempt any Eight questions.
[8*5=40]
4.
How object oriented programming differs from object based programming language? Discuss benefits of OOP. [5]
5.
What is use of new and delete operators? Illustrate with example. What are advantages of new over malloc. [5]
6.
How can define catch statement that can catch any type of exception? Illustrate the use of multiple catch statement with example. [5]
7.
What is meant by template? How can you define function template to return maximum of two integers, floats, or characters? Explain with example. [5]
8.
Which function can be used for reading and writing object? Define briefly. Write a program that reads values of two objects of students class (assume data members are id, name, and level) and display the data in monitor. [5]
9.
Write short notes on:- Cascading of IO operation - Pure Virtual Function [5]
10.
What is meant by return by reference? How can we return values by reference by using reference variable? Illustrate with example. [5]
11.
What is destructor? Write a program to show the destructor call such that it prints the message 'memory is released'. [5]
12.
What is this pointer? How can we use it for name conflict resolution? Illustrate the use of multiple catch statement with example. [5]