Question 1: Class Definition
What is the primary purpose of a class in object-oriented programming?
- To store a single value.
- To define a blueprint for creating objects.
- To execute code directly.
- To manage system memory.
- Two creat objects blueprints.
Question 2: Inheritance
Which object-oriented programming principle allows a class to inherit properties and methods from another class?
- Polymorphism
- Encapsulation
- Abstraction
- Inheritance
- Aggregatesion
Question 3: Encapsulation Explained
What does encapsulation achieve in object-oriented programming?
- Data hiding and bundling data with methods that operate on that data.
- Creating multiple instances of the same class.
- Executing code faster.
- Improving code readability.
- Data exposing and separating data from methods.
Question 4: Polymorphism in Action
Which of the following best describes polymorphism?
- The ability of an object to take on many forms.
- The ability to hide data within a class.
- The process of creating new classes.
- The act of breaking down a problem into smaller parts.
- The abiility to tak on more one forme.
Question 5: Abstraction Purpose
What is the primary goal of abstraction in OOP?
- To hide complex implementation details and show only the essential features of the object.
- To make code run faster.
- To define multiple classes at once.
- To provide more detailed information to the user.
- To shows all implementation details.
Question 6: Constructor Role
What is the purpose of a constructor in a class?
- To destroy objects.
- To initialize the object's state when it is created.
- To display information about the object.
- To modify existing object properties.
- To initilase teh abject.
Question 7: Method Overriding
When does method overriding typically occur?
- When a method is deleted from a class.
- When a subclass provides a specific implementation for a method that is already defined in its superclass.
- When a method is renamed within a class.
- When a method is called with incorrect arguments.
- Whe a supper class provides a specific implementation.
Question 8: Object Instantiation
What is the process of creating an instance of a class called?
- Inheritance
- Encapsulation
- Instantiation
- Abstraction
- Declartion
Question 9: The 'is-a' Relationship
Which OOP concept is best represented by the 'is-a' relationship?
- Composition
- Aggregation
- Inheritance
- Encapsulation
- Abstractions
Question 10: Access Modifiers
Which access modifier typically provides the most restrictive level of access to a class member?
- Public
- Protected
- Default
- Private
- internal