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

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

SD 2 – Object-Oriented Programming

Institution
Object-oriented Programming
Course
Object-oriented programming

Content preview

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




2. What is the main purpose of inheritance in object-oriented programming?

A. To allow data encapsulation

B. To reuse code in derived classes

C. To hide data

D. To implement multiple threads

Answer: B) To reuse code in derived classes

,Rationale: Inheritance allows a class to inherit properties and behaviors (methods)

from another class, promoting code reuse.




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




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




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




6. What is encapsulation in object-oriented programming?

A. The process of hiding data and only exposing necessary functionality

B. The process of creating new objects from a class

C. The ability of an object to take multiple forms

D. The inheritance of properties and methods from a parent class

Answer: A) The process of hiding data and only exposing necessary functionality

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

$11.49
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
View profile
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
9 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

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