Placement papers on C++ - Set 3

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 Answer

ANSWER: 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 Answer

ANSWER: the catch block.




3. 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 Answer

ANSWER: 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 Answer

ANSWER: cannot be used in inheritance hierarchy




5. The operator that cannot be overloaded is

++
::
( )
~
View Answer / Hide Answer

ANSWER: ::




6. 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 Answer

ANSWER: 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 Answer

ANSWER: i = 20; i++;




8. 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 Answer

ANSWER: 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 Answer

ANSWER: Inheritance




10. 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 Answer

ANSWER: the private section of a class.


Post your comment

    Discussion

  • RE: Placement papers on C++ - Set 3 -Rohit (07/24/15)
  • many of the above answers are wrong.
  • RE: Placement papers on C++ - Set 3 -RandomDude (06/29/15)
  • 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 Answer

    ANSWER: i = 20; i++;

    This answer is false. The correct one is C) a = i++;

    a = i++; assigns i to a
    a = ++i; assigns i+1 to a

You may like