OOPS Quiz (Set 17) OOPS (Set 17) 1 / 10 What is the purpose of a factory method? The purpose of a factory method is to create objects, while a constructor is a method that is used to initialize the data members of an object The purpose of a factory method is to create objects that are different from the objects that are created by the constructor The purpose of a factory method is to encapsulate the creation of objects, while a constructor is a method that is used to initialize the data members of an object 2 / 10 What is the difference between overloading and overriding? Overloading is the ability to have multiple methods with the same name, while overriding is the ability to have a method with the same name as a method in a base class Overloading is the ability to have a method with the same name as a method in a derived class, while overriding is the ability to have multiple methods with the same name Overloading is the ability to have a method with the same name as a method in a base class, while overriding is the ability to have a method with the same name as a method in a derived class 3 / 10 What is the difference between an abstract class and an interface? An abstract class is a class that cannot be instantiated, but can be inherited from, while an interface is a set of methods that must be implemented by a class An abstract class is a class that can be instantiated, but cannot be inherited from, while an interface is a set of methods that must be implemented by a class An abstract class is a class that must be abstract, but can be concrete, while an interface is a class that must be concrete, but can be abstract 4 / 10 What is the difference between a single inheritance and a multiple inheritance? A single inheritance is a type of inheritance where an object can only inherit from one class, while a multiple inheritance is a type of inheritance where an object can inherit from multiple interfaces A single inheritance is a type of inheritance where an object can only inherit from one class, while a multiple inheritance is a type of inheritance where an object can inherit from multiple classes A single inheritance is a type of inheritance where an object can only inherit from one class, while a multiple inheritance is a type of inheritance where an object can inherit from multiple methods 5 / 10 What is the difference between a composition and an aggregation? A composition is a relationship between two objects where one object is part of another object, while an aggregation is a relationship between two objects where one object is not part of another object A composition is a relationship between two objects where both objects are independent, while an aggregation is a relationship between two objects where one object depends on the other object A composition is a relationship between two objects where the two objects are created together, while an aggregation is a relationship between two objects where the two objects can be created independently 6 / 10 What is the difference between a static method and a virtual method? A static method is a method that can be called without creating an object of the class, while a virtual method is a method that can only be called by creating an object of the class A static method is a method that is stored in the class itself, while a virtual method is a method that is stored in the object A static method is a method that is called when an object is created, while a virtual method is a method that is called when an object is destroyed A static method is a method that is bound to the class, while a virtual method is a method that is bound to the object 7 / 10 What is the difference between a class and an interface? A class is a blueprint for creating objects, while an interface is a blueprint for creating classes A class is a blueprint for creating objects, while an interface is a set of methods that must be implemented by a class A class is a way of organizing code, while an interface is a blueprint for creating classes 8 / 10 What is the difference between polymorphism and inheritance? Polymorphism is the ability of an object to have multiple methods with the same name, while inheritance is the ability of an object to have multiple data members Polymorphism is the ability of an object to take on different forms, while inheritance is the ability of an object to inherit the properties and methods of another object Polymorphism is the ability of an object to have multiple methods with the same name, while inheritance is the ability of an object to inherit the properties and methods of another object 9 / 10 What is the difference between encapsulation and abstraction? Encapsulation is the process of providing only the essential details of an object, while abstraction is the process of hiding the implementation details of an object Encapsulation is the process of creating objects, while abstraction is the process of creating data structures Encapsulation is the process of hiding the implementation details of an object, while abstraction is the process of providing only the essential details of an object 10 / 10 What are the four pillars of object-oriented programming? Encapsulation, abstraction, polymorphism, and inheritance Encapsulation, abstraction, polymorphism, and composition Encapsulation, abstraction, inheritance, and interface Your score isThe average score is 0% 0% Restart quiz