Sample Question Paper – II
9036 3 Hours / 80 Marks
Seat No.
Q 1: Attempt any Eight of the following: (2 x 8 = 16) a) b) c) d) e) f) g) h) i) j)
Why we need to include iostream.h file? What is the use of insertion & exertion operator? Enlist the keyword added the C++ than C. What is the type casting? List the advantages of inheritance? Why prototype variables are needed in class? Write the use of seekg ( ) function? State the use of ‘this’ pointer? What is the use of getline ( ) function? Write the differences between width ( ) & setw ( ).
Q 2: Attempt any THREE of the following: (4 x 3=12) a) b) c) d)
Write the rules for operator overloading. How to create your own manipulator? Explain with example. Write the program to illustrate use of constructor overloading. Explain the function overloading.
Q 3 : Attempt any THREE of the following : (4 x 3=12) a) b) c) d)
How the function can be called using base pointer? Explain Differentiate call by value & call by reference. What is compile time polymorphism? What will be the error in the following program? Give the solution on this error. class Region { int m,t ; Region() { m=0; } public: Region (int y) { t=y; } } main () { Region r; -1-
Region r (20); } Q 4 : Attempt any TWO of the following: (8 x 2=16) a) Write program to declare a class ‘staff’. Having data member as name & post. Accept this data for 5 staffs & display name of the staff who are H.O.D. b) Write a program to overload = = in a class ‘string’to check the equality of string . c) Write a program for below class hierarchy for the employee where the base class is employee & derived classes are programmer & manager. Here, make display ( ) function virtual which is common for all & which will display information of programmer & manager interactivity. Employee
Programmer
Manager
Q 5: 1) Attempt the following: (4 x 1=4) Explain the use of new, delete, const & inline. 2) Attempt any ONE of the following: (8 x 1=8) a) Write a program to accept source & destination file names from user & copy contents of source file into destination. b) Write a program to declare class ‘birthday’ having data members day, month & year, Accept & display this information for 5 objects using pointer to array of object. Q 6: Attempt any THREE of the following: (4 x 3=12) a) Point out the error if any in following code, else write output. class first { public: int m; first (int x) { m=x*x; } }; class second { public: first a(10); }; class third { public: second b; }; void main () { third c; cout <
c) Write a program to open a file using its name as command line input & display its contents. d) Explain what is cin & cout in detail.
-3-