Bird
Raised Fist0
Testing Fundamentalstesting~20 mins

Interview preparation for testers in Testing Fundamentals - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Master Tester Interview Prep
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding Test Case Prioritization

Imagine you have 100 test cases but only time to run 20 before a release. Which approach best helps you choose which test cases to run first?

ARun test cases that cover the most critical features and recent bug fixes first.
BRun the first 20 test cases in the order they were written.
CRun test cases randomly to avoid bias.
DRun only the test cases that are easiest to execute.
Attempts:
2 left
💡 Hint

Think about which tests give the most value in finding important bugs quickly.

❓ Predict Output
intermediate
2:00remaining
Test Assertion Outcome

What will be the result of this test assertion in Python?

Testing Fundamentals
def add(a, b):
    return a + b

result = add(2, 3)
assert result == 6, f"Expected 6 but got {result}"
ATest passes silently with no error.
BTypeError because add function arguments are wrong.
CSyntaxError due to incorrect assert syntax.
DAssertionError with message 'Expected 6 but got 5'.
Attempts:
2 left
💡 Hint

Check what the add function returns and what the assertion expects.

❓ locator
advanced
2:00remaining
Choosing the Best Locator for UI Testing

You need to select a locator for a login button on a webpage. Which locator is best for stable and maintainable tests?

ALocate by XPath using absolute path like /html/body/div[2]/button[1].
BLocate by index position among sibling elements.
CLocate by CSS class name that is unique and descriptive, e.g., '.btn-login'.
DLocate by button text which may change, e.g., 'Click Here'.
Attempts:
2 left
💡 Hint

Think about what makes locators less likely to break when the page changes.

🔧 Debug
advanced
2:00remaining
Debugging a Failing Test Case

Given this test code snippet, what is the cause of the failure?

Testing Fundamentals
def divide(a, b):
    return a / b

def test_divide():
    result = divide(10, 0)
    assert result == 0, "Division by zero should return 0"
AThe test code has a syntax error in the assert statement.
BThe divide function raises a ZeroDivisionError instead of returning 0.
CThe assertion expects wrong output; division by zero returns None.
DThe divide function is missing and causes a NameError.
Attempts:
2 left
💡 Hint

Think about what happens in Python when dividing by zero.

❓ framework
expert
2:00remaining
Test Framework Design for Parallel Execution

You want to run tests in parallel to speed up execution. Which framework feature is essential to avoid flaky tests?

ATests are isolated with independent setup and teardown for each test.
BTests share global variables to reduce memory usage.
CTests write logs to the same file without synchronization.
DTests depend on the order of execution to pass.
Attempts:
2 left
💡 Hint

Consider what causes tests to interfere with each other when run at the same time.

Practice

(1/5)
1. What is the main purpose of software testing in a project?
easy
A. To write code for new features
B. To find defects and ensure the software works as expected
C. To design the user interface
D. To manage the project timeline

Solution

  1. Step 1: Understand the role of testing

    Testing is done to check if the software behaves correctly and to find any bugs.
  2. Step 2: Compare options with testing goals

    Only To find defects and ensure the software works as expected talks about finding defects and verifying software behavior, which matches testing purpose.
  3. Final Answer:

    To find defects and ensure the software works as expected -> Option B
  4. Quick Check:

    Testing = Find defects + Verify behavior [OK]
Hint: Testing finds bugs and checks software works [OK]
Common Mistakes:
  • Confusing testing with coding
  • Thinking testing manages project tasks
  • Mixing testing with design roles
2. Which of the following is the correct syntax to write a test case title?
easy
A. verify_user_login_with_valid_credentials
B. verify user login with valid credentials
C. VerifyUserLoginWithValidCredentials
D. "Verify user login with valid credentials"

Solution

  1. Step 1: Identify proper test case title format

    Test case titles should be clear, descriptive, and readable, usually in sentence case with quotes.
  2. Step 2: Evaluate options for clarity and format

    "Verify user login with valid credentials" uses clear sentence case with quotes, making it easy to understand. Others are less readable or informal.
  3. Final Answer:

    "Verify user login with valid credentials" -> Option D
  4. Quick Check:

    Clear descriptive title in quotes = "Verify user login with valid credentials" [OK]
Hint: Test case titles are clear sentences in quotes [OK]
Common Mistakes:
  • Using camelCase or snake_case for titles
  • Writing titles without quotes or punctuation
  • Using all lowercase without clarity
3. Consider this test scenario: A login form accepts username and password. Which test case will fail if the password field allows empty input?
Test Case: Verify login with empty password
Steps:
1. Enter valid username
2. Leave password empty
3. Click login
Expected Result: Login should fail with error message
What will be the test execution result?
medium
A. Fail, because login succeeds with empty password
B. Pass, because empty password is allowed
C. Pass, because login fails as expected
D. Fail, because username is invalid

Solution

  1. Step 1: Understand the test case and expected behavior

    The test expects login to fail when password is empty, showing an error.
  2. Step 2: Analyze the actual behavior described

    The password field allows empty input, so login succeeds, which is against expected result.
  3. Final Answer:

    Fail, because login succeeds with empty password -> Option A
  4. Quick Check:

    Expected fail but login succeeds = Fail [OK]
Hint: If actual differs from expected, test fails [OK]
Common Mistakes:
  • Assuming empty password is valid
  • Confusing pass/fail with allowed inputs
  • Ignoring expected error message
4. You wrote this test step: Click the submit button but the test fails because the button is not found. What is the most likely cause?
medium
A. The locator used to find the button is incorrect or outdated
B. The submit button does not exist in the application
C. The test script has syntax errors
D. The test environment is down

Solution

  1. Step 1: Identify the failure reason for 'button not found'

    This usually means the test script cannot locate the button element on the page.
  2. Step 2: Evaluate possible causes

    Incorrect or outdated locator is the most common cause, as UI changes can break locators.
  3. Final Answer:

    The locator used to find the button is incorrect or outdated -> Option A
  4. Quick Check:

    Button not found = Locator issue [OK]
Hint: Check locators first when element not found [OK]
Common Mistakes:
  • Assuming button is missing without checking locator
  • Blaming syntax errors without evidence
  • Ignoring environment status
5. You have a list of test cases with their results:
[{"id":1, "result":"pass"}, {"id":2, "result":"fail"}, {"id":3, "result":"pass"}, {"id":4, "result":"fail"}]
How many test cases must be re-executed after fixing defects?
hard
A. 3
B. 4
C. 2
D. 1

Solution

  1. Step 1: Identify test cases with failed results

    From the list, test cases with id 2 and 4 have result 'fail'.
  2. Step 2: Determine re-execution count

    Only failed test cases need re-execution after defects are fixed, so count is 2.
  3. Final Answer:

    2 -> Option C
  4. Quick Check:

    Failed tests = 2 [OK]
Hint: Re-run only failed test cases after fixes [OK]
Common Mistakes:
  • Counting all test cases instead of only failed
  • Confusing pass with fail
  • Ignoring test case results
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard