0
0
LLDsystem_design~10 mins

Delivery agent assignment in LLD - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to assign a delivery agent to an order.

LLD
order.assignAgent([1])
Drag options to blanks, or click blank then click option'
Aorder
Bagent
Cdelivery
Dassign
Attempts:
3 left
💡 Hint
Common Mistakes
Passing the order object instead of the agent.
Using a method name instead of an object.
2fill in blank
medium

Complete the code to check if the delivery agent is available before assignment.

LLD
if (agent.[1]()) {
    order.assignAgent(agent);
}
Drag options to blanks, or click blank then click option'
AisBusy
Bdeliver
Cassign
DisAvailable
Attempts:
3 left
💡 Hint
Common Mistakes
Using isBusy() which returns the opposite.
Calling a method that does not exist.
3fill in blank
hard

Fix the error in the code to update the agent's status after assignment.

LLD
agent.[1] = false;
Drag options to blanks, or click blank then click option'
AassignAgent
BisAvailable
Cavailable
Dstatus
Attempts:
3 left
💡 Hint
Common Mistakes
Using a method name instead of a property.
Setting the wrong property.
4fill in blank
hard

Fill both blanks to create a function that assigns the first available agent from a list.

LLD
function assignFirstAvailableAgent(order, agents) {
    for (let [1] of agents) {
        if ([2].isAvailable()) {
            order.assignAgent([2]);
            break;
        }
    }
}
Drag options to blanks, or click blank then click option'
Aagent
Border
Dagents
Attempts:
3 left
💡 Hint
Common Mistakes
Using different variable names inside the loop.
Using the order or agents list as the loop variable.
5fill in blank
hard

Fill all three blanks to implement a method that returns a list of available agents.

LLD
function getAvailableAgents([1]) {
    return [2].filter([3] => [3].isAvailable());
}
Drag options to blanks, or click blank then click option'
Aagents
Cagent
Dorder
Attempts:
3 left
💡 Hint
Common Mistakes
Using different names for the parameter and the array.
Using a variable name that conflicts with the parameter.