OOPs MCQ (Multiple Choice Questions) With Answers
1. ____ is considered a partitioned area of computer memory that stores a set of operations to access the data.
a. Classes
b. Objects
c. Variables
d. Functions
2. When a program is executed, the ____ interacts by sending a message to one another.
a. Objects
b. Classes
c. Operating system
d. Memory
3. Objects are the variables of the type ____?
a. String
b. Boolean
c. Class
d. All data types can be included
4. What is the most striking feature of Class?
a. Data encapsulation
b. Collection of objects of similar type
c. Inheritance
d. All of the above
5. Why are classes known as abstract data types (ADT)?
a. Because classes are user-defined data types
b. Because it supports the theory of hierarchical classification
c. Because it allows dynamic binding
d. Because it uses the Concept of data abstraction
6. Which is not true about the object-oriented approach?
a. Emphasis is on data rather than procedure
b. Data is hidden and cannot be accessed by external functions
c. Objects communicate through functions
d. It supports abstract data but not the Class
7. Which language among the following supports an object-oriented approach?
a. Modula-3
b. Ada 95
c. Modula-2
d. Both A and B
8. Which language among the following supports an object-based approach?
a. Modula-3
b. Modula-2
c. Ada 95
d. 83 Ada
9. Which Concept is not supported by object-based programming languages?
a. Inheritance
b. Dynamic binding
c. Only A
d. Both A and B
10. Which approach among the following supports all the features along with Inheritance and dynamic binding?
a. Object-based approach
b. Object-oriented approach
11. How many layers are present in the OO design pyramid?
a. three
b. four
c. five
d. one
12. Which of the following early OOD methods incorporates both a “micro development process” and a “macro development process.”?
a. Booch method
b. Rumbaugh method
c. Wirfs-Brock method
d. Coad and Yourdon’s method
13. Grady Booch, James Rumbaugh, and Ivar Jacobson combined the best features of their object-oriented analysis into a new method for Object-oriented design known as
a. HTML
b. XML
c. UML
d. SGML
14. A design description of an object is known as a class
a instance
b. Object
c. case
d. both instance and Object
15. Which of the following is conceptually similar to objects?
a. PACKAGE
b. PROC
c. PRIVATE
d. None of the mentioned
16. A design description in OOD includes
a. Protocol Description
b. Implementation Description
c. Type Description
d. Both protocol and Implementation Description
17. Which of the following is not an operation per OOD algorithms and data structures?
a. operations that manipulate data in some way
b. operations that perform a computation
c. operations that check for syntax errors
d. operations that monitor an object for the occurrence of a controlling event
18. a software engineer should look for every opportunity to create a new design process throughout the OOD process.
a. True
b. False
19. Which of the following OOP concepts is not valid for the C++ programming language?
a. A class must have member functions
b. C++ Programs can be easily written without the use of classes
c. At least one instance should be declared within the C++ program
d. C++ Program must contain at least one Class
20. What is the extra feature in classes which was not in the structures?
a. Member functions
b. Data members
c. Public access specifier
d. Static Data allowed
21. How many types of Polymorphism exist in the C++ programming language?
a. Three types of Polymorphism
b. Two types of Polymorphism
c. Five types of Polymorphism
d. Four types of Polymorphism
22. Which features are also known as run-time binding or late binding?
a. Dynamic typing
b. Dynamic loading
c. Dynamic binding
23. Which among the following is not a member of the Class?
a. Virtual function
b. const function
c. Static function
d. Friend function
24. Which of the following Class is known as the generic Class?
a. Final Class
b. Template class
c. Abstract Class
d. Efficient code
25. Which Operator overloads using the friend function?
a. *
b. ( )
c. ->
d. =
26. Which of the following OOP concept binds the code and data together and keeps them secure from the outside world?
a. Polymorphism
b. Inheritance
c. Abstraction
d. Encapsulation
27. Which member of the superclass is never accessible to the subclass?
a. Public Member
b. Protected member
c. Private Member
d. All of the mentioned
28. What is the size of a class?
a. Sum of the size of all inherited variables along with the variables of the same Class
b. The size of the Class is the largest size of the variable of the same Class
c. Classes in the programming languages do not have any size
d. Sum of the size of all the variables within a class.
29. Which Class cannot create its instance?
a. Parent class
b. Nested Class
c. Anonymous Class
d. Abstract Class
30. Encapsulation adds the function in a user-defined structure.
a. True
b. False
31. Which of the following variables violates the definition of Encapsulation?
a. Array variables
b. Local variables
c. Global variables
d. Public variables
32. How can the Concept of Encapsulation be achieved in the program?
a. By using the Access specifiers
b. By using the Concept of Abstraction
c. By using only private members
d. By using the Concept of Inheritance
33. The Concept of Encapsulation helps write which types of classes are in the Java programming language.
a. Abstract classes
b. Wrapper classes
c. Mutable classes
d. Immutable classes
34. Encapsulation is_____?
a. technique of combining more than one member function into a single unit.
b. mechanism of combining more than one data member into a single unit.
c. mechanism of combining more than one data member and member functions that implement on those data members into a single unit
d. technique of combining multiple data members and member functions into a single unit, which can manipulate any data.
35. Which of the following statements of a program is not correct?
a. class teacher{ }; teacher s[5];
b. class teacher{ }s;
c. class teacher{ }; teacher s;
d. class teacher{ }s[];
36. Which of the following syntax is incorrect for the class definition?
a. student class{ };
b. class student{ student(int a){} };
c. class teacher{ public: teacher(int a){ } };
d. None of the mentioned
37. The object cannot be________?
a. passed by copy
b. passed as a function
c. passed by value
d. passed by reference
38. Which of the following features does not fall under the Concept of OOPS?
a. Data binding
b. Data hiding
c. Platform independent
d. Message Passing
39. Which feature may be broken if the user does not use the classes in the code?
a. Object must be used violated
b. Only the encapsulation concept is violated
c. Inheritance cannot be implemented
d. Basically, all the features of OOPS get violated
40. Which of the following features interacts one Object with another object?
a. Message reading
b. Message Passing
c. Data transfer
d. Data binding
41. Which of the following is correct concerning the OOP concept in Python?
a. Objects are real-world entities, while classes are not actual.
b. Classes are real-world entities, while objects are not natural.
c. Both objects and classes are real-world entities.
d. Both Objects and classes are not natural.
42. How many objects and reference variables exist for the given Python code?
a. 2 and 1
b. 3 and 3
c. 3 and 1
d. 3 and 2
43. Which of the following is False concerning Python code?
a. “std” is the reference variable for object Student(1,20)
b. id and age are called the parameters.
c. Every Class must have a constructor.
d. None of the above
44. What will be the output of the below Python code?
a. 1
b. 1
c. 2
d. 2
45. What will be the output of the below Python code?
a. 100
b. 102
c. 102
d. Error
46. Which of the following is correct?
a. id(a1) and id(a2) will have same value.
b. id(a1) and id(a2) will have different values.
c. Two objects with the same attribute value cannot be created.
d. None of the above
47. Which of the following is correct?
a. 5
b. 6
c. 0
d. Error
48. Which of the following is correct?
a. Both book one and book two will have references to two different objects in the class book.
b. id(book1) and id(book2) will have same value.
c. It will throw an error as multiple references to the same Object are impossible.
d. None of the above
49. In Python, what is the method inside Class?
a. attribute
b. Object
c. argument
d. function
50. What will be the output of the below Python code?
a. 7
b. 5
c. 3
d.7
51. Which of the following is a static polymorphism mechanism?
a. Function overloading
b. Operator overloading
c. Templates
d. All of the mentioned
52. Which of the following is true?
I) All operators in C++ can be overloaded.
II) The basic meaning of an operator can be changed.
a. I only
b. II only
c. Both I and II
d. Neither I nor II
53. Which of the following is not a type of Inheritance?
a. Multiple
b. Multilevel
c. Distributive
d. Hierarchical
54. What happens if a class does not have a name?
a. It will not have a constructor
b. It will not have a destructor
c. It is not allowed
d. It will neither have a constructor nor a destructor
55. Which of the following statements is true?
I) In Procedural programming languages, all function calls are resolved at compile-time
II) In Object Oriented programming languages, all function calls are resolved at compile-time
a. I only
b. II only
c. Both I and II
d. Neither I nor II
56. Which members are inherited but are not accessible in any case?
a. Private
b. Public
c. Protected
d. Both private and protected
57. Which of the following is correct?
a. Friend functions can access public members of a class
b. Friend functions can access protected members of a class
c. Friend functions can access private members of a class
d. All of the mentioned
58. Which of the following is correct in C++?
a. Classes cannot have protected data members
b. Structures can have member functions
c. Class members are public by default
d. Structure members are private by default
59. Which of the following is used to make an abstract class?
a. By using a virtual keyword in front of a class declaration
b. By using an abstract keyword in front of a class declaration
c. By declaring a virtual function in a class
d. By declaring a pure virtual function in a class
60. Which of the following is correct?
a. A class is an instance of its objects
b. An object is an instance of its Class
c. A class is an instance of the data type that the Class have
d. An object is an instance of the data type of the Class
61. Wrapping data and its related functionality into a single entity is known as _____________
a. Abstraction
b. Encapsulation
c. Polymorphism
d. Modularity
62. How do structures and classes in C++ differ?
a. In Structures, members are public by default, whereas, in Classes, they are private by default
b. In Structures, members are private by default, whereas, in Classes, they are public by default
c. Structures, by default, hide every member, whereas classes do not
d. Structures cannot have private members, whereas classes can have
63. What does Polymorphism in OOPs mean?
a. Concept of allowing overriding of functions
b. Concept of hiding data
c Concept of keeping things in different modules/files
d. Concept of wrapping things into a single unit
64. Which Concept allows you to reuse the written code?
a. Encapsulation
b. Abstraction
c. Inheritance
d. Polymorphism
65. Which of the following explains Polymorphism?
a. int func(int, int); float func1(float, float);
b. int func(int); int func(int);
c. int func(float); float func(int, int, char);
d. int func(); int new_func();
66. Which of the following shows multiple inheritances?
a. A->B->C
b. A->B; A->C
c. A, B->C
d. B->A
67. How do access specifiers in Class help in Abstraction?
a. They do not help in any way
b. They allow us to show only required things to the outer world
c. They help in keeping things together
d. Abstraction concept is not used in classes
68. C++ is ______________
a. procedural programming language
b. Object-oriented programming language
c. functional programming language
d. both procedural and Object-oriented programming language
69. What does modularity mean?
a. Hiding part of the program
b. Subdividing the program into small independent parts
c. Overriding parts of the program
d. Wrapping things into a single unit
70. Which of the following features of OOPs is not used in the following C++ code?
a. Abstraction
b. Encapsulation
c. Inheritance
d. Polymorphism