0
0
Testing Fundamentalstesting~20 mins

Why white-box testing examines code internals in Testing Fundamentals - Challenge Your Understanding

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
White-Box Testing Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Purpose of White-Box Testing
Why does white-box testing focus on examining the internal code structure?
ATo understand and test the internal logic and paths of the code
BTo verify the software's external behavior without looking at the code
CTo check the software's user interface for usability issues
DTo test the software only through its user inputs and outputs
Attempts:
2 left
💡 Hint
Think about what 'white-box' means compared to 'black-box' testing.
🧠 Conceptual
intermediate
2:00remaining
White-Box Testing Benefits
Which benefit is unique to white-box testing compared to black-box testing?
ATesting the software without knowing its internal code
BTesting the software only through its user interface
CChecking if the software meets user requirements
DFinding hidden errors by analyzing code branches and conditions
Attempts:
2 left
💡 Hint
Consider what white-box testing can do that black-box testing cannot.
Predict Output
advanced
2:00remaining
Output of White-Box Test Coverage Code
What is the output of this white-box test coverage code snippet?
Testing Fundamentals
def test_function(x):
    if x > 0:
        return 'Positive'
    elif x == 0:
        return 'Zero'
    else:
        return 'Negative'

results = [test_function(i) for i in [-1, 0, 1]]
print(results)
A['Zero', 'Positive', 'Negative']
B['Negative', 'Zero', 'Positive']
C['Positive', 'Zero', 'Negative']
D['Negative', 'Positive', 'Zero']
Attempts:
2 left
💡 Hint
Trace the function calls for each input in the list [-1, 0, 1].
assertion
advanced
2:00remaining
Correct Assertion for White-Box Test
Which assertion correctly verifies that a function covers all branches in white-box testing?
Testing Fundamentals
def classify_number(n):
    if n > 0:
        return 'pos'
    elif n == 0:
        return 'zero'
    else:
        return 'neg'
Aassert classify_number(1) == 'pos' or classify_number(0) == 'zero' or classify_number(-1) == 'neg'
Bassert classify_number(1) == 'neg' and classify_number(0) == 'zero' and classify_number(-1) == 'pos'
Cassert classify_number(1) == 'pos' and classify_number(0) == 'zero' and classify_number(-1) == 'neg'
Dassert classify_number(1) == 'pos' and classify_number(0) == 'pos' and classify_number(-1) == 'pos'
Attempts:
2 left
💡 Hint
All branches must be tested and verified correctly.
🔧 Debug
expert
2:00remaining
Debugging White-Box Test Failure
A white-box test fails because a branch is never executed. What is the most likely cause?
AThe test inputs do not cover all possible code paths
BThe software has no bugs and the test is incorrect
CThe test only checks the user interface, ignoring code
DThe software is tested only with invalid inputs
Attempts:
2 left
💡 Hint
Think about what white-box testing requires to cover all branches.