Object Oriented Programming using C++ - B.Tech 3rd Semester Examination, 2022
Object Oriented Programming using C++
Instructions:
- The marks are indicated in the right-hand margin.
- There are NINE questions in this paper.
- Attempt FIVE questions in all.
- Question No. 1 is compulsory.
-
Which of the following is not a type of class?
-
Which among the following best describes the inheritance?
-
What is the default access specifier for data members or member functions within a class without any specifier in C++?
-
Which of the following is not the member of class?
-
Which constructor will be called from the object created in the code below?
Class A { int i; A() { \( i=0 \); } A (int \( x=0 \)) { \( i=x; \) } }; A obj1;
-
To prevent any method from overriding, we declare the method as
-
In C++ dynamic memory allocation is accomplished with the operator:
-
When a class serves as base class for many derived classes, the situation is called
-
For a method to be an interface between the outside world and a class, it must be declared
-
Which of the following statement is correct?
-
What are the advantages of using exception handling mechanism in a program? Explain the uses of try, throw and catch keywords using example.
-
Write a C++ program to find the sum of the series \( 1+3+5+......+n \).
-
What is inheritance? Discuss different types of inheritance with examples.
-
What is operator overloading? Write a program in C++ to overload unary minus operator.
-
What is pure virtual function? Write a C++ program that prints 'BEU Patna' from inside a member function of a subclass overriding a pure virtual function.
-
Discuss why converting a base-class pointer to a derived-class pointer is considered dangerous by compiler.
-
Differentiate between abstract class and interface with suitable examples.
-
What is access modifier in C++? Differentiate between each type.
-
Differentiate between a class and an object. Write an example (syntax) to define a class in C++.
-
With an example, explain the terms constructor and destructor.
-
What is a friend function and what are its advantages? What are the guidelines that should be followed while using friend function?
-
Explain dangling pointer with the help of an example.
-
Explain how base class member functions can be involved in a derived class if the derived class also has a member function with the same name.
-
Crate a class complex and implement the following:
(i) Define suitable constructors and destructors
(ii) Overload the operators + and -
(iii) Write a friend function sum which adds the real and imaginary parts of a complex object.