OOP
MCQS
A. Tick () the correct option.
1. A set of instructions given to a computer to do a particular task.
a. Program
b. High level Language
c. Object
d. None of these
Ans. a. Program
2. An object is represented by two attributes, out of which one is characteristics and the
other one
is ___________.
a. Behaviour
b. Situation
c. Abstraction
d. Encapsulation
Ans. a. Behaviour
3. Name the programming technique that implements programs as an organized collection
of
interactive objects.
a. Procedure Oriented Programming
b. Modular Programming
c. Object Oriented Programming
d. None of these
Ans. c. Object Oriented Programming
4. Name the programming technique that specifies a series of well-structured steps and
procedures
within its programming context to compose a program.
a. Procedure Oriented Programming
b. Modular Programming
c. Object Oriented Programming
d. None of these
Ans a. Procedure Oriented Programming
5. Name the characteristics of Object Oriented Programming that hides the complexity and
provides a simple interface.
a. Encapsulation
b. Polymorphism
c. Abstraction
d. Inheritance
Ans. c. Abstraction
6. What is the behaviour aspect of an object represented by?
a. Member Functions
b. Data Members
c. Both a and b
d. None of these
Ans. a. Member Functions
7. What is the ability of an object to take on many forms called?
a. Polymorphism
b. Encapsulation
c. Abstraction
d. Inheritance
Ans. a. Polymorphism
8. What is the term that is used to represent hierarchical relationship of generalization?
a. Polymorphism
b. Encapsulation
c. Abstraction
d. Inheritance
Ans. d. Inheritance
9. Name the art of implementing Encapsulation in Object Oriented Programming.
a. Polymorphism
b. Encapsulation
c. Abstraction
d. class
Ans. d. class
10. What is meant by state of an object?
a. Functions of the object
b. Data Members of the object
c. Content of an object
d. All of these
Ans. c. Content of an object
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) Duplicate/Redundant data
3. Which was the first purely object oriented programming language developed?
a) Kotlin
b) SmallTalk
c) Java
d) C++
Answer: SmallTalk.
5. Which feature of OOP indicates code reusability?
a) Abstraction
b) Polymorphism
c) Encapsulation
d) Inheritance
Answer: Inheritance.
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: It supports usual declaration of primitive data types.
8. Which among the following doesn’t come under OOP concept?
a) Data hiding
b) Message passing
c) Platform independent
d) Data binding
Answer: Platform independent.
11. 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: Message passing.
14. In multilevel inheritance, which is the most significant feature of OOP used?
a) Code efficiency
b) Code readability
c) Flexibility
d) Code reusability
Answer: Code reusability.
15. 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: Option A
16. 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: Increases overhead of function definition always.
18. 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: Hiding the implementation and showing only the features.
20. 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: Public.
22. 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: Copy an object so that it can be passed to a function.
26. Which access specifier is usually used for data members of a class?
a) Protected
b) Private
c) Public
d) Default
Answer: Private
27. 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: Dot or arrow required.
28. Which feature of OOP reduces the use of nested classes?
a) Inheritance
b) Binding
c) Abstraction
d) Encapsulation
Answer: Inheritance
31. Which of the following is not a property of an object?
a) Properties
b) Names
c) Identity
d) Attributes
Answer: Names.
32. 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: Private.
33. 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: Option A
34. Single level inheritance supports _____________ inheritance.
a) Language independency
b) Multiple inheritance
c) Compile time
d) Runtime
Answer: Runtime.
37. 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: Compile time error.
39. Where is the memory allocated for the objects?
a) Cache
b) ROM
c) HDD
d) RAM
Answer: RAM
41. 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: Binding and hiding respectively.
42. Which feature of OOP is exhibited by the function overriding?
a) Polymorphism
b) Encapsulation
c) Abstraction
d) Inheritance
Answer: Polymorphism
43. 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: Using address of member function.
51. Instance of which type of class can’t be created?
a) Parent class
b) Abstract class
c) Anonymous class
d) Nested class
Answer: Abstract class.
54. Which feature can be implemented using encapsulation?
a) Polymorphism
b) Overloading
c) Inheritance
d) Abstraction
Answer: Abstraction.
1. Which of these features of OOP would indicate code reusability?
a. Polymorphism
b. Abstraction
c. Inheritance
d. Encapsulation
Answer: (c) Inheritance
3. Which of these specifiers would be applied to the constructors only?
a. Explicit
b. Implicit
c. Protected
d. Public
Answer: (a) Explicit
4. A constructor _____________.
a. May consist of a return type
b. Doesn’t consist of any return type
c. Has some return type
d. Of a derived class has a return type
Answer: (b) Doesn’t consist of any return type
8. Which of these classes is a specialization of some more general template classes?
a. Integer
b. Maths
c. String
d. Digit
Answer: (c) String
9. A derived class is also called a ______________.
a. Small class
b. Subclass
c. Noticeable class
d. Big class
Answer: (b) Subclass
12. What is the name of the feature in which we enforce the definitions of the abstract
function at the compile time?
a. Dynamic Polymorphism
b. Static Polymorphism
c. Dynamic or Static Polymorphism according to need
d. Polymorphism
Answer: (a) Dynamic Polymorphism / overriding
14. __________ is the universal handler class for exceptions.
a. Maths
b. Object
c. Exceptions
d. Errors
Answer: (c) Exceptions
18. Which of these types of values result from a delete operator?
a. null
b. null pointer
c. void pointer
d. void
Answer: (d) void
21) How many types of polymorphism 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
Answer: Two types of polymorphism
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
Answer: d. Encapsulation
30) Encapsulation adds the function in a user-defined structure.
a. True
b. False
Answer: False
37) The object cannot be________?
a. passed by copy
b. passed as function
c. passed by value
d. passed by reference
Answer: Passed as functions
42) The combination of abstraction of the data and code is viewed in________. Inheritance
a. Object
b. Class
c. Interfaces
Answer: Interfaces
1. ____ is considered to be a partitioned area of computer memory that
stores and set of operations that can access the data.
A. Classes
B. Objects
C. Variables
D. Functions
Answer: B) Objects
2. When a program is executed, the ____ interacted by sending a message
to one another.
A. Objects
B. Classes
C. Operating system
D. Memory
Answer: A) Objects
3. Objects are the variables of the type ____?
A. String
B. Boolean
C. Class
D. All data types can be included
Answer: C) Class
5. Why classes are 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
Answer: D) Because it uses the concept of data abstraction
98. The scope resolution operator is used to ____ function in the
Inheritance.
A. Overload
B. Override
Answer: B) Override
100. How many types of functions are there in an object-oriented
programming language?
A. 4 types
B. 5 types
C. 2 types
D. 6 types
Answer: B) 5 types
25. A static member function can be called using the ____ name.
A. Class name
B. Object name
Answer: A) Class name
24. ____ member variables are initialized to zero when the first object of
its class is created?
A. Static
B. Local
C. Global
D. External
Answer: A) Static
17. Which features of OOP are extensively used in implementing
inheritance?
A. Dynamic binding
B. Abstraction
C. Operator overloading
D. Polymorphism
Answer: D) Polymorphism
15. Object-oriented languages follow which approach?
A. Top-down approach
B. Bottom-up approach
Answer: B) Bottom-up approach
4. Procedure-oriented languages follow which approach?
A. Top-down approach
B. Bottom-up approach
Answer: A) Top-down approach
9. Which concept is not supported by object-based programming
languages?
A. Inheritance
B. Dynamic binding
C. Only A
D. Both A and B
Answer: b) B************
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
Answer: D) It supports abstract data but not the class
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
Answer: A) Data encapsulation
3. Objects are the variables of the type ____?
A. String
B. Boolean
C. Class
D. All data types can be included
Answer: C) Class