Skip to content

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.

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

More Object-Oriented Programming (OOP) MCQs