OMG-OCUP2-FOUND100 practice question 13 of 15

When is a state machine for an object created and ready to accept events?

Full set: 89 questions
Answer options
A: by the time the last state ends
B: immediately after the sequence diagrams start
C: by the time the object has finished its initialization Correct answer
D: when all objects in the system are ready to receive events
Correct Answer:
C. by the time the object has finished its initialization
Explanation

A state machine is an integral part of an object's behavior, defining its lifecycle and responses to events. The state machine is instantiated and becomes active as part of the creation process of its context object. This process is complete only after the object's attributes are initialized and its constructor has finished execution. At this point, the state machine's initial transition is taken, placing the object in its first stable state. From this moment, the object and its state machine are ready to accept and process events from the environment.

Why Incorrect

A. The end of the last state signifies the termination of the object's lifecycle or a specific behavior, not its creation or readiness to accept events.
B. Sequence diagrams model interactions between objects; they do not govern the lifecycle or creation time of an object's state machine.
D. Object lifecycles are typically independent. An object's state machine becomes active when that specific object is ready, not when all objects in the entire system are.

References

1. Object Management Group. (2017). OMG Unified Modeling Language (OMG UML), Version 2.5.1. OMG Document Number formal/2017-12-05. Section 14.2.3.1, "StateMachines," p. 306, describes a state machine as specifying the behavior of its context classifier throughout its lifetime.

2. Douglass, B. P. (2004). Real-Time UML, Third Edition: Advances in The UML for Real-Time Systems. Addison-Wesley Professional. Chapter 11, "State-Oriented Analysis and Design," explains that an object enters its initial state as the last step of its construction process.

Scroll to Top