Programming In C++ MCQs Set-3

PropellerAds
  1. 1. You can read input that consists of multiple lines of text using
    • the normal cout << combination.
    • the cin.get( ) function with one argument.
    • the cin.get( ) function with two arguments.
    • the cin.get( ) function with three arguments.
  2. 2. 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.
  3. 3. The process of building new classes from existing one is called
    • Structure
    • Inheritance
    • Polymorphism
    • Template
  4. 4. If you wanted to sort many large objects or structures, it would be most efficient to
    • place them in an array & sort the array.
    • place pointers to them in an array & 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
  5. 5. 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;
  6. 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.
  7. 7. The operator that cannot be overloaded is
    • ++
    • ::
    • ( )
    • ~
  8. 8. 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.
  9. 9. 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.
  10. 10. 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.