Placement papers on C++ - Set 3
1. Regarding #define which of the following statement is false?
It is not C++ statement but the directive for the preprocessor
This does not require a semicolon at the end of line
It is a C++ statement that declares a constant in C++
None of the above
View Answer / Hide AnswerANSWER: It is a C++ statement that declares a constant in C++
2. Additional information sent when an exception is thrown may be placed in
the throw keyword.
the function that caused the error.
the catch block.
an object of the exception class.
View Answer / Hide Answer3. Pure virtual functions
have to be redefined in the inherited class.
cannot have public access specification.
are mandatory for a virtual class
None of the above.
View Answer / Hide AnswerANSWER: have to be redefined in the inherited class.
4. A struct is the same as a class except that
there are no member functions.
all members are public.
cannot be used in inheritance hierarchy
it does have a this pointer.
View Answer / Hide AnswerANSWER: cannot be used in inheritance hierarchy
5. The operator that cannot be overloaded is
++
::
( )
~
View Answer / Hide Answer6. A friend function to a class, C cannot access
private data members and member functions.
public data members and member functions
protected data members and member functions.
the data members of the derived class of C.
View Answer / Hide AnswerANSWER: the data members of the derived class of C.
7. Which statement gets affected when i++ is changed to ++i?
i = 20; i++;
for (i = 0; i<20; i++) { }
a = i++;
while (i++ = 20) cout << i;
View Answer / Hide Answer8. If you wanted to sort many large objects or structures, it would be most efficient to
place them in an array and sort the array.
place pointers to them in an array andg sort the array
place them in a linked list and sort the linked list.
place references to them in an array and sort the array.
View Answer / Hide AnswerANSWER: place them in a linked list and sort the linked list.
9. The process of building new classes from existing one is called
Structure
Inheritance
polymorphism
Template
View Answer / Hide Answer10. The keyword friend does not appear in
the class allowing access to another class.
the class desiring access to another class
the private section of a class.
the public section of a class.
View Answer / Hide AnswerANSWER: the private section of a class.