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
Exam (elaborations)

SD 2 – Object-Oriented Programming 7

Rating
-
Sold
-
Pages
30
Grade
A+
Uploaded on
17-03-2025
Written in
2024/2025

SD 2 – Object-Oriented Programming 7

Institution
Object-oriented Programming
Course
Object-oriented programming

Content preview

1. What does the term "polymorphism" in object-oriented programming refer to?

A. Objects take multiple forms

B. The ability to hide data

C. The reuse of code

D. The process of creating a new class from an existing class

Answer: A) Objects take multiple forms

Rationale: Polymorphism allows objects to take on different forms, typically

through method overloading or method overriding.




2. What does the this keyword refer to in object-oriented programming?

A. A reference to the current class

B. A reference to the current object

C. A reference to the parent class

D. A reference to the method in the class

Answer: B) A reference to the current object

Rationale: The this keyword refers to the current instance of the class.

,3. Which of the following is the correct definition of abstraction in OOP?

A. Hiding data and methods from external access

B. Defining the interface and leaving the implementation to the derived class

C. Reusing code from multiple classes

D. Overloading methods in the same class

Answer: B) Defining the interface and leaving the implementation to the derived

class

Rationale: Abstraction hides the complex implementation details and exposes only

the necessary parts of an object or class through a simplified interface.




4. Which of the following is an advantage of object-oriented programming?

A. It is faster to write than procedural programming

B. It focuses on the behavior of data

C. It uses fewer resources

D. It organizes code into objects that can be easily reused

Answer: D) It organizes code into objects that can be easily reused

, Rationale: OOP promotes code reuse, modularity, and easier maintenance by

organizing code into reusable objects.




5. What is the purpose of a destructor in object-oriented programming?

A. To initialize the state of an object

B. To destroy an object and free memory

C. To return a value from an object

D. To define methods for an object

Answer: B) To destroy an object and free memory

Rationale: A destructor is a special method used to clean up or release resources

when an object is destroyed.




6. 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

Written for

Institution
Object-oriented programming
Course
Object-oriented programming

Document information

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

Subjects

$10.99
Get access to the full document:

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

Get to know the seller
Seller avatar
douglasmugwe82
5.0
(1)

Get to know the seller

Seller avatar
douglasmugwe82 Teachme2-tutor
Follow You need to be logged in order to follow users or courses
Sold
2
Member since
1 year
Number of followers
0
Documents
4239
Last sold
7 months ago
fully answered questions and answer

fully answered questions and answer

5.0

1 reviews

5
1
4
0
3
0
2
0
1
0

Recently viewed by you

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