Site icon T4Tutorials.com

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



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”;}


(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?

(A) 4


(B) 1


(C) 2


(D) 3



11. : Composition is called a ___________.

(A) Aggregation


(B) Containment


(C) Provision


(D) Both A and D



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) 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



14. : 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



15. : Using keywords as an identifier causes is called ________.

(A) Syntax error


(B) Logical error


(C) Run time error


(D) None of them



16. : Rectangle symbol in flowchart is called _________.

(A) Connector symbol


(B) Action symbol


(C) Terminating symbol


(D) Begin symbol



17. : All keywords bool, catch, private, public, this and throw are introduced in ____________.

(A) C++ Language


(B) C language


(C) Both C and C++


(D) None of them



18. : First object-oriented language ‘Smalltalk’ appeared in _________ year.

(A) 1982


(B) 1992


(C) 1972


(D) 2000



19. : A member function will access data and return value to the user when it is __________.

(A) deleted


(B) called


(C) declared


(D) initialized



20. : Data in an object-oriented language is safe from accidental alteration as it is __________.

(A) error-free


(B) bugged


(C) compressed


(D) hidden



21. : If we want to read a data item in an object, the member function in an object is __________.

(A) delete


(B) call


(C) declare


(D) initialize



22. : Data encapsulation and data hiding are key features of __________.

(A) object-oriented language


(B) procedural language


(C) machine language


(D) structural language



 

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

 

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

Exit mobile version