0
0
Testing Fundamentalstesting~20 mins

Code review as testing in Testing Fundamentals - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Code Review Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Purpose of Code Review in Testing

What is the main purpose of performing a code review as part of software testing?

ATo rewrite the code in a different programming language
BTo increase the code size for better performance
CTo find and fix bugs before the code runs in production
DTo remove all comments and documentation from the code
Attempts:
2 left
💡 Hint

Think about how code review helps catch problems early.

assertion
intermediate
2:00remaining
Identifying a Good Assertion in Code Review

Which assertion best checks that a function returns the expected output during a code review?

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

result = add(2, 3)
# Which assertion is correct to verify the result?
Aassert result == '5'
Bassert result == 5
Cassert result > 10
Dassert result != 5
Attempts:
2 left
💡 Hint

Check what the function is supposed to return for inputs 2 and 3.

🔧 Debug
advanced
2:00remaining
Finding the Bug in Code Snippet

During code review, you find this Python function. What error will it cause when called?

Testing Fundamentals
def divide(x, y):
    return x / y

result = divide(10, 0)
ANo error, returns 0
BTypeError
CNameError
DZeroDivisionError
Attempts:
2 left
💡 Hint

What happens when you divide a number by zero in Python?

framework
advanced
2:00remaining
Best Practice for Code Review in Testing Frameworks

Which practice is best when reviewing test code in an automated testing framework?

ACheck that test cases have clear, descriptive names and cover edge cases
BIgnore test case names and focus only on code length
CRemove all comments to make tests shorter
DWrite tests that depend on external systems without mocks
Attempts:
2 left
💡 Hint

Think about what makes tests easy to understand and reliable.

Predict Output
expert
2:00remaining
Output of Code Review Scenario with Assertion

What is the output when running this test code snippet?

Testing Fundamentals
def is_even(n):
    return n % 2 == 0

assert is_even(7) == True
AAssertionError
BTrue
CFalse
DSyntaxError
Attempts:
2 left
💡 Hint

Check if 7 is even and what the assertion expects.