Object Oriented Programming with C++ - May 2016
Computer Engineering (Semester 4)
TOTAL MARKS: 100
TOTAL TIME: 3 HOURS (1) Question 1 is compulsory.
(2) Attempt any four from the remaining questions.
(3) Assume data wherever required.
(4) Figures to the right indicate full marks.
1(a) Why C++ is not a pure object oriented programming language?(1 marks) 1(b) Explain encapsulation property of an OOP language.(1 marks) 1(c) Define class in C++.(1 marks) 1(d) What is the use of namespace in C++?(1 marks) 1(e) What are stream extraction and stream insertion operators?(1 marks) 1(f) Define destructor.(1 marks) 1(g) What is a friend class?(1 marks) 1(h) What is an abstract class?(1 marks) 1(i) What is the use of private inheritance?(1 marks) 1(j) Briefly explain multi-level inheritance.(1 marks) 1(k) Explain pure virtual function.(1 marks) 1(l) Discuss various access specifiers in C++.(1 marks) 1(m) What is the use of overloading an assignment (=) operator?(1 marks) 1(n) Explain tellg( ) function in file streams.(1 marks) 2(a) Explain function overloading with a program.(3 marks) 2(b) Create two classes X and Y containing private variables x and y respectively. Using a common friend function, perform multiplication operation between x and y.(4 marks)
Solve any one question from Q.2(c) & Q.2(d)
2(c) Create a class coordinate containing x, y and z private variables. Perform operations for incrementing, adding and comparing object(s) by overloading + +, + = and = = operators respectively. Define necessary functions to set and display the variables.(7 marks) 2(d) Write a program to demonstrate conversion of an object of one class into an object of another class.(7 marks)
Solve any three question from Q.3(a), Q.3(b), Q.3(c) & Q.3(d), Q.3(e), Q.3(f)
3(a) Explain call by reference with a program.(3 marks) 3(b) Explain this pointer with a program.(4 marks) 3(c) Write a program to create a class distance containing feet and inches. Using operator keyword, convert an object of class distance into total meters which is a float data type. (1 meter=3.28 Feet)(7 marks) 3(d) Discuss new and delete keywords.(3 marks) 3(e) Discuss nameless temporary object.(4 marks) 3(f) Demonstrate the use of static variables and static functions with a program.(7 marks)
Solve any three question from Q.4(a), Q.4(b), Q.4(c) & Q.4(d), Q.4(e), Q.4(f)
4(a) Explain Scope Resolution Operator (::) with a program.(3 marks) 4(b) Explain virtual base class with a program.(4 marks) 4(c) Write a program which uses command line argument to copy the contents of a file A.txt into another file B.txt by reversing case of the characters. E.g. File A.txt: aBCd File B.txt: AbcD(7 marks) 4(d) Discuss the use of inline functions.(3 marks) 4(e) Demonstrate the use of virtual functions with a program.(4 marks) 4(f) Explain the use of binary files in C++ with a program.(7 marks)
Solve any three question from Q.5(a), Q.5(b), Q.5(c) & Q.5(d), Q.5(e), Q.5(f)
5(a) Explain ios::app and ios::ate flags.(3 marks) 5(b) Explain the use of multiple handlers in exception handling with a program.(4 marks) 5(c) Create a generic class stack using template and implement common Push and Pop operations for different data types.(7 marks) 5(d) Explain ios::binary and ios::trunc flags.(3 marks) 5(e) Discuss Standard Template Library.(4 marks) 5(f) With a program, explain exception handling in C++.(7 marks)