Friday, 4 August 2017

C & C++ Programming Multiple Choice Questions - Set 45

1.       Pure virtual functions
(A) have to be redefined in the inherited class.
(B) cannot have public access specification.
(C) are mandatory for a virtual class.
(D) None of the above.
Answer: A
2.       Additional information sent when an exception is thrown may be placed in
(A) the throw keyword.
(B) the function that caused the error.
(C) the catch block.
(D) an object of the exception class.
Answer: C
3.       Use of virtual functions implies
(A) overloading.
(B) overriding.
(C) static binding.
(D) dynamic binding.
Answer: D
4.       this pointer
(A) implicitly points to an object.
(B) can be explicitly used in a class.
(C) can be used to return an object.
(D) All of the above.
Answer: D
5.       If you wanted to sort many large objects or structures, it would be most efficient to
(A) place them in an array & sort the array.
(B) place pointers to them in an array & sort the array.
(C) place them in a linked list and sort the linked list.
(D) place references to them in an array and sort the array.
Answer: C
6.       Which statement gets affected when i++ is changed to ++i?
(A) i = 20; i++;
(B) for (i = 0; i<20; i++) { }
(C) a = i++;
(D) while (i++ = 20) cout <<i;
Answer: A
7.       It is possible to declare as a friend
(A) a member function
(B) a global function
(C) a class
(D) all of the above
Answer: D
8.       In multiple inheritance
(A) the base classes must have only default constructors
(B) cannot have virtual functions
(C) can include virtual classes
(D) None of the above.
Answer: C
9.       Declaration of a pointer reserves memory space
(A) for the object.
(B) for the pointer.
(C) both for the object and the pointer.
(D) none of these.
Answer: B
10.    for (; ;)
(A) means the test which is done using some expression is always true
(B) is not valid
(C) will loop forever
(D) should be written as for( )
Answer: C

0 comments:

Post a Comment