0
0
Testing Fundamentalstesting~10 mins

Performance metrics (response time, throughput) in Testing Fundamentals - Interactive Code Practice

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

Complete the code to calculate the average response time from a list of response times.

Testing Fundamentals
average_response_time = sum(response_times) / [1]
Drag options to blanks, or click blank then click option'
Aresponse_times.count()
Blen(response_times)
Cmin(response_times)
Dmax(response_times)
Attempts:
3 left
💡 Hint
Common Mistakes
Using max() or min() instead of len() to count items.
Trying to call count() without arguments on the list.
2fill in blank
medium

Complete the code to calculate throughput given total requests and total time in seconds.

Testing Fundamentals
throughput = total_requests / [1]
Drag options to blanks, or click blank then click option'
Atime_per_request
Btotal_requests
Cresponse_time
Dtotal_time
Attempts:
3 left
💡 Hint
Common Mistakes
Dividing by total_requests instead of total_time.
Using response_time instead of total_time.
3fill in blank
hard

Fix the error in the code to correctly calculate average response time from a list of response times.

Testing Fundamentals
average_response_time = sum(response_times) / [1]
Drag options to blanks, or click blank then click option'
Alen(response_times)
Bresponse_times.length
Cresponse_times.count()
Dcount(response_times)
Attempts:
3 left
💡 Hint
Common Mistakes
Using response_times.length which is not valid in Python.
Trying to call count() without arguments.
4fill in blank
hard

Fill both blanks to create a dictionary that maps each request ID to its response time, but only include requests with response time less than 500 ms.

Testing Fundamentals
fast_responses = {req_id: [1] for req_id, [2] in responses.items() if response_time < 500}
Drag options to blanks, or click blank then click option'
Aresponse_time
Breq_time
Dtime
Attempts:
3 left
💡 Hint
Common Mistakes
Using different variable names inconsistently.
Not unpacking the dictionary items correctly.
5fill in blank
hard

Fill all three blanks to create a dictionary that maps each user to their average response time, including only users with average response time less than 300 ms.

Testing Fundamentals
average_times = {user: sum(times) / [1] for user, times in user_responses.items() if (sum(times) / [2]) [3] 300}
Drag options to blanks, or click blank then click option'
Alen(times)
C<
D>
Attempts:
3 left
💡 Hint
Common Mistakes
Using '>' instead of '<' in the filter condition.
Using different values for length in numerator and denominator.