Bird
Raised Fist0

Consider this simple security test code snippet in Python:

medium📝 Predict Output Q13 of Q15
Testing Fundamentals - Non-Functional Testing
Consider this simple security test code snippet in Python:
def test_password_length(password):
    return len(password) >= 8

result = test_password_length('pass123')
print(result)

What will be the output when this code runs?
ATrue
BFalse
CError
DNone
Step-by-Step Solution
Solution:
  1. Step 1: Understand the function logic

    The function returns True if password length is 8 or more, else False.
  2. Step 2: Check the input password length

    'pass123' has 7 characters, which is less than 8, so function returns False.
  3. Final Answer:

    False -> Option B
  4. Quick Check:

    Password length 7 < 8 = False [OK]
Quick Trick: Count characters to check length condition [OK]
Common Mistakes:
MISTAKES
  • Assuming 'pass123' length is 8
  • Confusing True/False return values
  • Expecting an error due to missing input validation

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Testing Fundamentals Quizzes