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

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

Open this paper in MathQP

  1. In a class, encapsulating an object of another class is called
  2. A phone is made up of many components like display, camera, sensors, processor etc. If the processor performs all the operations, display shows the display only, the camera is for picture, and the phone is represented as a whole. Then which among the following have highest level of abstraction?
  3. Which is Abstract Data Type in C++?
  4. Suppose you have created a class like this : class A ... ; Then the statement texttt A obj; will call automatically .
  5. Which is used to define the member function of a class externally?
  6. A function that returns no values to the program that calls it is
  7. A base class may also be called a
  8. The library function texttt exit() causes an exit from
  9. You can read input that consists of multiple lines of text using
  10. Paying attention to the important properties while ignoring inessential details is known as
  11. Write down the output with proper justification of the following program : 2+3 # include <iostream.h> void main() int i=10; cout <<i<<" n "; int i=15; cout <<i<<" n "; cout <<i<< " n ";
  12. How object oriented programming is different from procedure oriented programming?
  13. Is there any difference between structure and union? Explain.
  14. Explain the different types of operators in C++.
  15. Explain enumeration data type with an example.
  16. Write a statement that declares an enumeration called texttt speeds with the enumerators texttt obsolete , texttt single and texttt album . Give these three names the integer values 78, 45 and 33 .
  17. Write a C++ program to reverse a string.
  18. What are the differences between pointers to constants and constant pointers? Give examples.
  19. Write a C++ program to exchange values between two classes using the concept of friend function.
  20. What is operator overloading? Write a C++ program to subtract two given 4 times 4 matrices using concept of operator overloading.
  21. Write a function that takes two distinct values as arguments and returns the larger one. Include a texttt main() program that accepts two distinct values from the user, compares them, and displays the larger.
  22. Define a class of triangles. Write member functions to get base and height of a triangle. Write a global function which creates an instance of the class triangle and computes area of the triangle.
  23. Explain the concept of exception handling. Write a C++ program containing a possible exception. Use a texttt try block to throw it and texttt catch block to handle it properly.
  24. How does polymorphism promote extensibility? Explain the various types of polymorphism with example.
  25. What do you mean by constructor and destructor? Explain constructor with an example.
  26. Write a program in C++ to find the sum of dfrac 1 1 + dfrac 1 3 + dfrac 1 5 + dfrac 1 7 + dfrac 1 9 + cdots + dfrac 1 2N+1 where N is a positive integer.
  27. Identify the error (if any) in the following program : # include <iostream.h> class student int marks; public: student() student (int x) marks = x ; void main() student s1(100); student s2(); student s3 = 100;
  28. Write down the output of the following program : #include <iostream.h> int a=10; void main() int a=15; cout<<::a<<" n "; cout<<a<<" n ";
  29. Write a C++ program to find GCD of two positive integers.
  30. What is the use of copy constructor? Explain the concept of copy constructor with the help of a suitable example.
  31. Write a program to find cube of a data using template. The data may be an integer, float or double number.
  32. What is an ‘exception’? Explain the best way of exception handling with a suitable example.
  33. Write a C++ program to compute the determinant of a given 4 times 4 matrix.