Programming In C++ MCQs Set-2

PropellerAds
  1. 1. If an array is declared as int a[4] = {3, 0, 1, 2}, then values assigned to a[0] & a[4] will be ________
    • 3, 2
    • 0, 2
    • 3, 0
    • 0, 4
  2. 2. Mechanism of deriving a class from another derived class is known as____
    • Polymorphism
    • Single Inheritance
    • Multilevel Inheritance
    • Message Passing
  3. 3. RunTime Polymorphism is achieved by ______
    • friend function
    • virtual function
    • operator overloading
    • function overloading
  4. 4. A function call mechanism that passes arguments to a function by passing a copy of the values of the arguments is __________
    • call by name
    • call by value
    • call by reference
    • call by value result
  5. 5. In C++, dynamic memory allocation is accomplished with the operator ____
    • new
    • this
    • malloc( )
    • delete
  6. 6. If we create a file by ‘ifstream’, then the default mode of the file is _________
    • ios :: out
    • ios :: in
    • ios :: app
    • ios :: binary
  7. 7. A variable defined within a block is visible
    • from the point of definition onward in the program.
    • from the point of definition onward in the function.
    • from the point of definition onward in the block.
    • throughout the function.
  8. 8. The break statement causes an exit
    • from the innermost loop only.
    • only from the innermost switch.
    • from all loops & switches.
    • from the innermost loop or switch.
  9. 9. Which of the following cannot be legitimately passed to a function
    • A constant.
    • A variable.
    • A structure.
    • A header file.
  10. 10. A property which is not true for classes is that they
    • are removed from memory when not in use.
    • permit data to be hidden from other classes
    • bring together all aspects of an entity in one place.
    • Can closely model objects in the real world.