Sample Question Paper – IV
9036 3 Hours / 80 Marks
Seat No.
Q.1 Attempt any eight of the following: 16 a) Why object oriented programming mostly preferred rather than procedure oriented programming? b) The cin and cout are not keywords. Justify. c) What is an object? Give suitable example. d) Why the inline functions are necessary? e) Is it necessary to declare a destructor for a class? Why? f) What will happen when a class ‘Nation’ contains following two constructors? Nation(int x) {} Nation(int x, int y = 0) { } g) State the necessity of copy constructor. h) Which is advantageous; pointer to character or array of character? Why? i) Can you create the object of the class containing pure virtual function? Justify. j) How C++ achieves run time polymorphism? Q.2 Attempt any three of the following: 12 a) How an object oriented programming language achieves the advantages of inheritance? Explain. b) class Base { int val; public: Base( ) // statement2 { val = 0; } }; class Derived: public Base { public: Derived( ) // statement1 { cout<<“Derived Constructor”; } Object Oriented Programming (9036): Sample Question Paper.
1
}; In the above example, if you want to call constructor of the Base class at statement1 without creating object. What changes are expected in the program? c) Write a program to demonstrate the overloading of any unary operator using friend operator function. d) Write the syntax or pseudo C++ code for following inheritance hierarchy: College
Principal
Teacher
Student
Result
Q.3 Attempt any three of the following: 12 a) Functions can also be passed as the parameter to other functions. Justify this statement with appropriate example. b) Explain the application of new and delete operator in a simple C++ application program. c) Can we achieve the function overloading by writing one function in derived class and another in base class with different prototypes? Explain. d) Why destructors are not overloaded? Explain with example. Q.4 Attempt any two of the following: 16 a) Declare a class having data members as speed, capacity and price. Write a constructor to initialize these values. Create and initialize an object ‘x’ by calling a constructor. Create two more objects ‘y’ and ‘z’ and initialize them by calling copy constructor implicitly and explicitly respectively. The ‘x’ object is passed as the parameter to this constructor. b) Write a program to declare a class ‘Chandra’ having data member as ‘value’. Create an array of 5 objects, initialize them and find which object’s ‘value’ is largest. c) Attempt the following: i. Differentiate between public and protected. ii. Draw any four conceptual diagrams to show hybrid inheritance. Q.5 Attempt the following: 12 a) Explain dynamic memory allocation of objects. b) Attempt any one of the following: i. Write a program to pass the entire array to a function using array and return the largest number from it. Object Oriented Programming (9036): Sample Question Paper.
2
ii.
Describe the functions performed by all the error handling functions of file streams.
Q.6 Attempt any three of the following: 12 a) Describe the functions performed by following file opening modes: i. ate ii. nocreate iii. noreplace iv. binary b) Write a program to open a file and display the second half contents of the file. c) Explain the functions performed by read( ) and write( ) with syntax and suitable example. d) Explain the file pointer manipulation functions with appropriate example.
Object Oriented Programming (9036): Sample Question Paper.
3