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

Level: Bachelor Semester – Fall Year : 2005



Pokhara University

Level:  Bachelor
Semester – Fall
Year         : 2005
Programme: BE
Full Marks: 100
Course: Object Oriented Programming
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)           Why OOP is known as a new paradigm? Illustrate with certain examples.
b)           What is memory recovery? How does stack differ from heap memory allocation.
8

7
2.  
a)      What is a class? Explain the different types of classes.
b)      Create a class called Employee with three data members (empno, name, address), a function called readdata() to take in 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 Employee and for each object call the readdata() and the displaydata() functions.
2+6
7
3.  
a)      What does contructor mean? Explain the different types of constructors with a suitable example.
b)      Write a program using only constructor to find the area of a square and rectangle. Also initialize the object dynamically.
7

8
4.  
a)      What is polymorphism? Differentiate between compile time and run time polymorphism with program in each.
b)      What is hybrid inheritance? Does ambiguity occurs in this type of in this type of inheritance? If yes explain it.
9

6
5.  
a)      What is operator overloading? Write a program to overload the arithmetic operators (+, -, *, /).
b)      Define two classes named ‘Polar’ and ‘Rectangle’ to represent points in polar and rectangle systems. Use conversion routines to convert from one system to another system.
8

7
6.  
a)      Write a program using template to add two integers; two floats and one integer and one float numbers respectively. Display the final result in float.
b)      What is exception handling? Discuss briefly.
10

5
7.  
Write short notes on (Any Two)
a)      CRC Cards
b)      Container Classes
c)      Friend Function
d)      Software Reusability


Course: Object Oriented Programming in C++ Semester – Spring2005



Pokhara University

Level:  Bachelor
Semester –  Spring
Year           : 2005
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)   Describe object oriented programming as a new paradigm. What are the unique advantages of it?
b)   Explain state, behaviour and identity in light of object-oriented paradigm.

7

8
2.
a)   Define classes and objects? How does a class accomplish data encapsulation?
b)   What do you mean by memory recovery? Explain the term stack versus heap storage allocation.

8

7
3.
a)   Explain the purpose of constructor and destructor. Describe their significances. Can we have more than one destructor in a class? Explain it.
b)   Create a class called Student with six data members (rollno, name, marks in english, maths, and science, total), a constructor that initialises the data members to the values passed to it as parameters, a function called calctotal() that calculates the total of the marks obtained in the three subjects, and a function called display() that displays the details of the student.
In main, create two objects of the class Student and for each object call the calctotal() and the display() functions.

7

8
4.
a)   What does inheritance mean in C++? Describe the syntax of the single and multiple inheritances. When do we use the protected visibility specifier to a class member?
b)  An Education institute wishes to maintain a database of its employees. The database is divided into a number of classes whose hierarchical relationships are shown in figure. The figure also shows the minimum information required for each class. Specify all the classes and define functions to create the database and retrieve individual information as an when required.
                                                          
6

9
5.
a)   What is a pure virtual function? What implications it applies when a function is declared as pure virtual function? Give an example.
b)   What is operator overloading? Why is it necessary to overload an operator? Explain with suitable example.
2+2+4
7
6.
a)   What is containership? How does it differ from inheritance?
b)   Why type casting is important in OOP? Define two classes Time12 and Time24 that represents time in 12 hour and 24 hour format respectively. Write a conversion routine to convert time from one format to another.
5

2+8
7.
Write short notes on (Any Two):
a)      new and delete operator
b)      Templates
c)      Static Data members
d)      this printer
2x5