C++ Test2 03-07-2025
C++ Test2 03-07-2025
A. :
B. ::
C. >
D. ;
6. Which of the following term is used for a function defined inside a class?
A. Member Variable
B. Member function
C. Class function
D. Classic function
10. Which of the following concepts of OOPS means exposing only necessary
information to client?
A. polymorphism
B. Abstraction
C. Data hiding
D. Data manipulation
11. Which of the following is correct concerning pointers?
A. A pointer stores the address of an actual variable
B. A pointer stores the value as well as the address of an actual variable
C. A pointer should always point to integer
D. All of the above.
13. cin is
A. variable
B. built-in function
C. user-defined function
D. constructor
22. Which of the following concepts means wrapping up of data and functions
together?
A. Abstraction
B. Encapsulation
C. Inheritance
D. Polymorphism
23. Which of the following concepts means waiting until runtime to determine which
function to call?
A. Data hiding
B. Dynamic casting
C. Dynamic binding
D. Dynamic using
24. Which of the following operators cannot be overloaded?
A. +
B. .
C. ++
D. --
25. Which of the following is the correct class of the object cout?
A. iostream
B. istream
C. ofstream
D. ifstream
30. Which of the following is the correct way of declaring a function as constant?
A. const int ShowData;
B. int const ShowData;
C. int ShowData(void) const;
D. Both A and B
33. Which of the following factors supports the statement that reusability is a
desirable feature of a
language?
A. It decreases the testing time.
B. It lowers the maintenance cost.
C. It reduces the compilation time.
D. Both A and B.
34. Which of the following ways are legal to access a class data member using this
pointer?
A. this->x
B. this.x
C. *this.x
D. *this-x
35. Which of the following is a mechanism used to store a number of values of the
same type?
A. function
B. array
C. variable
D. class
36. Which of the following is correct about the statements given below?All
operators can be overloaded
in C++.We can change the basic/original meaning of an operator in C++.
A. Only I is true.
B. Both I and II are false.
C. Only II is true.
D. Both I and II are true.
37. Which of the following cannot be overloaded?
A. class
B. function
C. constructor
D. operator
43. Which one of the following return types is used for a setter?
A. void
B. bool
C. int
D. none of the above
44. Which of the following header file includes definition of cin and cout?
A. istream.h
B. ostream.h
C. iomanip.h
D. iostream.h
46. What will happen if a function is not having any name or identifier?
A. It cannot have a destructor.
B. It cannot have a constructor.
C. It is not allowed.
D. Both A and B.
58. Which of the following statements is correct?1.Once a pointer variable has been
defined to point to
a particular variable it can refer to any other variable.2.A pointer cannot be used
in a class.
A. Only 1 is correct.
B. Only 2 is correct.
C. Both 1 and 2 are correct.
D. Both 1 and 2 are incorrect.
59. Functions can be declared to return a reference type. There are reasons to make
such a
declaration/Which of the following reasons are correct?
1.The information being returned is a large enough object that returning a
reference is more efficient
than ret
A. Only 1 is correct.
B. Only 2 is correct.
C. Both 1 and 2 are correct.
D. Both 1 and 2 are incorrect.
60. Which of the following statements is correct?1. An array can be declared with
number of
dimensions.2.We can create an array of pointers.
A. Only 1 is correct.
B. Only 2 is correct.
C. Both 1 and 2 are correct.
D. Both 1 and 2 are incorrect.
61. Which of the following statement is correct about the array?
A. A pointer must always be initialized within functions.
B. A pointer must always be initialized outside all functions
C. A pointer must always be initialized.
D. none of the above
63. Which type of inheritance can the child class inherit from more than one base
class?
A. multple inheritance
B. hybrid inheritance
C. multi-level inheritance
D. both a and b
74. What happens when a class with parameterized constructors and having no default
constructor is
used in a program and we create an object that needs a zero-argument constructor?
A. Compile-time error.
B. Preprocessing error.
C. Runtime error.
D. Runtime exception.
76. Destructor has the same name as the constructor and it is preceded by ______ .
A. !
B. ?
C. ~
D. $
77. For automatic objects, constructors and destructors are called each time the
objects
A. enter and leave scope
B. inherit parent class
C. are constructed
D. are destroyed
84. Which of the following header files contains the function pow()?
A. math
B. calc
C. arithmetic
D. equation
92. Which of the following statement will be correct if the function has three
arguments passed to it?
A. The trailing argument will be the default argument.
B. The first argument will be the default argument.
C. The middle argument will be the default argument.
D. All the argument will be the default argument.
101. Which of the following two entities (reading from Left to Right) can be
connected by the dot
operator?
A. A class member and a class object.
B. A class object and a class.
C. A constructor and a member of that class.
D. A class object and a member of that class.