1. Which of the following is an example of a real-world object that can be
represented in an object-oriented system?
A. An integer
B. A car, with properties like color and speed
C. A function that performs calculations
D. A constant value
Answer: B) A car, with properties like color and speed
Rationale: A real-world object like a car can be represented in OOP with attributes
(properties) and methods (behaviors).
2. Which of the following is a feature of object-oriented programming?
A. Data is hidden
B. Data is manipulated directly
C. Functions are not used
D. Programs are written in a procedural way
Answer: A) Data is hidden
,Rationale: One of the key features of OOP is data encapsulation, which means data
is hidden from outside access and can only be accessed through public methods.
3. Which of the following is a key feature of encapsulation?
A. Hiding the implementation details
B. Reusing code from parent classes
C. Sharing data between different classes
D. Allowing multiple objects to inherit the same properties
Answer: A) Hiding the implementation details
Rationale: Encapsulation involves bundling data and the methods that operate on
that data, restricting access to the internal workings of an object.
4. Which of the following is an example of method overloading?
A. A method with the same name but different parameters
B. A method that changes its behavior based on the object type
C. A method that calls another method
D. A method that throws an exception
Answer: A) A method with the same name but different parameters
, Rationale: Method overloading occurs when multiple methods with the same name
exist but with different parameter lists.
5. Which of the following best describes a class in object-oriented programming?
A. A function that performs tasks
B. A template for creating objects
C. A variable used to store data
D. A process used to execute instructions
Answer: B) A template for creating objects
Rationale: A class defines the blueprint or template from which objects are
instantiated.
6. What does a constructor do in OOP?
A. Initializes an object with default values
B. Defines the structure of the class
C. Executes when an object is deleted
D. Converts an object to a string
Answer: A) Initializes an object with default values
represented in an object-oriented system?
A. An integer
B. A car, with properties like color and speed
C. A function that performs calculations
D. A constant value
Answer: B) A car, with properties like color and speed
Rationale: A real-world object like a car can be represented in OOP with attributes
(properties) and methods (behaviors).
2. Which of the following is a feature of object-oriented programming?
A. Data is hidden
B. Data is manipulated directly
C. Functions are not used
D. Programs are written in a procedural way
Answer: A) Data is hidden
,Rationale: One of the key features of OOP is data encapsulation, which means data
is hidden from outside access and can only be accessed through public methods.
3. Which of the following is a key feature of encapsulation?
A. Hiding the implementation details
B. Reusing code from parent classes
C. Sharing data between different classes
D. Allowing multiple objects to inherit the same properties
Answer: A) Hiding the implementation details
Rationale: Encapsulation involves bundling data and the methods that operate on
that data, restricting access to the internal workings of an object.
4. Which of the following is an example of method overloading?
A. A method with the same name but different parameters
B. A method that changes its behavior based on the object type
C. A method that calls another method
D. A method that throws an exception
Answer: A) A method with the same name but different parameters
, Rationale: Method overloading occurs when multiple methods with the same name
exist but with different parameter lists.
5. Which of the following best describes a class in object-oriented programming?
A. A function that performs tasks
B. A template for creating objects
C. A variable used to store data
D. A process used to execute instructions
Answer: B) A template for creating objects
Rationale: A class defines the blueprint or template from which objects are
instantiated.
6. What does a constructor do in OOP?
A. Initializes an object with default values
B. Defines the structure of the class
C. Executes when an object is deleted
D. Converts an object to a string
Answer: A) Initializes an object with default values