Consider a function that accepts an integer input between 10 and 50 inclusive. Which set correctly represents the boundary values for testing?
Boundary values include the edges and just outside the edges of the input range.
Boundary value analysis tests the edges of input ranges. For 10 to 50 inclusive, test values just below 10 (9), at 10, just above 10 (11), just below 50 (49), at 50, and just above 50 (51).
What is the output of the following Python function when called with input 100?
def test_input(x): if x < 1 or x > 100: return "Invalid" elif x == 1 or x == 100: return "Boundary" else: return "Normal" result = test_input(100) print(result)
Check the conditions for input equal to 100.
The function returns "Boundary" if input is exactly 1 or 100. Since input is 100, output is "Boundary".
Which assertion correctly tests that a function validate_age returns true for the boundary age 18?
def validate_age(age): return 18 <= age <= 65
Check the function logic for age 18.
The function returns true if age is between 18 and 65 inclusive. So for age 18, it returns true. The assertion must check for true.
Given this test code for a function is_valid_score that accepts scores 0 to 100 inclusive, which option shows the bug causing a boundary test to fail?
def is_valid_score(score): return 0 <= score < 100 assert is_valid_score(100) == True
Check the comparison operators in the function.
The function uses < 100, so 100 is excluded. The assert expects true for 100, causing failure.
Which pytest test function correctly tests the boundary values for a function check_temperature that accepts temperatures from -20 to 50 inclusive?
def check_temperature(temp): return -20 <= temp <= 50
Boundary tests include just outside and on the edges of the valid range.
Option B tests values just below, at, just above boundaries and asserts expected results correctly. Others miss some boundary or do not test both valid and invalid cases.