Object Oriented Programming with C++ - Jun 2013
Computer Science Engg. (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) What is a statement? Explain jump statement with syntax.(8 marks) 1 (b) What is inline function? Write a C++ program to find maximum of 2 numbers using inline function.(4 marks) 1 (c) What is function overloading? Explain with example, why function overloading is important?(8 marks) 2 (a) What is class? Explain the syntax of class.(8 marks) 2 (b) Mention the restrictions that are placed on static member functions.(4 marks) 2 (c) What is parameterized constructor? Explain the different methods of passing arguments to the parameterized constructor with example.(8 marks) 3 (a) What are friend functions? What are the advantages of using friend functions? Write a C++ program to find sum of 2 numbers, using friend functions.(8 marks) 3 (b) what are generic functions? Explain with syntax.(4 marks) 3 (c) Write a C++ program to demonstrate the addition of two longitude and latitude values by overloading + operator.(8 marks) 4 (a) What is inheritance? Explain the syntax of defining derived classes.(8 marks) 4 (b) What is copy constructor? When the copy constructor is empoyed? Explain with syntax.(4 marks) 4 (c) Explain protected base-class inheritance, with suitable example.(8 marks) 5 (a) Explain when constructors and destructors are executed? Explain the order of invocation of constructor and destructor in multilevel inheritance with suitable program.(10 marks) 5 (b) Explain how to pass parameters to bas-class constructors., with suitable program.(10 marks) 6 (a) What is virtual function? What is the use of virtual function? Write a C++ program to demonstrate calling of virtual function through a base class relevance.(10 marks) 6 (b) What is pure virtual function? Explain with syntax.(4 marks) 6 (c) What is an abstract class? How it supports run-time polymorphism?(2 marks) 6 (d) Mention the difference between early binding and late binding.(4 marks) 7 (a) What are streams in C++? Mention four buit-in streams that are automatically opened whe a C++ program beings execution.(6 marks) 7 (b) Explain width(), precision() and fill() functions.(6 marks) 7 (c) What are I/O manipulators? List and mention the purpose of C++ I/O manipulators.(8 marks) 8 (a) What is exception? Explain the syntax of try and catch.(5 marks) 8 (b) What are containers? Mention any four container classes defined by STL.(5 marks) 8 (c) Explain any six commonly used member function defined by vector.(6 marks) 8 (d) Explain any four commonly used member functions of map.(4 marks)