0
0
Testing Fundamentalstesting~20 mins

Identifying performance bottlenecks in Testing Fundamentals - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Performance Bottleneck Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
What is the primary cause of a CPU bottleneck in software performance?

Imagine your computer is like a kitchen. The CPU is the chef who prepares meals. What usually causes the chef to slow down the whole kitchen?

AThe kitchen has too many ovens but not enough chefs
BThe chef has too many tasks to do at once and can't keep up
CThe ingredients are delivered late to the kitchen
DThe kitchen is too big and chefs have to walk too far
Attempts:
2 left
💡 Hint

Think about what limits the chef's speed directly.

Predict Output
intermediate
2:00remaining
What is the output of this Python code simulating a slow function call?

Consider this code that simulates a slow function by sleeping. What will be printed?

Testing Fundamentals
import time
start = time.time()
for _ in range(3):
    time.sleep(0.5)
end = time.time()
print(round(end - start, 1))
A3.0
B0.5
C1.5
D1.0
Attempts:
2 left
💡 Hint

Each sleep lasts 0.5 seconds and runs 3 times.

assertion
advanced
2:00remaining
Which assertion correctly checks that a function runs under 2 seconds?

You want to test that process_data() finishes in less than 2 seconds. Which assertion is correct?

Testing Fundamentals
import time
start = time.time()
process_data()
end = time.time()
# Which assertion below is correct?
Aassert (end - start) < 2
Bassert (start - end) < 2
Cassert (end + start) < 2
Dassert (end * start) < 2
Attempts:
2 left
💡 Hint

Think about how to measure elapsed time.

🔧 Debug
advanced
2:00remaining
Identify the performance bottleneck in this code snippet

Look at this Python code that processes a list. What causes the slowdown?

Testing Fundamentals
data = list(range(100000))
result = []
for i in data:
    if i % 2 == 0:
        result.append(i)
    else:
        result.append(i*2)
print(len(result))
AThe print statement slows down the program
BUsing modulo operator (%) causes errors
CThe range function is slow for large numbers
DUsing a for-loop with append instead of list comprehension
Attempts:
2 left
💡 Hint

Think about how Python handles list building efficiently.

framework
expert
2:00remaining
Which tool is best suited to identify database query bottlenecks in a web app?

You want to find slow database queries causing delays in your web application. Which tool helps best?

AA profiler that tracks SQL query execution times
BA unit testing framework for UI components
CA code linter that checks syntax errors
DA version control system like Git
Attempts:
2 left
💡 Hint

Focus on tools that measure performance, not code correctness.