OOPS Quiz (Set 19) OOPS (Set 19) 1 / 10 What is the difference between a final and a non-final variable? A final variable is a variable that is stored on the stack, while a non-final variable is a variable that is stored on the heap A final variable is a variable that is always initialized, while a non-final variable can be initialized or not initialized A final variable is a variable that cannot be changed after it is initialized, while a non-final variable can be changed after it is initialized 2 / 10 What is the difference between a primitive data type and a reference data type? A primitive data type is a data type that stores a single value, while a reference data type is a data type that stores a reference to an object A primitive data type is a data type that stores a reference to an object, while a reference data type is a data type that stores a single value A primitive data type is a data type that is stored on the stack, while a reference data type is a data type that is stored on the heap 3 / 10 What is the difference between a stack and a heap? The stack is a data structure that stores objects in a FIFO (first in, first out) order, while the heap is a data structure that stores objects in a LIFO (last in, first out) order The stack is a data structure that stores objects in a random order, while the heap is a data structure that stores objects in a sorted order The stack is a data structure that stores objects in a LIFO (last in, first out) order, while the heap is a data structure that stores objects in a FIFO (first in, first out) order 4 / 10 What is the purpose of a garbage collector? The purpose of a garbage collector is to automatically create objects The purpose of a garbage collector is to automatically manage the memory of an object The purpose of a garbage collector is to automatically delete objects 5 / 10 What is the difference between a shallow copy and a deep copy? A shallow copy is a copy of an object that copies the object's data as well as its references, while a deep copy is a copy of an object that only copies the object's reference A shallow copy is a copy of an object that copies the object's data, while a deep copy is a copy of an object that also copies the object's references A shallow copy is a copy of an object that only copies the object's reference, while a deep copy is a copy of an object that copies the object's data as well as its references 6 / 10 What is the difference between overloading and overriding? 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 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 base class, while overriding is the ability to have a method with the same name as a method in a derived class 7 / 10 What is polymorphism? Polymorphism is the ability of an object to take on different forms Polymorphism is the ability of an object to have multiple methods with the same name Polymorphism is the ability of an object to have multiple data members 8 / 10 What is a virtual method? A virtual method is a method that is always abstract A virtual method is a method that is bound to the class A virtual method is a method that can be overridden by a derived class 9 / 10 What is an abstract class? An abstract class is a class that cannot be instantiated, but can be inherited from An abstract class is a class that can be instantiated, but cannot be inherited from An abstract class is a class that must be abstract, but can be concrete 10 / 10 What is the difference between a base class and a derived class? A base class is a class that cannot be inherited from, while a derived class is a class that can be inherited from A base class is a class that can be inherited from, while a derived class is a class that inherits from another class A base class is a class that is always abstract, while a derived class is a class that can be concrete Your score isThe average score is 0% 0% Restart quiz