Object Oriented Programming with C++ - Dec 2015
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) Explain the benefits of Object Oriented Programming.(7 marks) 1(b) Explain the difference between structure and class in C++.(7 marks) 2(a) What do you mean by call by value and call by reference? Justify your answer with suitable example.(7 marks)
Solved any question from Q.2(b) & Q.2(c)
2(b) Describe The Following Terms In C++ With Example
i) Default Argument.
ii) Function Overloading.
iv) this pointer(7 marks) 2(c) What is friend function? Write a program to find out sum of two private data members x and y of two classes A and B using a common friend function. Assume that the prototype for both the classes will be void sum (A, B);(7 marks)
Solved any question from Q.3 & Q.4
3(a) What are the characteristics of constructor in C++? Write a program to illustrate the use of copy constructor.(7 marks) 3(b) What is an operator function? Write a program to overload binary + operator as a member function.(7 marks) 4(a) Explain type conversion from class type to basic type and one class type to another class type with suitable example.(7 marks) 4(b) Write down the uses of static data member and static member function with suitable example.(7 marks)
Solved any question from Q.5 & Q.6
5(a) What is inheritance? Why do we use of protected specifier for base class data members in inheritance? Explain hybrid inheritance with example.(7 marks) 5(b) What is polymorphism? How is it achieved in C++? Explain with suitable Example.(7 marks) 6(a) What is a stream? Describe various stream classes for console I/O operations in C++.(7 marks) 6(b) Explain various file mode parameters in C++. Write a program to copy the contents of a source file student1.txt to a destination file student2.txt character by character.(7 marks)
Solved any question from Q.7 & Q.8
7(a) What is the purpose of using template in C++? Explain template function and template class with example.(7 marks) 7(b) Explain the mechanism of keywords try, throw and catch to handle Exceptions in C++. Explain with an example like "division by zero" situation.(7 marks) 8(a) Explain catch all exception and multiple catch exception with example(7 marks) 8(b) Consider the following class structure as shown in the figure. The class Result derives information from the classes Internal, University and External respectively. The Internal and External classes access information from the Student class. Define all five classes and write a suitable program to create and display the information contained in Result object.(7 marks)