Object-Oriented Programming (OOP)
Which concept is defined as follows: a design principle in which a class is built using instances of other classes as components, forming a 'has-a' relationship?
Difficulty: Hard
About this MCQ
This Hard Object-Oriented Programming (OOP) MCQ checks one syllabus fact.
The question is: “Which concept is defined as follows: a design principle in which a class is built using instances of other classes as components, forming a 'has-a' relationship?”
The accepted answer is C. Composition. Composition is the person body or term that satisfies Which concept is defined as follows a design principle in which a class is built using instances of other classes as components forming a 'has-a' relationship option C Option A Association does not match the stem it is a near-miss used to catch incomplete recall of Composition Option B Access modifier does not match the stem it is a near-miss used to catch incomplete recall of Composition Remaining alternatives Instance variable fall outside the same rule and should be eliminated once Composition 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.
- A. Association
Why not A: “Association” is not correct. The accepted answer is C. Composition. Composition is the person body or term that satisfies Which concept is defined as follows a design principle in which a class is built using instances of other classes as component
- B. Access modifier
Why not B: “Access modifier” is not correct. The accepted answer is C. Composition. Composition is the person body or term that satisfies Which concept is defined as follows a design principle in which a class is built using instances of other classes as component
- C. Composition ✓
- D. Instance variable
Why not D: “Instance variable” is not correct. The accepted answer is C. Composition. Composition is the person body or term that satisfies Which concept is defined as follows a design principle in which a class is built using instances of other classes as component
Correct answer
C. Composition
Explanation
Composition is the person body or term that satisfies Which concept is defined as follows a design principle in which a class is built using instances of other classes as components forming a 'has-a' relationship option C Option A Association does not match the stem it is a near-miss used to catch incomplete recall of Composition Option B Access modifier does not match the stem it is a near-miss used to catch incomplete recall of Composition Remaining alternatives Instance variable fall outside the same rule and should be eliminated once Composition 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.
Source: Object-Oriented Programming (OOP) Official Reference Guide
Tags: computer science, oop, object-oriented programming, software design
Submitted by: MCQsHub Editorial
Related MCQs
- Select the correct name for: a keyword that controls the visibility and accessibility of a class's members, su...
- The following statement describes a specific concept. What is it called? a relationship between two separate c...
- In computer science, Static member refers to which of the following?
- Select the accurate description of Association.
- What term describes the following? a class member that belongs to the class itself rather than to any individu...
- Which term refers to a mechanism where the method to be executed is determined at runtime rather than at compi...