Bird
0
0
LLDsystem_design~20 mins

State management (idle, moving up, moving down) in LLD - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
State Management Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
Understanding state transitions in a simple elevator system

Consider a system managing an elevator with three states: idle, moving up, and moving down. Which of the following best describes the correct state transition when the elevator receives a request to move to a higher floor?

AFrom moving up to idle, then moving down immediately.
BFrom moving down directly to moving up without going idle.
CFrom idle to moving down, then to moving up after reaching the floor.
DFrom idle to moving up, then to idle after reaching the floor.
Attempts:
2 left
💡 Hint

Think about the natural flow of elevator movement when going to a higher floor.

Architecture
intermediate
1:30remaining
Designing a state machine for elevator movement

You need to design a state machine for an elevator with states: idle, moving up, moving down. Which component is essential to handle state transitions correctly?

AA controller that listens to floor requests and updates the state accordingly.
BA database to store all floor requests permanently.
CA UI component to display elevator status only.
DA logging system to record elevator movements.
Attempts:
2 left
💡 Hint

Focus on what controls the state changes in the system.

scaling
advanced
2:00remaining
Scaling state management for multiple elevators

When managing multiple elevators in a building, what is the best approach to maintain consistent state management across all elevators?

ALet each elevator manage its own state independently without coordination.
BUse a centralized state manager that tracks all elevators and their states.
CStore elevator states only in local memory without synchronization.
DUse a random assignment of states to elevators to balance load.
Attempts:
2 left
💡 Hint

Consider how to avoid conflicting states and optimize elevator usage.

tradeoff
advanced
2:00remaining
Tradeoffs in state polling vs event-driven updates

For an elevator system managing states (idle, moving up, moving down), which tradeoff is true when choosing between polling the elevator state frequently versus using event-driven updates?

APolling and event-driven approaches have identical system load and complexity.
BPolling reduces system load and complexity; event-driven increases load and complexity.
CPolling increases system load but simplifies state detection; event-driven reduces load but requires more complex event handling.
DEvent-driven updates always cause delays compared to polling.
Attempts:
2 left
💡 Hint

Think about how often the system checks for changes and how it reacts.

estimation
expert
2:30remaining
Estimating capacity for state management in a high-rise elevator system

You are designing state management for 20 elevators in a 100-floor building. Each elevator changes state approximately every 10 seconds on average. Estimate the number of state transitions the system must handle per minute.

A120 transitions per minute
B60 transitions per minute
C200 transitions per minute
D100 transitions per minute
Attempts:
2 left
💡 Hint

Calculate transitions per elevator per minute, then multiply by number of elevators.