General Questions (Set - 2)

Question 1 :

Which of the following is correct about class and structure?


A). class can have member functions while structure cannot.
B). class data members are public by default while that of structure are private.
C). Pointer to structure or classes cannot be declared.
D). class data members are private by default while that of structure are public by default.
Answer : Option D

Question 2 :

Which of the following concepts means wrapping up of data and functions together?


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

Question 3 :

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 loading
Answer : Option C

Question 4 :

How "Late binding" is implemented in C++?


A). Using C++ tables
B). Using Virtual tables
C). Using Indexed virtual tables
D). Using polymorphic tables
Answer : Option B

Question 5 :

Which of the following operator is overloaded for object cout?


A). >>
B). <<
C). +
D). =
Answer : Option B

Question 6 :

Which of the following is the correct class of the object cout?


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

Question 7 :

Which of the following cannot be used with the keyword virtual?


A). class
B). member functions
C). constructor
D). destructor
Answer : Option C

Question 8 :

Which of the following functions are performed by a constructor?


A). Construct a new class
B). Construct a new object
C). Construct a new function
D). Initialize objects
Answer : Option D

Question 9 :

Which of the following problem causes an exception?


A). Missing semicolon in statement in main().
B). A problem in calling function.
C). A syntax error.
D). A run-time error.
Answer : Option D

Question 10 :

Which one of the following options is correct about the statement given below? The compiler checks the type of reference in the object and not the type of object.


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

Question 11 :

Which of the following is the correct way of declaring a function as constant?


A). const int ShowData(void) { /* statements */ }
B). int const ShowData(void) { /* statements */ }
C). int ShowData(void) const { /* statements */ }
D). Both A and B
Answer : Option C

Question 12 :

Which of the following concepts is used to implement late binding?


A). Virtual function
B). Operator function
C). Const function
D). Static function
Answer : Option A

Question 13 :

Which of the following statement is correct?


A). C++ allows static type checking.
B). C++ allows dynamic type checking.
C). C++ allows static member function be of type const.
D). Both A and B.
Answer : Option D

Question 14 :

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.
Answer : Option D

Question 15 :

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
Answer : Option A