0
0
Testing Fundamentalstesting~20 mins

Boundary value analysis in Testing Fundamentals - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Boundary Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Identify boundary values for input range

Consider a function that accepts an integer input between 10 and 50 inclusive. Which set correctly represents the boundary values for testing?

A9, 10, 11, 49, 50, 51
B10, 20, 30, 40, 50
C11, 25, 49
D9, 15, 35, 51
Attempts:
2 left
💡 Hint

Boundary values include the edges and just outside the edges of the input range.

Predict Output
intermediate
2:00remaining
Output of boundary test function

What is the output of the following Python function when called with input 100?

Testing Fundamentals
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)
AError
BNormal
CBoundary
DInvalid
Attempts:
2 left
💡 Hint

Check the conditions for input equal to 100.

assertion
advanced
2:00remaining
Assertion for boundary value test

Which assertion correctly tests that a function validate_age returns true for the boundary age 18?

Testing Fundamentals
def validate_age(age):
    return 18 <= age <= 65
Aassert validate_age(18) == False
Bassert validate_age(18) is False
Cassert validate_age(18) != True
Dassert validate_age(18) == True
Attempts:
2 left
💡 Hint

Check the function logic for age 18.

🔧 Debug
advanced
2:00remaining
Find the boundary test bug

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?

Testing Fundamentals
def is_valid_score(score):
    return 0 <= score < 100

assert is_valid_score(100) == True
AThe function excludes 100, so assert fails because 100 is not valid
BThe function includes 100, so assert fails due to wrong logic
CThe assert syntax is wrong, causing failure
DThe function accepts negative scores, causing failure
Attempts:
2 left
💡 Hint

Check the comparison operators in the function.

framework
expert
3:00remaining
Design boundary tests in pytest

Which pytest test function correctly tests the boundary values for a function check_temperature that accepts temperatures from -20 to 50 inclusive?

Testing Fundamentals
def check_temperature(temp):
    return -20 <= temp <= 50
A
import pytest
@pytest.mark.parametrize('temp', [-20, 0, 50])
def test_temp(temp):
    assert check_temperature(temp) == True
B
import pytest
@pytest.mark.parametrize('temp', [-21, -20, -19, 49, 50, 51])
def test_temp(temp):
    expected = temp &gt;= -20 and temp &lt;= 50
    assert check_temperature(temp) == expected
C
import pytest
@pytest.mark.parametrize('temp', [-21, 51])
def test_temp(temp):
    assert check_temperature(temp) == False
D
import pytest
def test_temp():
    assert check_temperature(-20) and check_temperature(50)
Attempts:
2 left
💡 Hint

Boundary tests include just outside and on the edges of the valid range.