Bird
0
0

Find the bug in this code that simulates concurrent users:

medium📝 Debug Q7 of 15
Testing Fundamentals - Non-Functional Testing
Find the bug in this code that simulates concurrent users:
concurrent_users = 0
for i in range(5):
    concurrent_users =+ 1
print(concurrent_users)
AIncorrect operator '=+' instead of '+='
BRange should start from 1, not 0
CVariable name should be plural
DPrint statement missing parentheses
Step-by-Step Solution
Solution:
  1. Step 1: Identify operator misuse

    '=+' is an assignment of positive value, not increment. Correct is '+=' to add 1.
  2. Step 2: Check other code parts

    Range starting at 0 is valid, variable name is fine, print has parentheses.
  3. Final Answer:

    Incorrect operator '=+' instead of '+=' -> Option A
  4. Quick Check:

    Use '+=' to increment variables [OK]
Quick Trick: Use '+=' to add, not '=+' [OK]
Common Mistakes:
  • Confusing '=+' with '+='
  • Thinking range must start at 1
  • Ignoring syntax errors in print

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Testing Fundamentals Quizzes