UML object diagram basics: Is an object (instance) commonly shown as a rectangle with two compartments—the top for the underlined object name:Class and the lower for attribute slots/values?

Difficulty: Easy

Correct Answer: Correct

Explanation:


Introduction / Context:
Object diagrams (sometimes called instance diagrams) provide a snapshot of specific objects and their links at a moment in time. Reading their notation correctly helps teams reason about concrete examples of the design and verify multiplicities and constraints with real-looking instances.


Given Data / Assumptions:

  • We are describing the standard appearance of an object in a UML object diagram.
  • The statement claims an object uses a rectangle with two compartments: name and attributes.
  • We accept that exact compartments may vary, but we focus on common practice.


Concept / Approach:
In UML, an object is typically drawn as a rectangle. The top compartment contains the underlined object name, optionally in the form instanceName:ClassName, which makes clear both the specific instance and its type. A second compartment often lists attribute slots with their current values (for example, status = "Shipped"). Additional compartments are not required; operations are usually not shown for instances. Therefore, representing an object with two compartments is a common and correct depiction, though the attribute compartment may be omitted if values are not relevant to the example.


Step-by-Step Solution:

Draw a rectangle; underline the instance name and show the type as name:Class if desired.Add a second compartment listing attribute slots and values.Connect objects with links to represent associations.Conclude that the statement is correct for standard practice.


Verification / Alternative check:
Survey UML primers and tool defaults; they show object rectangles with underlined names and (optionally) a second compartment for slots, confirming this conventional representation.


Why Other Options Are Wrong:

  • Circles are not the UML default for objects.
  • Exactly three compartments are not required; a single or two-compartment object is common.
  • Objects may show attribute values to illustrate state at a given time.


Common Pitfalls:
Forgetting to underline the object name; omitting type information when it matters; stuffing methods into an object diagram (they belong to classes, not instances).


Final Answer:
Correct

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion