Wednesday, January 9, 2013

Level: Bachelor Semester – Fall Year : 2008



Pokhara University

Level: Bachelor
Semester – Fall
Year         : 2008
Programme: BE
Full Marks: 100
Course:  Object Oriented Programming in C++
Time         : 3hrs.

Candidates are required to give their answers in their own words as far as practicable.
The figures in the margin indicate full marks.

Attempt all the questions.


1.                   
a)         What do you mean by recursion? Compare recursion and iteration technique base on control structure.
b)        Write a C++ program to calculate the factorial of a number using recursion.
8

7
2.                   
a)         Why object – oriented programming is dominating procedural programming approach? Explain with the features of OOP.
b)        What do you mean by responsibility driven design? What is CRC Card?
8

7
3.                   
a)         Can we have more than one destructor in a class? Write a program to add two complex numbers using the concept of constructor.
b)        What are the advantages of using a friend function? List different types of classes and explain any two.
7

8
4.                   
a)         Create a class called Employee with three data members (empno, name, address), a function called readdata() to take the details of the employee from the user, and a function called displaydata() to display the details of the employee. In main, create two objects of the class and for each object call the readdata() and displaydata() functions
b)        How does inheritance reuse the existing code? Explain
8



7
5.                   
a)         What do you mean by compile time polymorphism and run – time polymorphism? Give an example for function overloading.
b)        Make a class called memory with member data to represent bytes, kilobytes and megabytes. Read the value of memory in bytes from the user as basic data type and display the result in user defined memory type. Like for m (basic type) =108766,  your program should display as,
1 megabyte 38 kilobytes 177 bytes. [Hint. Use basic to user define data conversion method]
8

7
6.                   
a)         What is virtual function? How does it provide run-time polymorphism? Explain.
b)        Create a template class to find the sum of array of integers and array of floating point numbers
7

8
7.                   
Write short notes on (Any Two)
a)         Scope Resolution operator
b)        Hibrid Inheritance
c)         Exception Handling.
2×5

No comments:

Post a Comment