Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 3 out of 30 pages
Exam (elaborations)

SD 2 – Object-Oriented Programming 10

Document preview thumbnail
Preview 3 out of 30 pages

SD 2 – Object-Oriented Programming 10

Content preview

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

Document information

Uploaded on
March 17, 2025
Number of pages
30
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers
$10.99

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
douglasmugwe82
5.0
(1)
Sold
2
Followers
0
Items
4239
Last sold
11 months ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions