OOP Mid
Types of constructors.
Select the correct answer
Constructors can be local, global, and abstract
Constructors can be static, dynamic, and virtual
Constructors can be private, public, and protected
Constructors can be default, parameterized, and copy constructors
What is a destructor?
Select the correct answer
A destructor is a method used to encapsulate data
A destructor is a type of polymorphism
A destructor is a method used to create objects
A destructor is a method called when an object is destroyed
Explain the concept of composition in OOP.
Select the correct answer
Composition is the process of hiding data within a class
Composition is a way to define multiple methods in a class
Composition is a method of inheritance in OOP
Composition is a design principle where a class contains objects of other classes
What is constructor chaining?
Select the correct answer
Constructor chaining is calling one constructor from another constructor
Constructor chaining is defining multiple constructors in a class
Constructor chaining is a type of polymorphism
Constructor chaining is a method of overloading functions
What is a constructor?
Select the correct answer
A constructor is a type of inheritance in OOP
A constructor is a method used to encapsulate data
A constructor is a special method used to initialize objects
A constructor is a method used to define class variables
Define virtual functions.
Select the correct answer
Virtual functions are methods that cannot be inherited
Virtual functions are used to define multiple methods with the same name
Virtual functions are used to hide data within a class
Virtual functions allow derived classes to override methods in a base class
What are the limitations of inheritance?
Select the correct answer
Inheritance is the best way to implement all functionalities
Inheritance ensures complete encapsulation
Inheritance always simplifies the design of a system
Inheritance can lead to increased complexity and reduced flexibility
What is coupling in OOP?
Select the correct answer
Coupling is the process of inheriting properties from another class
Coupling is a method of encapsulation
Coupling is a way to define multiple methods in a class
Coupling is the degree of direct knowledge that one class has of another
What is an interface?
Select the correct answer
An interface is a special type of function
An interface is a type of inheritance in OOP
An interface is a contract that classes can implement
An interface is an instance of a class
What are ‘access specifiers’?
Select the correct answer
Access specifiers are used to create objects from classes
Access specifiers are methods to overload functions
Access specifiers are used to define the size of a class
Access specifiers define the accessibility of class members
What is a subclass?
Select the correct answer
A subclass is a method within a class
A subclass is a type of object in OOP
A subclass is a type of encapsulation
A subclass is a class that inherits from another class
What is a superclass?
Select the correct answer
A superclass is a type of polymorphism
A superclass is an instance of a class
A superclass is a special type of function in OOP
A superclass is a class from which other classes inherit
Explain abstraction in OOP.
Select the correct answer
Abstraction is the process of hiding implementation details and showing only functionality
Abstraction is the process of defining multiple methods with the same name
Abstraction is a type of inheritance in OOP
Abstraction is a method for creating objects from classes
What is the difference between overloading and overriding?
Select the correct answer
Overloading is creating multiple objects; overriding is defining multiple methods
Overloading is a way to define classes; overriding is a way to define methods
Overloading is a type of inheritance; overriding is a type of encapsulation
Overloading is defining multiple methods with the same name but different parameters; overriding is redefining a method in a subclass
What is polymorphism?
Select the correct answer
Polymorphism is the process of hiding data within a class
Polymorphism allows methods to do different things based on the object it is acting upon
Polymorphism is the ability to create multiple instances of a class
Polymorphism is a way to define the structure of a class
What is multiple inheritance?
Select the correct answer
Multiple inheritance is the process of defining multiple methods in a class
Multiple inheritance is a type of encapsulation in OOP
Multiple inheritance is when multiple objects can be created from a class
Multiple inheritance is when a class can inherit from more than one class
What is Inheritance?
Select the correct answer
Inheritance allows a class to use properties and methods of another class
Inheritance is a way to define the structure of a database
Inheritance is a method of encapsulation
Inheritance is the process of hiding data within a class