Object-Oriented Programming (OOP)
Select the correct name for: a keyword that controls the visibility and accessibility of a class's members, such as public or private.
Difficulty: Medium
About this MCQ
This Medium Object-Oriented Programming (OOP) MCQ checks one syllabus fact.
The question is: “Select the correct name for: a keyword that controls the visibility and accessibility of a class's members, such as public or private.”
The accepted answer is D. Access modifier. “Select the correct name for: a keyword that controls the visibility and accessibility of a class's members, such as public or private.” is answered by Access modifier (option D). Option A (“Message passing”) does not match the stem; it is a near-miss used to catch incomplete recall of Access modifier. Option B (“Destructor”) does not match the stem; it is a near-miss used to catch incomplete recall of Access modifier. Remaining alternatives (Instance variable) fall outside the same rule and should be eliminated once Access modifier is identified. Object-Oriented Programming (OOP) questions of this type reward precise definitions rather than approximate associations. Object-Oriented Programming (OOP) recall of this distinction is a regular item in FPSC, PPSC, NTS, and CSS papers.
- A. Message passing
Why not A: “Message passing” is not correct. The accepted answer is D. Access modifier. “Select the correct name for: a keyword that controls the visibility and accessibility of a class's members, such as public or private.” is answered by Access modifier (option D).
- B. Destructor
Why not B: “Destructor” is not correct. The accepted answer is D. Access modifier. “Select the correct name for: a keyword that controls the visibility and accessibility of a class's members, such as public or private.” is answered by Access modifier (option D).
- C. Instance variable
Why not C: “Instance variable” is not correct. The accepted answer is D. Access modifier. “Select the correct name for: a keyword that controls the visibility and accessibility of a class's members, such as public or private.” is answered by Access modifier (option D).
- D. Access modifier ✓
Correct answer
D. Access modifier
Explanation
“Select the correct name for: a keyword that controls the visibility and accessibility of a class's members, such as public or private.” is answered by Access modifier (option D). Option A (“Message passing”) does not match the stem; it is a near-miss used to catch incomplete recall of Access modifier. Option B (“Destructor”) does not match the stem; it is a near-miss used to catch incomplete recall of Access modifier. Remaining alternatives (Instance variable) fall outside the same rule and should be eliminated once Access modifier is identified. Object-Oriented Programming (OOP) questions of this type reward precise definitions rather than approximate associations. Object-Oriented Programming (OOP) recall of this distinction is a regular item in FPSC, PPSC, NTS, and CSS papers.
Source: Object-Oriented Programming (OOP) Official Reference Guide
Tags: computer science, oop, object-oriented programming, software design
Submitted by: MCQsHub Editorial
Related MCQs
- What term describes the following? a class member that belongs to the class itself rather than to any individu...
- Which concept is defined as follows: a design principle in which a class is built using instances of other cla...
- Identify the correct definition of Destructor.
- What is Composition primarily used for?
- The concept in which a special method automatically invoked when an object is destroyed, used to release resou...
- The following statement describes a specific concept. What is it called? a relationship between two separate c...