Classes and Inheritance MCQs in C++ – OOP

Classes and Inheritance MCQs in C++ OOP

1. We can access which kind of data members in the derived class?

(A). Private data members

(B). Protected data members

(C). Public data members

(D). B and C

2. We can’t access which kind of data members in the derived class?

(A). Private data members

(B). Protected data members

(C). Public data members

(D). B and C

3. We can access which kind of data members outside the class?

(A). Private data members

(B). Protected data members

(C). Public data members

(D). B and C

4. We can’t access which kind of data members outside the class?

(A). Private data members

(B). Protected data members

(C). Public data members

(D). A and B

5. Which of the following is the correct syntax to declare a class?

(A). Private data members

(B). Protected data members

(C). Public data members

(D). A and B

Access Specifiers Private Protected Public
Access in same class YES YES YES
Access in derived class NO YES YES
Access outside the class NO NO YES

 

6. Which of the following is the correct syntax to declare a class?

(A). class student{}

(B). class student{};

(C). student class {}

(D). student class{};

7. Which of the following is the correct syntax to declare data members in a class?

(A). class student{int rollno;}

(B). class student{public int rollno;};

(C). student class {int public rollno;};

(D). student class{public: int rollno;};

8. Which of the following is the correct syntax to define a function for a class?

(A). class T4Tutorials{public: void display(){cout<<“welcome”;}};

(B). class T4Tutorials{public: void display();}; void T4Tutorials::display(){cout<<“welcome”;}{cout<<“welcome”;}};

(C). Both are correct

(D). Both are wrong

9. What is the correct syntax to declare object for a class?

(A). int main(){T OBJ1; OBJT1.display();}

(B). int main(){T OBJ1,OBJ2; OBJT1.display();}

(C). int main(){OBJ1 T; OBJT1.display();}

(D). Both A and B

10.  How many ways to use existing classes to define a new class? Select the correct option.
A. 4
B. 1
C. 2
D. 3
E. All of these
F. Both A and B

11. Composition is called a ___________.
A. Aggregation
B. Containment
C. Provision
D. Both A and D
E. All of these
F. Both A and C

12. When a data member of the new class is an object of another class is called ___________.
A. A new class is an aggregate of another
B. A new class is a composite of other objects
C. A new class is inherited
D. None of them
E. All of these
F. Both A and B

13. We can define a new class from an existing class, which of the following is used.
A. Composition
B. Inheritance
C. Constructors
D. Both A and D
E. All of these
F. Both A and B

14. Classes refers is to use of one or more classes within the definition of another class, is also called ___________.
A. Provision
B. Inheritance
C. Composition
D. None of them
E. All of these
F. Both A and B

15. Using keywords as an identifier causes is called ________.
A. Syntax error
B. Logical error
C. Run time error
D. None of them
E. All of these
F. Both A and B

16. Rectangle symbol in flowchart is called _________.select correct option.
A. Connector symbol
B. Action symbol
C. Terminating symbol
D. Begin symbol
E. All of these
F. Both A and B

17. All keywords bool, catch, private, public, this and throw,are introduce in ____________.
A. C++ Language
B. C language
C. Both C and C++
D. None of them
E.All of these
F. Both A and B

18. First object-oriented language ‘Smalltalk’ were first appeared in_________ year.
A. 1982
B. 1992
C. 1972
D. 2000
E. All of these
F. Both A and B

19. Member function will access data and return value to the user when it is. Which option is correct.
A. deleted
B. called
C. declared
D. initialized
E. All of these
F. Both A and B

20. Select the correct option according to a given statement. Data in an object-oriented language is safe from accidental alternation as it is.
A. error-free
B. bugged
C. compressed
D. hidden
E. All of these
F. Both A and B

21. If we want to read a data item in an object, member function in an object is. select the correct option.
A. delete
B. call
C. declare
D. initialize
E.  All of these
F. Both A and B

22. Data encapsulation and data hiding are key features of. select the correct option.

A. object-oriented language
B. procedural language
C. machine language
D. structural language
E. All of these
F. Both A and B

OOP MCQs 

Programming C Plus Plus MCQs

  1. Top 50 Programming  C++ Solved MCQs Questions Answers
  2. Mcq’s of introduction to programming
  3. C++ Mcq’s
  4. C++ Array  MCQs 
  5. Arrays MCQs 2
  6. Pointers Solved MCQs
  7. Advanced C Plus Plus MCQs
  8. Advanced c++ multiple choice question
  9. Programming c++ MCQs for a Programming competition
  10. C++ STANDARD LIBRARY MCQs
  11. Classes and Inheritance MCQs
  12. Polymorphism Mcqs
  13. Operator overloading MCQs

Computer Science Repeated MCQs Book Downloadshamil memory table

Programming C Plus Plus MCQs Homepage

shamil memory table

Add a Comment