OOPS Quiz (Set 13) OOPS (Set 13) 1 / 10 What is the difference between a final and a non-final variable? 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 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 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 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 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 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 a constructor and a method? A constructor is a method that is called when an object is created, while a method is a special method that is used to initialize the data members of an object A constructor is a special method that is called when an object is created, while a method is a regular method that is called when a specific action is required A constructor is a method that is called when an object is created, while a method is a regular method that is used to implement the behavior of an object 7 / 10 What is the difference between an abstract class and an interface? An abstract class is a class that cannot be instantiated, while an interface is a class that can be instantiated An abstract class is a class that can be instantiated, while an interface is a blueprint for creating classes An abstract class is a class that can be instantiated, but it must have at least one abstract method. An interface is a blueprint for creating classes, and all of its methods must be abstract 8 / 10 What is the difference between static and non-static members? Static members are accessible to all objects, while non-static members are only accessible to the object they are declared in Static members are associated with the class itself, while non-static members are associated with individual objects Static members are associated with the class itself, while non-static members are associated with the subclass 9 / 10 What is the difference between public, private, and protected access modifiers? Public members are accessible to all classes, private members are only accessible to the class they are declared in, and protected members are accessible to all objects Public members are accessible to all objects, private members are only accessible to the class they are declared in, and protected members are accessible to the class they are declared in and its subclasses Public members are accessible to all classes, private members are only accessible to the class they are declared in, and protected members are accessible to the class they are declared in and its subclasses 10 / 10 What is the difference between a class and an object? A class is a blueprint for creating objects, while an object is an instance of a class A class is a collection of data members and methods, while an object is a way of organizing code A class is a way of organizing code, while an object is a collection of data members and methods Your score isThe average score is 0% 0% Restart quiz