CS FundamentalsVery hardGATE CS
A media player has states Stopped, Playing and Paused and events play, pause and stop. Valid transitions: Stopped–play→Playing, Playing–pause→Paused, Playing–stop→Stopped, Paused–play→Playing, Paused–stop→Stopped. How many state–event pairs are invalid (for negative tests), and what is the fewest events in one sequence from Stopped that covers every valid transition?
- A. 4 invalid pairs; 5 events
- B. 5 invalid pairs; 7 events
- C. 4 invalid pairs; 6 events
- D. 4 invalid pairs; 7 events
Correct answer: D. 4 invalid pairs; 7 events
3 states × 3 events = 9 pairs, of which 5 are valid, so 4 are invalid. Using each transition exactly once would require starting at Paused (one more exit than entry), so a walk from Stopped must repeat at least two transitions: play, pause, play, stop, play, pause, stop covers all 5 in 7 events.
Practise more Software Engineering, Git and Cloud Basics questionsSoftware Engineering, Git and Cloud Basics: notes and key points
More Software Engineering, Git and Cloud Basics questions
- A UML class diagram says each Course has 1..3 Instructors and each Instructor teaches 0..4 Courses (many-to-many). Which configuration is…
- A company split its monolith into 12 microservices, but every release still needs all 12 deployed together in a fixed order, and several…
- A gRPC API's Protocol Buffers message had field 'int32 discount = 4', which was deleted last year. A developer now adds 'string coupon =…
- For monitoring, which pairing of method and what it tracks is correct?
- A service receives 2000 requests per second; each request holds a worker thread for 150 ms on average. It runs on 4 identical instances…
- A request flows client → A → B → C → D. Services A, B and C each make up to 3 attempts (1 + 2 retries) when their downstream call fails. D…