Olete.in
Articles
Mock Tests
đź§Ş OOPS MCQ Quiz Hub
OOPS Mcq Question Set 1
Choose a topic to test your knowledge and improve your OOPS skills
1. Which is not a feature of OOP in general definitions?
Efficient Code
Code reusability
Modularity
Duplicate/Redundant data
2. Which feature of OOP indicates code reusability?
Abstraction
Polymorphism
Encapsulation
Inheritance
3. What is encapsulation in OOP?
It is a way of combining various data members and member functions that operate on those data members into a single unit
It is a way of combining various data members and member functions into a single unit which can operate on any data
It is a way of combining various data members into a single unit
It is a way of combining various member functions into a single unit
4. Which of the following is not true about polymorphism?
Helps in redefining the same functionality
Increases overhead of function definition always
It is feature of OOP
Ease in readability of program
5. 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;
Parameterized constructor
Default constructor
Run time error
Compile time error
6. What is an abstraction in object-oriented programming?
Hiding the implementation and showing only the features
Hiding the important data
Hiding the implementation
Showing the important data
7. Which among the following can show polymorphism?
Overloading &&
Overloading <<
Overloading ||
Overloading +=
8. In which access should a constructor be defined, so that object of the class can be created in any function?
Any access specifier will work
Private
Public
Protected
9. 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; }
Program will give compile time error
Object s3, syntax error
Only object s1 and s2 will be created
Program runs and all objects are created
10. The copy constructors can be used to ____
Copy an object so that it can be passed to another primitive type variable
Copy an object for type casting
Copy an object so that it can be passed to a function
Copy an object so that it can be passed to a class
11. 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;
A(int y, int x)
A(int y; int x)
A(int y)
A(int x)
12. Which among the following represents correct constructor?
–classname()
classname()
()classname
~classname()
13. What happens when an object is passed by reference?
Destructor is called at end of function
Destructor is called when called explicitly
Destructor is not called
Destructor is called when function is out of scope
14. Which access specifier is usually used for data members of a class?
Protected
Private
Public
default
15. How to access data members of a class?
Dot, arrow or direct call
Dot operator
Arrow operator
Dot or arrow as required
16. Which feature of OOP reduces the use of nested classes?
Inheritance
Binding
Abstraction
Encapsulation
17. Which keyword among the following can be used to declare an array of objects in java?
allocate
arr
new
create
18. Which operator can be used to free the memory allocated for an object in C++?
Unallocate
Free()
Collect
delete
19. Which of the following is not a property of an object?
Properties
Names
Identity
Attributes
20. Which type of members can’t be accessed in derived classes of a base class?
All can be accessed
Protected
Private
Public
21. Which among the following best describes the Inheritance?
Using the data and functions into derived segment
Using already defined functions in a programming language
Using the code already written once
Copying the code already written
22. Single level inheritance supports _______ inheritance.
Language independency
Multiple inheritance
Compile time
Runtime
23. How to overcome diamond problem?
Using seperate derived class
Using virtual keyword with same name function
Can’t be done
Using alias name
24. Which keyword is used to declare virtual functions?
virt
virtually
virtual
anonymous
25. What happens if non static members are used in static member function?
Executes fine
Compile time error
Executes if that member function is not used
Runtime error
26. What is friend member functions in C++?
Non-member functions which have access to all the members (including private) of a class
Member function which doesn’t have access to private members
Member function which can modify any data of a class
Member function which can access all the members of a class
27. Where is the memory allocated for the objects?
Cache
ROM
HDD
RAM
28. Which of the following best describes member function overriding?
Member functions having the same name in derived class only
Member functions having the same name and different signature inside main function
Member functions having the same name in base and derived classes
Member functions having the same name in base class only
29. Encapsulation and abstraction differ as _____
Hiding and hiding respectively
Binding and Hiding respectively
Hiding and Binding respectively
Can be used any way
30. Which feature of OOP is exhibited by the function overriding?
Polymorphism
Encapsulation
Abstraction
Inheritance
31. How to access the private member function of a class?
Using class address
Using object of class
Using object pointer
Using address of member function
32. Which keyword should be used to declare static variables?
const
common
static
static
33. Which is correct syntax for declaring pointer to object?
*className objectName;
className* objectName;
className objectName();
className objectName;
34. If data members are private, what can we do to access them from the class object?
Private data members can never be accessed from outside the class
Create public member functions to access those data members
Create private member functions to access those data members
Create protected member functions to access those data members
35. Which among the following is not a necessary condition for constructors?
Its name must be same as that of class
It must not have any return type
It must contain a definition body
t can contains arguments
36. Object being passed to a copy constructor ______
Must not be mentioned in parameter list
Must be passed with integer type
Must be passed by value
Must be passed by reference
37. 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?
~A() then ~B() then ~C()
~C() then ~A() then ~B()
~C() then ~B() then ~A()
~B() then ~C() then ~A()
38. Instance of which type of class can’t be created?
Parent class
Abstract class
Anonymous class
Nested class
39. _______ underlines the feature of Polymorphism in a class.
Virtual Function
Inline function
Enclosing class
Nested class
40. Which feature in OOP is used to allocate additional functions to a predefined operator in any language?
Function Overloading
Function Overriding
Operator Overloading
Operator Overriding
41. Which feature can be implemented using encapsulation?
Polymorphism
Overloading
Inheritance
Abstraction
42. If a function can perform more than 1 type of tasks, where the function name remains same, which feature of OOP is used here?
Encapsulation
Inheritance
Polymorphism
Abstraction
43. 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?
Inheritance
Polymorphism
Abstraction
Encapsulation
44. Which of the following is not a feature of pure OOP?
Classes must be used
Inheritance
Data may/may not be declared using object
Functions Overloading
45. Which among the following doesn’t come under OOP concept?
Platform independent
Data binding
Message passing
Data hiding
46. 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; } };
Inheritance
Polymorphism
Inheritance and polymorphism
Encapsulation and Inheritance
47. Which feature may be violated if we don’t use classes in a program?
Inheritance can’t be implemented
Object must be used is violated
Encapsulation only is violated
Basically all the features of OOP gets violated
48. How many basic features of OOP are required for a programming language to be purely OOP?
7
6
5
4
49. The feature by which one object can interact with another object is ______
Data transfer
Data Binding
Message Passing
Message reading
50. Which feature in OOP is used to allocate additional function to a predefined operator in any language?
Operator Overloading
Function Overloading
Operator Overriding
Function Overriding
Submit