Object-Oriented Programming (OOP)
A design pattern that restricts the instantiation of a class to a single shared object. What is this concept called?
Difficulty: Hard
About this MCQ
This Hard Object-Oriented Programming (OOP) MCQ checks one syllabus fact.
The question is: “A design pattern that restricts the instantiation of a class to a single shared object. What is this concept called?”
The accepted answer is D. Singleton pattern. “A design pattern that restricts the instantiation of a class to a single shared object. What is this concept called” is answered by Singleton pattern (option D). Option A (“Super keyword”) does not match the stem; it is a near-miss used to catch incomplete recall of Singleton pattern. Option B (“Association”) does not match the stem; it is a near-miss used to catch incomplete recall of Singleton pattern. Remaining alternatives (Message passing) fall outside the same rule and should be eliminated once Singleton pattern 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. Super keyword
Why not A: “Super keyword” is not correct. The accepted answer is D. Singleton pattern. “A design pattern that restricts the instantiation of a class to a single shared object. What is this concept called” is answered by Singleton pattern (option D). Option A (“Super
- B. Association
Why not B: “Association” is not correct. The accepted answer is D. Singleton pattern. “A design pattern that restricts the instantiation of a class to a single shared object. What is this concept called” is answered by Singleton pattern (option D). Option A (“Super
- C. Message passing
Why not C: “Message passing” is not correct. The accepted answer is D. Singleton pattern. “A design pattern that restricts the instantiation of a class to a single shared object. What is this concept called” is answered by Singleton pattern (option D). Option A (“Super
- D. Singleton pattern ✓
Correct answer
D. Singleton pattern
Explanation
“A design pattern that restricts the instantiation of a class to a single shared object. What is this concept called” is answered by Singleton pattern (option D). Option A (“Super keyword”) does not match the stem; it is a near-miss used to catch incomplete recall of Singleton pattern. Option B (“Association”) does not match the stem; it is a near-miss used to catch incomplete recall of Singleton pattern. Remaining alternatives (Message passing) fall outside the same rule and should be eliminated once Singleton pattern 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
- Instance variable is best defined as which of the following?
- Choose the correct description of Singleton pattern.
- Identify the correct concept described as: a variable defined in a class for which each object of that class m...
- Which of the following best names the concept in which the process by which objects communicate with one anoth...
- Which of the following best describes Static binding?
- What is the function or purpose of Message passing?