Wednesday, January 9, 2013

old is gold of c++ for pokhara university 2nd sem



Pokhara University

Level:  Bachelor
Semester – Spring
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 are the main features of Object Oriented Programming? Would you consider it better than structured programming? If you do, what makes it better?
b)      How does OOP provide reusable software components? Explain stack versus heap memory allocation.
8

7
2.      
a)      How are object oriented programs designed and developed according to the concept of FDD? Describe the entire process in brief.
b)      Define a class to represent a bank account. Include the following members.
Data Members:
                                 i.      Name of the account holder
                               ii.      Account Number
                              iii.      Account Type
                             iv.      Balance Amount
Member Functions:
               i.      To assign initial values
             ii.      To deposit an amount
            iii.      To withdraw an amount
           iv.      To display name and balance
Write a main program to test your class.
7

8
3.      
a)      "Friend function breaches the encapsulation". Justify. Also mention the uses of friend function.
b)      Create a class called time that has separate int member data for hours, minutes, and secons. One constructor should initialize this data to zero (0), and another should initialize it to fixed values. A member function should display it in 10:45:30 format. The final member function should add two objects of type time passed as arguments.
7

8
4.      
a)      Differentiate function overloading and function overriding. With suitable example.
b)      Refer to the figure given below. The class Master derives information form both Account and Admin classes, which in turn derive information from the class person. Define all four classes and write a program to create, update and display the information contained in Master object.






8

7
5.      
a)      What are the advantages of using runtime polymorphism over compile time polymorphism. How does overloading differ from overriding? Explain.
b)      Create a class shape with a pure virtual member function display (). Derive two classes circle and rectangle. With member function by overriding member function in base class shape to display the name of respective shape. Write main function to create objects of derived classes and call display function.
7


8
6.      
a)      State principle of substitutability. Briefly explain subclass and subtype.
b)      What is generic programming? How is it implemented in C++? Write any program to illustrate the concept of template.
7

8
7.      
Write short notes on (Any Two)
a)      "Responsibility implies non-interference"
b)      this pointer
c)      Containership
2×5

No comments:

Post a Comment