1. Which of the following best describes polymorphism in OOP? A) A design pattern for UI components B) The ability of a function to access private data C) The ability of different objects to be treated through a common interface D) A mechanism to prevent subclassing Answer: C — The ability of different objects to
1. An abstract class in OOP is best described as: A) A class that cannot contain methods. B) A class that may contain abstract methods and cannot be instantiated directly. C) A class that has no data members. D) A class that always has only static methods. Answer: B 2. Which of the following statements
1. Which of the following best describes encapsulation in object-oriented programming? A) Exposing all fields of a class for easy access B) Combining data and methods that operate on that data into a single unit and restricting access to some of the object’s components C) Inheriting behaviour from multiple parent classes D) Writing only static
Q1. In OOP, “inheritance” primarily promotes which key concept? A) Encapsulation B) Code reusability C) Data hiding D) Overloading Answer: B) Code reusability Q2. The class that is inherited from another class is called: A) Parent class B) Base class C) Derived class D) Subclass Answer: B) Base class Q3. The class that inherits another
1. In object-oriented programming, what does the term “instantiation” refer to? A) The process of defining a class B) The process of copying a function C) The process of creating an object from a class D) The process of compiling code Answer: C 2. What is created when a class is instantiated in Java? A)
1. In Object-Oriented Programming, an object is best described as: A) A function performing a specific task B) A self-contained unit consisting of data and methods C) A library containing multiple functions D) A syntax rule for defining a class Answer: B) 2. Which of the following represents the state of an object? A) Methods
1. Which of the following best defines a class in OOP? A) A collection of variables only B) A function that executes specific tasks C) A blueprint or template for creating objects D) A data type with no behavior Answer: C) A blueprint or template for creating objects 2. In OOP, what is an instance