Object-Oriented Programming (OOP)
What is the function or purpose of Encapsulation?
Difficulty: Medium
About this MCQ
This Medium Object-Oriented Programming (OOP) MCQ checks one syllabus fact.
The question is: “What is the function or purpose of Encapsulation?”
The accepted answer is C. An OOP principle that bundles data and methods together while restricting direct access to some components.. Encapsulation refers to an OOP principle that bundles data and methods together while restricting direct access to some components.
- A. An OOP concept that allows objects of different classes to be treated through a common interface.
Why not A: “An OOP concept that allows objects of different classes to be treated through a common interface.” is not correct. The accepted answer is C. An OOP principle that bundles data and methods together while restricting direct access to some components.. Encapsulation refers to an OOP principle that bundles data and methods together while restricting direct access to some components.
- B. An OOP principle that hides complex implementation details and exposes only essential features.
Why not B: “An OOP principle that hides complex implementation details and exposes only essential features.” is not correct. The accepted answer is C. An OOP principle that bundles data and methods together while restricting direct access to some components.. Encapsulation refers to an OOP principle that bundles data and methods together while restricting direct access to some components.
- C. An OOP principle that bundles data and methods together while restricting direct access to some components. ✓
- D. An OOP mechanism that allows a class to acquire properties and behaviors from another class.
Why not D: “An OOP mechanism that allows a class to acquire properties and behaviors from another class.” is not correct. The accepted answer is C. An OOP principle that bundles data and methods together while restricting direct access to some components.. Encapsulation refers to an OOP principle that bundles data and methods together while restricting direct access to some components.
Correct answer
C. An OOP principle that bundles data and methods together while restricting direct access to some components.
Explanation
Encapsulation refers to an OOP principle that bundles data and methods together while restricting direct access to some components.
Source: Object-Oriented Programming (OOP) Official Reference Guide
Tags: computer science, oop, object-oriented programming, software design
Submitted by: MCQsHub Editorial
Related MCQs
- The concept in which a special method automatically invoked when an object is destroyed, used to release resou...
- Identify the correct definition of Destructor.
- What term describes the following? a class member that belongs to the class itself rather than to any individu...
- In computer science, Static member refers to which of the following?
- Select the correct name for: a keyword that controls the visibility and accessibility of a class's members, su...
- Which statement correctly explains Access modifier?