CS237—OBJECT ORIENTED PROGRAMMING
PART A
1.Which feature of object oriented programming provides(a) data hiding (b) reusability?
2.List any two drawbacks of procedures oriented languages.
3.What is unique about this pointer?
4.What is a default constructor?When is it used?
5.What effect does inheritance have on the working of constructors and be overloaded only by friend functions?
6.What effect does inheritance have on the working of constructors and destructors?
7.Write a function templates to swap two variables.
8.What is the differences between the statements? Cin>>ch;ch=cin.get();
9.List out any two salient differences between C++ and Java.
10.Differentiate overloading and overriding.
PART B
11. (i) Design template classes such that they support the following statements:
Rupee
Dollar
d1=r2;11 converts rupee to dollar(US)
(ii) Explain the exception handling model of C++ with various constructs
Supported by it. Write a program which transfers the control to userSupported by it.Write a program which transfers the control to user defined terminate function when raised exception is uncaught.
12(a) What is object oriented paradigm? Explain the various features of Paradigm.
(b)Define the following terms related to OO paradigm:
(i) Message passing
(ii)Delegation
(iii)Genericity
(iv)Persistance
13(a)(i)Write a program for manipulating coordinates in polar coordinate system.Represent points as objects.The class polar must include data members such as radius and theta and member functions such as add(),sub(),angle()etc.
(ii)What are the rules associated in defining constructors and destructors?
(b)(i) Write a program to read a matrix of size m x n from the keyboardadn display the same on the screen. Made row parameter as default argument.
(ii) Waht are(1) static(*2)constan members? Give examples to support your explanation.
14(a) Create two classes DM an DB to store the value of distances.DM stores distances in meters and centrimeters and DB in feet and inches. Write a program that can read values for the class object and add one object of DM with antother object of DB.Use a friend function to carry out the addition operation.The object that stores the results may be a Dm or DB object depending on the units in which the results are required. Tyhe display should be in ft-inches or mt-cm depending on the object of display.
(b)Write a C++ program to model the following inheritance hierarchy.
15.(a)Define an interface that declares the methods count and print for a collection of items. Define another interface that declares a method to search for an item. Define a class integer collection to represent a collection of integers and provide methods to count the number of items,print the number of items, search for an item and find the sum of all integers int the collection. Define another class string set that implements all the methods defined in both these interfaces on a collections of strings. Write a test program to test these classes.
or
(b) (i) How are abstact classes different from interfaces?
(ii) Create a class to model entries in a telephone directory (name address,phone,number).Define suitable classes and inheritance hierarchy.Write a program to test these classes.
No comments:
Post a Comment