C++ Programming MCQ - OOPS Concept

11. Which of the following provides a reuse mechanism?

A. Abstraction
B. Inheritance
C. Dynamic binding
D. Encapsulation

View Answer


12. What is the output of this program?

#include <iostream>
using namespace std;
class course
{  
  int member;
  public : int* lfc()
  { 
    return & member; 
  }
};
main()
{
course s;
int *ptr=s.lfc();
return 0;
}  

A. This code is good to go
B. This code may result in undesirable conditions
C. This code will generate error
D. This code violates encapsulation

View Answer


13. In a class, encapsulating an object of another class is called

A. Encapsulation
B. Inheritance
C. Composition
D. None of the above

View Answer


14. Which of the following is true about the following program

#include <iostream>
using namespace std;
class course
{ 
  char name[10];
  public : void lfc()
  { 
    cout<< name;
  }
}; 
 

A. This maintains encapsulation
B. This code does not maintain encapsulation
C. This code is vulnerable
D. This code gives error

View Answer


15. A private function of a derived class can be accessed by the parent class.

A. TRUE
B. FALSE
C. May Be
D. Can't Say

View Answer


16. Reusability is a desirable feature of a language as it

A. Decreases the testing time
B. Reduces the compilation time
C. Lowers the maintenance cost
D. Both A and C

View Answer


17. Which of the following operators cannot be overloaded ?

A. Static function
B. Virtual function
C. Const function
D. Operator function

View Answer


18. Which one of the following options is correct about the statement given below? The compiler checks the type of reference in the object and not the type of object.

A. Inheritance
B. Polymorphism
C. Abstraction
D. Encapsulation

View Answer


19. Which of the following correctly describes overloading of functions?

A. Virtual polymorphism
B. Transient polymorphism
C. Ad-hoc polymorphism
D. Pseudo polymorphism

View Answer


20. How many loops are there in C++ 98?

A. 2
B. 3
C. 4
D. 5

View Answer





Also check :


Discussion


* You must be logged in to add comment.