OOPS Quiz (Set 4) OOPS (Set 4) 1 / 10 What is the purpose of an abstract class in OOP? To define a blueprint for other classes to inherit from To create an instance of a class To encapsulate data and methods To perform method overloading 2 / 10 What is polymorphism in OOP? Hiding complex implementation details Combining data and methods into a single unit The ability of different objects to respond to the same method in a way specific to their class Creating objects from classes 3 / 10 What is the main purpose of the 'super' keyword in OOP? To access private methods To create a subclass To call the constructor of the parent class To define a new instance 4 / 10 Which OOP principle promotes the idea of binding data and methods into a single unit? Polymorphism Inheritance Abstraction Encapsulation 5 / 10 In OOP, what does the term 'inheritance' refer to? Copying data from one object to another Creating new classes from existing ones, inheriting attributes and behaviors Combining data and methods Defining methods in a subclass 6 / 10 What is encapsulation in object-oriented programming? Creating objects from classes A technique for combining data and methods into a single unit Hiding complex implementation details Using inheritance to create specialized classes 7 / 10 What is the difference between a constructor and a destructor? A constructor is a method that is called when an object is created, while a destructor is a method that is called when an object is destroyed A constructor is a method that is called when an object is modified, while a destructor is a method that is called when an object is destroyed A constructor is a method that is called when an object is passed to a function, while a destructor is a method that is called when an object is returned from a function 8 / 10 What is the difference between a pass statement and a return statement? A pass statement returns a value from a method, while a return statement does nothing A pass statement does nothing, while a return statement returns a value from a method A pass statement is used to create a placeholder for code that will be added later, while a return statement is used to return a value from a method 9 / 10 What is the difference between a parameter and an argument? A parameter is a variable that is declared in the definition of a method, while an argument is a value that is passed to a method when it is called A parameter is a variable that is declared in the definition of a class, while an argument is a value that is passed to a class when it is created A parameter is a variable that is declared in the definition of a function, while an argument is a value that is passed to a function when it is called 10 / 10 What is the difference between a local variable and a global variable? A local variable is a variable that is defined within a class, while a global variable is a variable that is defined outside of any classes A local variable is a variable that is defined within a method, while a global variable is a variable that is defined outside of any methods A local variable is a variable that is defined within a function, while a global variable is a variable that is defined outside of any functions Your score isThe average score is 0% 0% Restart quiz