CU SEC-A-2 Object Oriented Programming in C++, 2021

University of Calcutta question paper, B.Sc. Honours Semester III, 2021. Object Oriented Programming in C++. Typed in LaTeX, searchable, with a printable PDF.

Open this paper in MathQP

  1. float (ii) string (iii) character (iv) integer.
  2. 2 (ii) 1 (iii) 4 (iv) 0 .
  3. virtual (ii) inline (iii) static (iv) void.
  4. Abstraction (ii) Encapsulation (iii) Polymorphism (iv) Modularity.
  5. How to access the private member function of a class?
  6. Which of the following is not a type of constructor?
  7. Which statement gets affected when i++ is changed to ++i ?
  8. 0 (ii) 11 (iii) unpredictable (iv) error.
  9. * (ii) = (iii) ++ (iv) - .
  10. A template class
  11. What is object-oriented programming? Distinguish between data abstraction and data encapsulation in object-oriented programming.
  12. Write a C++ program to calculate the variance and standard deviation of N numbers. Use the formula Mean = bar x = dfrac 1 N sum i=1 N x i ; Variance = dfrac 1 N sum i=0 N (x i - bar x ) 2 , Standard Deviation = sqrt dfrac 1 N sum i=0 N (x i - bar x ) 2
  13. Write 5 differences between C and C++.
  14. Write a C++ program swapping two numbers using pointers.
  15. Define an array. Explain types of arrays with example.
  16. What is the difference between pointers to constants and constant pointers? Give examples.
  17. Explain enumeration data type with an example.
  18. Write a C++ program to set number of precision points. Display the results of sqrt 7 in different precision settings from precession 10 to 1 .
  19. Write a C++ program to find the octal representation of a given positive number.
  20. List out the types of Inheritance. Discuss in detail about any two Inheritance concepts with an example program.
  21. What is polymorphism? Explain different types of polymorphism.
  22. What is friend function and friend class and what are the merits and demerits?
  23. Write a C++ program to implement binary operator overloading over ‘ + ' operator to add two complex numbers.
  24. What is the output of the code? 5 # include <iostream> using namespace std; class cons public : int m; void init () m = 80; cons () init (); ; int main () cons S; cout << S.m;
  25. Write a C++ program to arrange N integers in descending order.
  26. What is the need of using function templates? How will you create and use the function template?
  27. Write a C++ program to generate fibonacci numbers using copy constructor.
  28. Write a program to create a template to find the maximum value stored in an array.
  29. Explain how to handle exceptions using try, catch and throw mechanism.
  30. Predict the output of the following code : 5 # include <iostream> using namespace std; namespace a name space int fl(int a, int b) int c = a+b; cout << c << ""; name space b name space int f1 (int a, int b) int c = a-b; cout << c << ""; int main () a name space : : f1 (2,2); b name space : : f1 (1,1);
  31. Write a C++ program to find the HCF and LCM of three positive integers.