Quiz: Analysis of Encapsulation, Inheritance, and
Polymorphism in Complex Systems
Course: CSIS 312 - Advanced Object-Oriented Programming
Score for this quiz: 50 out of 50
LIBERTY UNIVERSITY
Question 1 2.5/2.5 pts
What is encapsulation in object-oriented programming?
A) Hiding the internal state and requiring all interactions to be
performed through an object's methods
B) Creating a blueprint for objects
C) Inheriting properties from another class
D) Defining multiple methods with the same name
Answer: A) Hiding the internal state and requiring all
interactions to be performed through an object's methods
Question 2 2.5/2.5 pts
Which of the following is a key advantage of encapsulation?
A) Enhanced security by protecting data integrity
B) Increasing the number of objects in a system
C) Simplifying the inheritance process
D) Allowing multiple inheritance
Answer: A) Enhanced security by protecting data integrity
Question 3 2.5/2.5 pts
What is inheritance in object-oriented programming?
A) The process by which one class acquires the properties and
behaviors of another class
B) The technique of hiding the implementation details
C) The act of creating objects from a class
D) Defining a new class by modifying an existing one
Answer: A) The process by which one class acquires the
properties and behaviors of another class
Question 4 2.5/2.5 pts
What is the term for the class that is inherited from?
A) Parent class
B) Child class
C) Derived class
D) Concrete class
Answer: A) Parent class
Question 5 2.5/2.5 pts
In multiple inheritance, a class can inherit from:
A) More than one class
B) Only one class
C) Two classes maximum
D) Three classes maximum
Answer: A) More than one class
Question 6 2.5/2.5 pts
Polymorphism in object-oriented programming refers to:
A) The ability of different classes to respond to the same message
in different ways
B) Creating multiple instances of the same class
C) Inheriting from multiple classes
D) The process of defining a class
Answer: A) The ability of different classes to respond to
the same message in different ways
Question 7 2.5/2.5 pts
What is method overriding in OOP?
A) Redefining a method in a subclass that exists in its parent class
B) Defining multiple methods with the same name in the same
class
C) Changing the return type of a method
D) Creating an interface
Answer: A) Redefining a method in a subclass that exists
in its parent class
Question 8 2.5/2.5 pts
Which of the following allows for polymorphism in OOP?
A) Inheritance
B) Encapsulation
C) Abstraction
D) Data binding
Answer: A) Inheritance
Question 9 2.5/2.5 pts
What is the primary purpose of inheritance?
A) To promote code reusability
B) To protect data
C) To create multiple instances of an object
D) To define interfaces
Answer: A) To promote code reusability
Question 10 2.5/2.5 pts
Which keyword is used to inherit from a class in Java?
A) extends
B) implements
C) inherits
D) override
Answer: A) extends
Question 11 2.5/2.5 pts
Which of the following is true about method overloading?
A) Methods with the same name but different parameters are
defined in the same class
B) A method in a subclass overrides a method in its superclass
C) It is used to implement interfaces
D) It hides the implementation details of methods
Answer: A) Methods with the same name but different
parameters are defined in the same class
Question 12 2.5/2.5 pts
What is an abstract class in OOP?
A) A class that cannot be instantiated and is meant to be
subclassed
B) A class that can only be instantiated once
C) A class that hides all of its methods
D) A class that does not have any methods
Answer: A) A class that cannot be instantiated and is
meant to be subclassed
Question 13 2.5/2.5 pts
What does the keyword super refer to in a subclass?
A) The superclass of the current subclass
B) The current instance of the subclass
C) A global variable in the subclass
D) A method in the subclass
Answer: A) The superclass of the current subclass
Question 14 2.5/2.5 pts
Which of the following is true about interfaces in OOP?
A) An interface defines a contract that implementing classes must
fulfill
B) An interface can have method implementations
C) An interface can only be implemented by one class
D) An interface can be instantiated
Answer: A) An interface defines a contract that
implementing classes must fulfill
Question 15 2.5/2.5 pts
What is the main difference between an abstract class and an
interface?
A) An abstract class can have implemented methods, while an
interface cannot
B) An interface can be instantiated, but an abstract class cannot
C) An interface allows multiple inheritance, but an abstract class
does not
D) There is no difference
Answer: A) An abstract class can have implemented
methods, while an interface cannot
Question 16 2.5/2.5 pts
What is encapsulation often used to achieve in OOP?
A) Information hiding
B) Method overloading
C) Object cloning
D) Multiple inheritance
Answer: A) Information hiding
Question 17 2.5/2.5 pts
What is a concrete class?
A) A class that has an implementation for all of its methods
B) A class that cannot be instantiated
C) A class that only contains abstract methods
D) A class that inherits from multiple classes
Answer: A) A class that has an implementation for all of its
methods
Question 18 2.5/2.5 pts
Which of the following is an example of polymorphism?
A) A subclass method overrides a superclass method
B) A method calls another method
C) A variable stores a value
D) A class is instantiated
Answer: A) A subclass method overrides a superclass
method
Question 19 2.5/2.5 pts
What does method overriding allow?
A) A subclass to provide a specific implementation of a method
that is already defined by its superclass
B) A class to define multiple methods with the same name
C) A class to hide the implementation details of a method
D) A class to instantiate objects
Answer: A) A subclass to provide a specific
implementation of a method that is already defined by its
superclass
Question 20 2.5/2.5 pts
What is the purpose of the final keyword in Java?
A) To prevent a class from being subclassed
B) To allow method overloading
C) To enable multiple inheritance
D) To allow a class to be instantiated
Answer: A) To prevent a class from being subclassed
Question 21 2.5/2.5 pts
What does "is-a" relationship refer to in OOP?
A) Inheritance
B) Encapsulation
C) Abstraction
D) Object creation
Answer: A) Inheritance
Question 22 2.5/2.5 pts
What does "has-a" relationship refer to in OOP?
A) Composition
B) Inheritance
C) Polymorphism
D) Method overloading
Answer: A) Composition
Question 23 2.5/2.5 pts
Which of the following best describes composition in OOP?
A) A class contains a reference to one or more objects of other
classes
B) A class inherits from multiple classes
C) A class overrides methods of its superclass
D) A class implements multiple interfaces
Answer: A) A class contains a reference to one or more
objects of other classes
Question 24 2.5/2.5 pts
What is an interface in Java?
A) A reference type in Java, it is similar to class, it is a collection of
abstract methods
B) A class with implemented methods
C) A blueprint for objects
D) A method that overrides another method
Answer: A) A reference type in Java, it is similar to class, it
is a collection of abstract methods
Question 25 2.5/2.5 pts
What is a subclass in OOP?
A) A class that is derived from another class
B) A class that has no parent
C) A class with abstract methods
D) A class that cannot be instantiated
Answer: A) A class that is derived from another class
Question 26 2.5/2.5 pts
What does dynamic binding refer to in OOP?
A) The process of resolving method calls at runtime
B) The process of compiling code
C) The process of linking classes
D) The process of creating objects
Answer: A) The process of resolving method calls at
runtime
Question 27 2.5/2.5 pts
Which of the following is a real-world example of polymorphism?
A) A door can be opened with a key or a card
B) A bank account
C) A blueprint of a house
D) A database schema
Answer: A) A door can be opened with a key or a card
Question 28 2.5/2.5 pts
Which OOP principle helps in reducing the complexity of software?
A) Abstraction
B) Instantiation
C) Cloning
D) Casting
Answer: A) Abstraction
Question 29 2.5/2.5 pts
What is method overloading?
A) Defining multiple methods in the same class with the same
name but different parameters
B) Defining a method in a subclass that overrides a method in the
superclass
C) Defining methods with the same name and parameters in
different classes
D) Defining a method that does not return a value
Answer: A) Defining multiple methods in the same class
with the same name but different parameters
Question 30 2.5/2.5 pts
Which keyword is used to create an abstract method in Java?
A) abstract
B) final
C) static
D) void
Answer: A) abstract
Question 31 2.5/2.5 pts
In OOP, what does the "open/closed principle" state?
A) Software entities should be open for extension but closed for
modification
B) Methods should be open to all classes
C) Objects should not be closed after instantiation
D) Interfaces should be open for all classes
Answer: A) Software entities should be open for extension
but closed for modification
Question 32 2.5/2.5 pts
Which design pattern is based on encapsulation of an algorithm
inside a class?
A) Strategy Pattern
B) Singleton Pattern
C) Factory Pattern
D) Adapter Pattern
Answer: A) Strategy Pattern
Question 33 2.5/2.5 pts
What is the "Liskov Substitution Principle" in OOP?
A) Objects of a superclass should be replaceable with objects of a
subclass without affecting the correctness of the program
B) A class should inherit from more than one class
C) Objects should only interact with their own classes
D) A method should only be overridden if it improves the
performance
Answer: A) Objects of a superclass should be replaceable
with objects of a subclass without affecting the
correctness of the program
Question 34 2.5/2.5 pts
What does the term "inheritance hierarchy" refer to?
A) The structure of classes based on their inheritance
relationships
B) The order in which methods are called
C) The process of creating objects
D) The sequence in which classes are defined
Answer: A) The structure of classes based on their
inheritance relationships
Question 35 2.5/2.5 pts
What is method hiding?
A) When a static method in a subclass hides a static method in
the superclass
B) When an instance method overrides a method in the
superclass
C) When a method is declared private
D) When a method is not accessible to other classes
Answer: A) When a static method in a subclass hides a
static method in the superclass
Question 36 2.5/2.5 pts
Which of the following is a benefit of using inheritance in OOP?
A) Code reuse and reduction of redundancy
B) Increased number of methods in a class
C) Decreased performance
D) Complicated code structure
Answer: A) Code reuse and reduction of redundancy
Question 37 2.5/2.5 pts
What is a major drawback of multiple inheritance?
A) The diamond problem, where ambiguity can arise
B) Code duplication
C) Lack of encapsulation
D) Lack of polymorphism
Answer: A) The diamond problem, where ambiguity can
arise
Question 38 2.5/2.5 pts
In the context of OOP, what is the "diamond problem"?
A) A situation where a class inherits from two classes that have a
common ancestor, leading to ambiguity
B) A problem related to method overloading
C) An error in runtime method resolution
D) A situation where polymorphism fails
Answer: A) A situation where a class inherits from two
classes that have a common ancestor, leading to
ambiguity
Question 39 2.5/2.5 pts
Which principle suggests that a class should have only one reason
to change?
A) Single Responsibility Principle
B) Open/Closed Principle
C) Dependency Inversion Principle
D) Interface Segregation Principle
Answer: A) Single Responsibility Principle
Question 40 2.5/2.5 pts
What does the "Interface Segregation Principle" advocate?
A) Clients should not be forced to depend on interfaces they do
not use
B) Interfaces should be open for modification
C) Interfaces should be inherited by all classes
D) Interfaces should be kept minimal
Answer: A) Clients should not be forced to depend on
interfaces they do not use
Question 41 2.5/2.5 pts
What is the purpose of the "Dependency Inversion Principle"?
A) High-level modules should not depend on low-level modules;
both should depend on abstractions
B) Dependencies should be inverted in a hierarchy
C) High-level classes should inherit from low-level classes
D) Methods should not depend on object states
Answer: A) High-level modules should not depend on low-
level modules; both should depend on abstractions
Question 42 2.5/2.5 pts
What is a mixin?
A) A class that provides a certain functionality to be inherited by a
subclass but is not intended to stand alone
B) A method that overrides another method
C) A class that cannot be instantiated
D) A design pattern for object creation
Answer: A) A class that provides a certain functionality to
be inherited by a subclass but is not intended to stand
alone
Question 43 2.5/2.5 pts
What does method chaining refer to in OOP?
A) A technique where multiple methods are called on the same
object sequentially
B) Overriding multiple methods in a subclass
C) The process of linking classes together
D) Creating multiple instances of a class
Answer: A) A technique where multiple methods are called
on the same object sequentially
Question 44 2.5/2.5 pts
Which OOP principle allows a subclass to provide a specific
implementation of a method that is already defined by its
superclass?
A) Method Overriding
B) Method Overloading
C) Encapsulation
D) Abstraction
Answer: A) Method Overriding
Question 45 2.5/2.5 pts
What is the primary benefit of using abstraction in OOP?
A) It hides implementation details and shows only essential
features of an object
B) It allows multiple classes to inherit from one another
C) It improves the speed of the program
D) It reduces the number of methods in a class
Answer: A) It hides implementation details and shows only
essential features of an object
Question 46 2.5/2.5 pts
Which of the following is true about static methods in OOP?
A) Static methods belong to the class rather than an instance of
the class
B) Static methods can only be called from an instance of the class
C) Static methods cannot access other static members of the
class
D) Static methods are the same as instance methods
Answer: A) Static methods belong to the class rather than
an instance of the class
Question 47 2.5/2.5 pts
What is the purpose of constructors in OOP?
A) To initialize the state of an object when it is created
B) To destroy an object when it is no longer needed
C) To create a blueprint for objects
D) To define a contract for classes
Answer: A) To initialize the state of an object when it is
created
Question 48 2.5/2.5 pts
What is a destructor in OOP?
A) A method that is automatically invoked when an object is
destroyed
B) A method that initializes the state of an object
C) A method that creates an object
D) A method that overrides another method
Answer: A) A method that is automatically invoked when
an object is destroyed
Question 49 2.5/2.5 pts
Which of the following best describes the concept of object
cloning?
A) Creating an exact copy of an existing object
B) Creating a subclass from an existing class
C) Inheriting properties from a superclass
D) Copying methods from one class to another
Answer: A) Creating an exact copy of an existing object
Question 50 2.5/2.5 pts
What does the "tell, don't ask" principle advocate in OOP?
A) Objects should perform actions rather than asking about the
state of other objects
B) Methods should only ask for information and not perform
actions
C) Objects should be interrogated for their states
D) The principle does not exist
Answer: A) Objects should perform actions rather than
asking about the state of other objects