0
0
HLDsystem_design~10 mins

Connection pooling in HLD - Interactive Code Practice

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

Complete the code to define the maximum number of connections in the pool.

HLD
max_connections = [1]
Drag options to blanks, or click blank then click option'
Amax_pool_size
Bpool_max
Cconnection_limit
D100
Attempts:
3 left
💡 Hint
Common Mistakes
Using undefined variable names instead of an integer.
Setting the pool size to zero or negative numbers.
2fill in blank
medium

Complete the code to acquire a connection from the pool.

HLD
connection = pool.[1]()
Drag options to blanks, or click blank then click option'
Arelease
Bacquire
Cclose
Dopen
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'release' which is for returning a connection.
Using 'close' which terminates a connection.
3fill in blank
hard

Fix the error in releasing a connection back to the pool.

HLD
pool.[1](connection)
Drag options to blanks, or click blank then click option'
Arelease
Bget
Cacquire
Dconnect
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'acquire' instead of 'release'.
Using 'connect' which is unrelated.
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that maps connection IDs to their status if the connection is active.

HLD
status_map = {conn.id: conn.[1] for conn in connections if conn.[2]
Drag options to blanks, or click blank then click option'
Astatus
Bis_active
Cconnected
Dopen
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'connected' or 'open' which may not be boolean properties.
Mixing up the order of properties.
5fill in blank
hard

Fill all three blanks to filter connections with load less than 50 and map their IDs to load values.

HLD
filtered_loads = {conn.[1]: conn.[2] for conn in pool if conn.[3] < 50}
Drag options to blanks, or click blank then click option'
Aid
Bload
Dstatus
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'status' instead of 'load' for filtering.
Mixing keys and values in the dictionary comprehension.