C++ Programming MCQ - OOPS Concept

7. Which of the following provides a reuse mechanism?

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

View Answer


8.What is the output of this program?
Note:Includes all required header files

using namespace std;
class course
{
int member;
public : int* find()
{
return & member;
}
};
main()
{
course s;
int *ptr=c.find();
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


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

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

View Answer


10.Which of the following is true about the following program
Note:Includes all required header files

using namespace std;
class course
{
char name[10];
public : void find()
{
cout<< name;
}
};

A. This maintains encapsulation
B. This code doesn’t maintain encapsulation
C. This code is vulnerable
D. This code gives error

View Answer


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

A. True
B. False

View Answer


12.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






Also check :


Discussion


* You must be logged in to add comment.