OOPS Quiz (Set 15) OOPS (Set 15) 1 / 10 What is the difference between a final class and a sealed class? A final class cannot be inherited from, while a sealed class can be inherited from, but only by classes in the same assembly A final class must be abstract, while a sealed class can be concrete A final class cannot be instantiated, while a sealed class can be instantiated 2 / 10 What is the difference between a static method and an instance method in terms of access control? A static method can only be accessed through the object, while an instance method can be accessed through the class A static method can only be accessed through the class, while an instance method can be accessed through the object A static method is always public, while an instance method can be public, private, or protected 3 / 10 What is the difference between a polymorphism and an overloading? Polymorphism is a type of overloading, where the different definitions of a method have the same name but different parameters Polymorphism is the ability of an object to take on different forms, while overloading is the ability of a method to have multiple definitions Overloading is a type of polymorphism, where the different definitions of a method have the same name but different return types 4 / 10 What is the difference between a has-a relationship and a has-many relationship? A has-a relationship is a stronger relationship than a has-many relationship, because the child object cannot exist without the parent object A has-a relationship is a relationship between two objects where one object has a reference to another object, while a has-many relationship is a relationship between two objects where one object has a reference to multiple objects A has-many relationship is a stronger relationship than a has-a relationship, because the parent object can exist without the child object 5 / 10 What is the difference between a composition and an aggregation in terms of memory management? In a composition, the child object is created when the parent object is created, while in an aggregation, the child object can be created independently of the parent object In a composition, the child object cannot exist without the parent object, while in an aggregation, the child object can exist without the parent object In a composition, the child object is stored in the memory of the parent object, while in an aggregation, the child object is not stored in the memory of the parent object 6 / 10 What is the difference between a final class and an abstract class? A final class must be abstract, while an abstract class can be concrete A final class cannot be inherited from, while an abstract class can be inherited from A final class cannot be instantiated, while an abstract class can be instantiated 7 / 10 What is the difference between a constructor and a class method? A constructor is a method that is declared in a class, while a class method is a method that is declared outside of a class A constructor is a method that is called when an object is created, while a class method is a method that is called on a class A constructor is a method that is used to initialize the data members of an object, while a class method is a method that is used to perform some operation on a class 8 / 10 What is the difference between a pure virtual method and an abstract method? A pure virtual method is an abstract method that must be implemented by a derived class, while an abstract method is an abstract method that may or may not be implemented by a derived class A pure virtual method is an abstract method that cannot be called, while an abstract method is an abstract method that can be called A pure virtual method is an abstract method that is declared in a base class, while an abstract method is an abstract method that is declared in a derived class 9 / 10 What is the difference between a static method and a non-static method? A static method is a method that can be called without creating an object of the class, while a non-static 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 non-static 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 non-static method is a method that is called when an object is destroyed 10 / 10 What is the difference between a class variable and an instance variable? A class variable is a variable that is declared inside a class, while an instance variable is a variable that is declared outside of any methods A class variable is a variable that is accessible to all methods in a class, while an instance variable is a variable that is only accessible to the method it is declared in A class variable is a variable that is accessible to all objects in a class, while an instance variable is a variable that is only accessible to the object that created it Your score isThe average score is 0% 0% Restart quiz