Programming In C++ MCQs Set-8

1. An array element is accessed using
  • a FIFO approach
  • an index number
  • the operator
  • a member name
2. A pure virtual function is a virtual function that
  • has no body
  • returns nothing
  • is used in base class
  • both (A) and (C)
3. A static function
  • should be called when an object is destroyed.
  • is closely connected with and individual object of a class.
  • can be called using the class name and function name.
  • is used when a dummy object must be created.
4. We can output text to an object of class ostream using the insertion operator << because
  • the ostream class is a stream
  • the insertion operator works with all classes.
  • we are actually outputting to cout.
  • the insertion operator is overloaded in ostream
5. The statement f1.write((char*)&obj1, sizeof(obj1));
  • writes the member function of obj1 to f1.
  • Writes the data in obj1 to f1.
  • Writes the member function and the data of obj1 to f1
  • Writes the address of obj1 to f1.
6. To convert from a user defined class to a basic type, you would most likely use.
  • A built-in conversion function
  • A one-argument constructor
  • A conversion function that’s a member of the class.
  • An overloaded ‘=‘ operator.
7. Which of the following is not the characteristic of constructor.
  • They should be declared in the public section.
  • They do not have return type.
  • They can not be inherited.
  • They can be virtual.
8. Name the header file to be included for the use of built in function isalnum()
  • string.h
  • process.h
  • ctype.h
  • dos.h