0
0
Testing Fundamentalstesting~10 mins

Why security testing protects users in Testing Fundamentals - Test Your Understanding

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

Complete the code to check if a password is strong enough by verifying its length.

Testing Fundamentals
def is_strong_password(password):
    return len(password) [1] 8
Drag options to blanks, or click blank then click option'
A==
B<
C!=
D>=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<' instead of '>=' causes weak passwords to pass.
2fill in blank
medium

Complete the code to check if user input matches the expected secret key.

Testing Fundamentals
def check_secret_key(input_key, secret_key):
    return input_key [1] secret_key
Drag options to blanks, or click blank then click option'
A!=
B==
C>
D<
Attempts:
3 left
💡 Hint
Common Mistakes
Using '!=' will return True when keys do not match.
3fill in blank
hard

Fix the error in the code that checks if a user role is 'admin' to allow access.

Testing Fundamentals
def has_access(user_role):
    if user_role [1] 'admin':
        return True
    return False
Drag options to blanks, or click blank then click option'
A==
B=>
C!=
D=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '=' instead of '==' causes syntax errors.
4fill in blank
hard

Fill both blanks to create a dictionary of users with their access levels, including only those with level above 3.

Testing Fundamentals
users_access = {user: level for user, level in user_levels.items() if level [1] 3 and user [2] 'guest'}
Drag options to blanks, or click blank then click option'
A>
B==
C!=
D<
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<' or '==' will include wrong users.
5fill in blank
hard

Fill all three blanks to filter a dictionary of users with uppercase names, their scores, and only those with scores above 50.

Testing Fundamentals
filtered_scores = {user[1]: score for user, score in scores.items() if score [2] 50 and user [3] 'admin'}
Drag options to blanks, or click blank then click option'
A.upper()
B>
C!=
D.lower()
Attempts:
3 left
💡 Hint
Common Mistakes
Using '.lower()' changes case incorrectly.
Using '<=' includes low scores.