1. Who invented OOP?
a) Andrea Ferro
b) Adele Goldberg
c) Alan Kay
d) Dennis Ritchie
Answer: c
2. Which is not a feature of OOP in general definitions?
a) Efficient Code
b) Code reusability
c) Modularity
d) Duplicate/Redundant data
Answer: d
3. Which was the first purely object oriented programming language developed?
a) Kotlin
b) SmallTalk
c) Java
d) C++
Answer: b
4. When OOP concept did first came into picture?
a) 1980’s
b) 1995
c) 1970’s
d) 1993
Answer: c
5. Which feature of OOP indicates code reusability?
a) Abstraction
b) Polymorphism
c) Encapsulation
d) Inheritance
Answer: d
6. Which header file is required in C++ to use OOP?
a) OOP can be used without using any header file
b) stdlib.h
c) iostream.h
d) stdio.h
Answer: a
7. Why Java is Partially OOP language?
a) It allows code to be written outside classes
b) It supports usual declaration of primitive data types
c) It does not support pointers
d) It doesn’t support all types of inheritance
Answer: b
8. Which among the following doesn’t come under OOP concept?
a) Data hiding
b) Message passing
c) Platform independent
d) Data binding
Answer: c
9. Which is the correct syntax of inheritance?
a) class base_classname :access derived_classname{ /*define class body*/ };
b) class derived_classname : access base_classname{ /*define class body*/ };
c) class derived_classname : base_classname{ /*define class body*/ };
d) class base_classname : derived_classname{ /*define class body*/ };
Answer: b
10. The feature by which one object can interact with another object is _____________
a) Message reading
b) Message Passing
c) Data transfer
d) Data Binding
Answer: b
11. Which among the following, for a pure OOP language, is true?
a) The language should follow at least 1 feature of OOP
b) The language must follow only 3 features of OOP
c) The language must follow all the rules of OOP
d) The language should follow 3 or more features of OOP
Answer: c
12. How many types of access specifiers are provided in OOP (C++)?
a) 4
b) 3
c) 2
d) 1
Answer: b
13. In multilevel inheritance, which is the most significant feature of OOP used?
a) Code efficiency
b) Code readability
c) FlexibilityAnswer:
d) Code reusability
Answer: d
14. What is encapsulation in OOP?
a) It is a way of combining various data members and member functions that operate on those data members into a single unit
b) It is a way of combining various data members and member functions into a single unit which can operate on any data
c) It is a way of combining various data members into a single unit
d) It is a way of combining various member functions into a single unit
Answer: a
15. Which of the following is not true about polymorphism?
a) Helps in redefining the same functionality
b) Increases overhead of function definition always
c) It is feature of OOP
d) Ease in readability of program
Answer: b
16. What is an abstraction in object-oriented programming?
a) Hiding the implementation and showing only the features
b) Hiding the important data
c) Hiding the implementation
d) Showing the important data
Answer: a
17. Which among the following can show polymorphism?
a) Overloading &&
b) Overloading <<
c) Overloading ||
d) Overloading +=
Answer: b
18. In which access should a constructor be defined, so that object of the class can be created in any function?
a) Any access specifier will work
b) Private
c) Public
d) Protected
Answer: c
19. The copy constructors can be used to ________
a) Copy an object so that it can be passed to another primitive type variable
b) Copy an object for type casting
c) Copy an object so that it can be passed to a function
d) Copy an object so that it can be passed to a class
Answer: c
20. Which among the following represents correct constructor?
a) –classname()
b) classname()
c) ()classname
d) ~classname()
Answer: b
21. What happens when an object is passed by reference?
a) Destructor is called at end of function
b) Destructor is called when called explicitly
c) Destructor is not called
d) Destructor is called when function is out of scope
Answer: c
22. Which access specifier is usually used for data members of a class?
a) Protected
b) Private
c) Public
d) Default
Answer: b
23. How to access data members of a class?
a) Dot, arrow or direct call
b) Dot operator
c) Arrow operator
d) Dot or arrow as required
Answer: d
24. Which feature of OOP reduces the use of nested classes?
a) Inheritance
b) Binding
c) Abstraction
d) Encapsulation
Answer: a
25. Which keyword among the following can be used to declare an array of objects in java?
a) allocate
b) arr
c) new
d) create
Answer: c
Join Telegram Group for Instant Mock | Join Group |
Join WhatsApp Channel | Click Here |
26. Which operator can be used to free the memory allocated for an object in C++?
a) Unallocate
b) Free()
c) Collect
d) delete
Answer: d
27. Which of the following is not a property of an object?
a) Properties
b) Names
c) Identity
d) Attributes
Answer: b
28. Which type of members can’t be accessed in derived classes of a base class?
a) All can be accessed
b) Protected
c) Private
d) Public
Answer: c
29. Which among the following best describes the Inheritance?
a) Using the data and functions into derived segment
b) Using already defined functions in a programming language
c) Using the code already written once
d) Copying the code already written
Answer: a
30. Single level inheritance supports _____________ inheritance.
a) Language independency
b) Multiple inheritance
c) Compile time
d) Runtime
Answer: d
31. How to overcome diamond problem?
a) Using seperate derived class
b) Using virtual keyword with same name function
c) Can’t be done
d) Using alias name
Answer: b
32. Which keyword is used to declare virtual functions?
a) virt
b) virtually
c) virtual
d) anonymous
Answer: c
33. What happens if non static members are used in static member function?
a) Executes fine
b) Compile time error
c) Executes if that member function is not used
d) Runtime error
Answer: b
34. What is friend member functions in C++?
a) Non-member functions which have access to all the members (including private) of a class
b) Member function which doesn’t have access to private members
c) Member function which can modify any data of a class
d) Member function which can access all the members of a class
Answer: a
35. Where is the memory allocated for the objects?
a) Cache
b) ROM
c) HDD
d) RAM
Answer: d
36. Which of the following best describes member function overriding?
a) Member functions having the same name in derived class only
b) Member functions having the same name and different signature inside main function
c) Member functions having the same name in base and derived classes
d) Member functions having the same name in base class only
Answer: c
37. Encapsulation and abstraction differ as ____________
a) Hiding and hiding respectively
b) Binding and Hiding respectively
c) Hiding and Binding respectively
d) Can be used any way
Answer: b
38. Which feature of OOP is exhibited by the function overriding?
a) Polymorphism
b) Encapsulation
c) Abstraction
d) Inheritance
Answer: a
39. How to access the private member function of a class?
a) Using class address
b) Using object of class
c) Using object pointer
d) Using address of member function
Answer: d
40. Which keyword should be used to declare static variables?
a) const
b) common
c) static
d) stat
Answer: c
41. Which is correct syntax for declaring pointer to object?
a) *className objectName;
b) className* objectName;
c) className objectName();
d) className objectName;
Answer: b
42. If data members are private, what can we do to access them from the class object?
a) Private data members can never be accessed from outside the class
b) Create public member functions to access those data members
c) Create private member functions to access those data members
d) Create protected member functions to access those data members
Answer: b
43. Which among the following is not a necessary condition for constructors?
a) Its name must be same as that of class
b) It must not have any return type
c) It must contain a definition body
d) It can contains arguments
Answer: c
44. Object being passed to a copy constructor ___________
a) Must not be mentioned in parameter list
b) Must be passed with integer type
c) Must be passed by value
d) Must be passed by reference
Answer: d
45. 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) ~A() then ~B() then ~C()
b) ~C() then ~A() then ~B()
c) ~C() then ~B() then ~A()
d) ~B() then ~C() then ~A()
Answer: c
46. Instance of which type of class can’t be created?
a) Parent class
b) Abstract class
c) Anonymous class
d) Nested class
Answer: b
47. ___________ underlines the feature of Polymorphism in a class.
a) Virtual Function
b) Inline function
c) Enclosing class
d) Nested class
Answer: a
48. Which feature in OOP is used to allocate additional functions to a predefined operator in any language?
a) Function Overloading
b) Function Overriding
c) Operator Overloading
d) Operator Overriding
Answer: c
49. Which feature can be implemented using encapsulation?
a) Polymorphism
b) Overloading
c) Inheritance
d) Abstraction
Answer: d
50. Which was the first purely object oriented programming language developed?
a) Java
b) C++
c) SmallTalk
d) Kotlin
Answer: c
Join Telegram Group for Instant Mock | Join Group |
Join WhatsApp Channel | Click Here |