πŸ§ͺ OOPS MCQ Quiz Hub

OOPS Mcq Question Set 1

Choose a topic to test your knowledge and improve your OOPS skills

Which is not a feature of OOP in general definitions?





βœ… Correct Answer: 4

Which feature of OOP indicates code reusability?





βœ… Correct Answer: 4

What is encapsulation in OOP?





βœ… Correct Answer: 1

Which of the following is not true about polymorphism?





βœ… Correct Answer: 2

Which constructor will be called from the object created in the below C++ code? class A { int i; A() { i=0; cout<<i; } A(int x=0) { i=x; cout<<I; } }; A obj1;





βœ… Correct Answer: 4

What is an abstraction in object-oriented programming?





βœ… Correct Answer: 4

Which among the following can show polymorphism?





βœ… Correct Answer: 2

In which access should a constructor be defined, so that object of the class can be created in any function?





βœ… Correct Answer: 3

Which among the following is correct for the class defined below? class student { int marks; public: student(){} student(int x) { marks=x; } }; main() { student s1(100); student s2(); student s3=100; return 0; }





βœ… Correct Answer: 4

The copy constructors can be used to ____





βœ… Correct Answer: 3

Which constructor will be called from the object obj2 in the following C++ program? class A { int i; A() { i=0; } A(int x) { i=x+1; } A(int y, int x) { i=x+y; } }; A obj1(10); A obj2(10,20); A obj3;





βœ… Correct Answer: 1

Which among the following represents correct constructor?





βœ… Correct Answer: 2

What happens when an object is passed by reference?





βœ… Correct Answer: 3

Which access specifier is usually used for data members of a class?





βœ… Correct Answer: 2

How to access data members of a class?





βœ… Correct Answer: 4

Which feature of OOP reduces the use of nested classes?





βœ… Correct Answer: 1

Which keyword among the following can be used to declare an array of objects in java?





βœ… Correct Answer: 3

Which operator can be used to free the memory allocated for an object in C++?





βœ… Correct Answer: 4

Which of the following is not a property of an object?





βœ… Correct Answer: 2

Which type of members can’t be accessed in derived classes of a base class?





βœ… Correct Answer: 3

Which among the following best describes the Inheritance?





βœ… Correct Answer: 1

Single level inheritance supports _______ inheritance.





βœ… Correct Answer: 4

How to overcome diamond problem?





βœ… Correct Answer: 2

Which keyword is used to declare virtual functions?





βœ… Correct Answer: 3

What happens if non static members are used in static member function?





βœ… Correct Answer: 2

What is friend member functions in C++?





βœ… Correct Answer: 1

Where is the memory allocated for the objects?





βœ… Correct Answer: 4

Which of the following best describes member function overriding?





βœ… Correct Answer: 3

Encapsulation and abstraction differ as _____





βœ… Correct Answer: 2

Which feature of OOP is exhibited by the function overriding?





βœ… Correct Answer: 1

How to access the private member function of a class?





βœ… Correct Answer: 4

Which keyword should be used to declare static variables?





βœ… Correct Answer: 3

Which is correct syntax for declaring pointer to object?





βœ… Correct Answer: 2

If data members are private, what can we do to access them from the class object?





βœ… Correct Answer: 2

Which among the following is not a necessary condition for constructors?





βœ… Correct Answer: 3

Object being passed to a copy constructor ______





βœ… Correct Answer: 4

If in multiple inheritance, class C inherits class B, and Class B inherits class A. In which sequence are their destructors called if an object of class C was declared?





βœ… Correct Answer: 3

Instance of which type of class can’t be created?





βœ… Correct Answer: 2

_______ underlines the feature of Polymorphism in a class.





βœ… Correct Answer: 1

Which feature in OOP is used to allocate additional functions to a predefined operator in any language?





βœ… Correct Answer: 3

Which feature can be implemented using encapsulation?





βœ… Correct Answer: 4

If a function can perform more than 1 type of tasks, where the function name remains same, which feature of OOP is used here?





βœ… Correct Answer: 3

If different properties and functions of a real world entity is grouped or embedded into a single element, what is it called in OOP language?





βœ… Correct Answer: 4

Which of the following is not a feature of pure OOP?





βœ… Correct Answer: 3

Which among the following doesn’t come under OOP concept?





βœ… Correct Answer: 1

Which feature of OOP is indicated by the following code? class student{ int marks; }; class topper:public student{ int age; topper(int age){ this.age=age; } };





βœ… Correct Answer: 4

Which feature may be violated if we don’t use classes in a program?





βœ… Correct Answer: 4

How many basic features of OOP are required for a programming language to be purely OOP?





βœ… Correct Answer: 1

The feature by which one object can interact with another object is ______





βœ… Correct Answer: 3

Which feature in OOP is used to allocate additional function to a predefined operator in any language?





βœ… Correct Answer: 1