OOPS Quiz (Set 18) OOPS (Set 18) 1 / 10 What is the purpose of the 'transient' keyword in Java? To indicate that a class cannot be inherited To indicate that a method is abstract To indicate that a variable should not be serialized To indicate that a variable should always have a specific value 2 / 10 What is the difference between a shallow copy and a deep copy of an object? A shallow copy creates a new object with copies of all internal objects, while a deep copy creates a new object with references to the same internal objects A shallow copy and a deep copy are the same thing A shallow copy and a deep copy both create new objects with new internal objects A shallow copy creates a new object with references to the same internal objects, while a deep copy creates a new object with copies of all internal objects 3 / 10 What is the purpose of the 'finalize' method in Java? To explicitly destroy objects and release memory To clean up resources held by objects before they are garbage collected To create a new instance of a class To define a new method in a class 4 / 10 What is a default constructor in Java? A constructor with no parameters that is automatically created by the compiler A constructor with parameters that is defined by the programmer A constructor used for type casting A constructor that can only be accessed from within the class 5 / 10 What is the difference between 'this' and 'super' in Java? 'this' refers to the parent class, while 'super' refers to the current instance of a class 'this' refers to the current instance of a class, while 'super' refers to the parent class 'this' refers to the current instance of a class, while 'super' refers to the next instance of a class 'this' and 'super' are interchangeable keywords 6 / 10 What is a constructor in Java? A method used to create instances of classes A method used to access private members of a class A method used for type casting A method used to override a superclass method 7 / 10 What is a static nested class in Java? A class that can only be used within the method it's defined in A class that can only be used within the package it's defined in A class defined inside another class that is marked as 'static' A class that cannot have any instance variables 8 / 10 What is the 'instanceof' operator used for in Java? To create a new instance of a class To access methods of another class To check if an object belongs to a specific class or interface To perform type casting 9 / 10 What does the term 'constructor chaining' refer to in Java? Calling one constructor from another constructor within the same class or from a subclass constructor Creating multiple instances of a class Calling methods from constructors Using static methods to create instances 10 / 10 What is method overriding in Java? Creating a new class with the same name Creating a new method with the same name in a subclass Calling a method from another method Defining multiple constructors Your score isThe average score is 0% 0% Restart quiz