General Questions (Set - 3)

Question 1 :

Which of the following is a mechanism of static polymorphism?


A). Operator overloading
B). Function overloading
C). Templates
D). All of the above
Answer : Option D

Question 2 :

Which of the following is correct about the statements given below?

All operators can be overloaded in C++.
We can change the basic 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.
Answer : Option B

Question 3 :

What happens if the base and derived class contains definition of a function with same prototype?


A). Compiler reports an error on compilation.
B). Only base class function will get called irrespective of object.
C). Only derived class function will get called irrespective of object.
D). Base class object will call base class function and derived class object will call derived class function.
Answer : Option D

Question 4 :

Which of the following are available only in the class hierarchy chain?


A). Public data members
B). Private data members
C). Protected data members
D). Member functions
Answer : Option C

Question 5 :

Which of the following is not a type of inheritance?


A). Multiple
B). Multilevel
C). Distributive
D). Hierarchical
Answer : Option C

Question 6 :

Which of the following operators cannot be overloaded?


A). []
B). ->
C). ?:
D). *
Answer : Option C

Question 7 :

In which of the following a virtual call is resolved at the time of compilation?


A). From inside the destructor.
B). From inside the constructor.
C). From inside the main().
D). Both A and B.
Answer : Option D

Question 8 :

Which of the following statements regarding inline functions is correct?


A). It speeds up execution.
B). It slows down execution.
C). It increases the code size.
D). Both A and C.
Answer : Option D

Question 9 :

Which one of the following is the correct way to declare a pure virtual function?


A). virtual void Display(void){0};
B). virtual void Display = 0;
C). virtual void Display(void) = 0;
D). void Display(void) = 0;
Answer : Option C

Question 10 :

Which of the following header file includes definition of cin and cout?


A). istream.h
B). ostream.h
C). iomanip.h
D). iostream.h
Answer : Option D

Question 11 :

Which of the following keyword is used to overload an operator?


A). overload
B). operator
C). friend
D). override
Answer : Option B

Question 12 :

What will happen if a class is not having any name?


A). I t cannot have a destructor.
B). It cannot have a constructor.
C). It is not allowed.
D). Both A and B.
Answer : Option D

Question 13 :

Which inheritance type is used in the class given below?
class A : public X, public Y
{}


A). Multilevel inheritance
B). Multiple inheritance
C). Hybrid inheritance
D). Hierarchical Inheritance
Answer : Option B

Question 14 :

Which one of the following is correct about the statements given below?

All function calls are resolved at compile-time in Procedure Oriented Programming.
All function calls are resolved at compile-time in OOPS.


A). Only II is correct.
B). Both I and II are correct.
C). Only I is correct.
D). Both I and II are incorrect.
Answer : Option C

Question 15 :

Which of the following is an invalid visibility label while inheriting a class?


A). public
B). private
C). protected
D). friend
Answer : Option D

Question 16 :

Which one of the following options is correct?


A). Friend function can access public data members of the class.
B). Friend function can access protected data members of the class.
C). Friend function can access private data members of the class.
D). All of the above.
Answer : Option D

Question 17 :

Which of the following statements is correct in C++?


A). Classes cannot have data as protected members.
B). Structures can have functions as members.
C). Class members are public by default.
D). Structure members are private by default.
Answer : Option B

Question 18 :

Which of the following is used to make an abstract class?


A). Declaring it abstract using static keyword.
B). Declaring it abstract using virtual keyword.
C). Making at least one member function as virtual function.
D). Making at least one member function as pure virtual function.
Answer : Option D

Question 19 :

Which of the following access specifier is used as a default in a class definition?


A). protected
B). public
C). private
D). friend
Answer : Option C

Question 20 :

What is correct about the static data member of a class?


A). A static member function can access only static data members of a class.
B). A static data member is shared among all the object of the class.
C). A static data member can be accessed directly from main().
D). Both A and B.
Answer : Option D

Question 21 :

Which of the following provides a reuse mechanism?


A). Abstraction
B). Inheritance
C). Dynamic binding
D). Encapsulation
Answer : Option B

Question 22 :

Which of the following statement is correct?


A). Class is an instance of object.
B). Object is an instance of a class.
C). Class is an instance of data type.
D). Object is an instance of data type.
Answer : Option B