This section contains more frequently asked Programming In C++ MCQs in the various University Level and Competitive Examinations.

PRACTICE IT NOW TO SHARPEN YOUR CONCEPT AND KNOWLEDGE

view hide answers

1. The address of a variable temp of type float is

  • *temp
  • &temp
  • float& temp
  • float temp&

2. What is the output of the following code char symbol[3]={‘a’,‘b’,‘c’}; for (int index=0; index<3; index++) cout << symbol [index];

  • a b c
  • “abc”
  • abc
  • ‘abc’

3. The process of building new classes from existing one is called ______.

  • Polymorphism
  • Structure
  • Inheritance
  • Cascading

4. If a class C is derived from class B, which is derived from class A, all through public inheritance, then a class C member function can access

  • protected and public data only in C and B.
  • protected and public data only in C.
  • private data in A and B.
  • protected data in A and B.

5. If the variable count exceeds 100, a single statement that prints “Too many” is

  • if (count<100) cout << “Too many”;
  • if (count>100) cout >> “Too many”;
  • if (count>100) cout << “Too many”;
  • None of these

6. Usually a pure virtual function

  • has complete function body.
  • will never be called.
  • will be called only to delete an object.
  • is defined only in derived class.

7. To perform stream I/O with disk files in C++, you should

  • open and close files as in procedural languages
  • use classes derived from ios
  • use C language library functions to read and write data.
  • include the IOSTREAM.H header file.

8. Overloading the function operator

  • requires a class with an overloaded operator.
  • requires a class with an overloaded [ ] operator.
  • allows you to create objects that act syntactically like functions
  • usually make use of a constructor that takes arguments.

9. If x = y,5 = 2 then x ∧ y equals________. (where ∧ is a bitwise XOR operator)

  • 00000111 
  • 10000010
  • 10100000 
  • 11001000
Share with : Share on Linkedin Share on Twitter Share on WhatsApp Share on Facebook