0
0
Testing Fundamentalstesting~10 mins

Equivalence partitioning 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 define an equivalence partition for ages 18 to 65.

Testing Fundamentals
def is_valid_age(age):
    return [1]
Drag options to blanks, or click blank then click option'
Aage == 18 and age == 65
Bage > 18 and age < 65
Cage >= 18 or age <= 65
D18 <= age <= 65
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'or' instead of 'and' in the condition
Excluding boundary values by using strict inequalities
2fill in blank
medium

Complete the code to check if a test input belongs to the invalid age partition (less than 18).

Testing Fundamentals
def is_invalid_age(age):
    return [1]
Drag options to blanks, or click blank then click option'
Aage < 18
Bage <= 18
Cage >= 18
Dage > 18
Attempts:
3 left
💡 Hint
Common Mistakes
Using greater than or equal operators by mistake
Including 18 in the invalid partition
3fill in blank
hard

Fix the error in the code that checks if age is in the valid partition (18 to 65 inclusive).

Testing Fundamentals
def check_age(age):
    if age [1] 18 and age <= 65:
        return True
    else:
        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 '>=' for the lower bound
Mixing up comparison operators
4fill in blank
hard

Fill both blanks to complete the function that returns True if age is in the valid partition (18 to 65 inclusive).

Testing Fundamentals
def valid_age(age):
    return age [1] 18 and age [2] 65
Drag options to blanks, or click blank then click option'
A>=
B<=
C<
D>
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<' or '>' instead of '<=' or '>='
Reversing the order of operators
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that maps each age in the valid partition to True.

Testing Fundamentals
valid_ages = { [1]: True for [2] in range(18, [3]) }
Drag options to blanks, or click blank then click option'
Aage
C66
D65
Attempts:
3 left
💡 Hint
Common Mistakes
Using 65 as the range end, which excludes age 65
Using different variable names for key and loop variable