0
0
Testing Fundamentalstesting~20 mins

Data integrity checks in Testing Fundamentals - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Data Integrity Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
What is the primary goal of data integrity checks in software testing?

Choose the best description of what data integrity checks aim to ensure during software testing.

ATo check if the user interface displays data in the correct font and color.
BTo test the speed of data retrieval from the database under heavy load.
CTo ensure that data is encrypted before transmission over the network.
DTo verify that data remains accurate, consistent, and unaltered during processing and storage.
Attempts:
2 left
💡 Hint

Think about what 'integrity' means in everyday life, like keeping your personal records correct and unchanged.

Predict Output
intermediate
1:30remaining
What is the output of this data validation test code?

Consider this Python code that checks if a list of user IDs contains duplicates. What will it print?

Testing Fundamentals
user_ids = [101, 202, 303, 101, 404]
unique_ids = set(user_ids)
if len(user_ids) == len(unique_ids):
    print('No duplicates found')
else:
    print('Duplicates detected')
ADuplicates detected
BSyntaxError due to missing colon
CNo duplicates found
DTypeError because set() cannot be used on list
Attempts:
2 left
💡 Hint

Check if the list has repeated values and how sets handle duplicates.

assertion
advanced
2:00remaining
Which assertion correctly verifies data integrity after a database update?

You updated a user's email in the database. Which assertion best confirms the update was successful and data integrity is maintained?

Aassert updated_user.email == 'new_email@example.com'
Bassert updated_user.email != 'new_email@example.com'
Cassert updated_user.email == None
Dassert updated_user.email == 12345
Attempts:
2 left
💡 Hint

The assertion should confirm the email matches the new value exactly.

🔧 Debug
advanced
2:00remaining
Identify the error in this data integrity test code snippet

Find the bug in this Python code that verifies if all records have a non-empty 'name' field.

Testing Fundamentals
records = [{'name': 'Alice'}, {'name': 'Bob'}, {'name': ''}]
for record in records:
    assert record['name'], 'Name field is empty!'
print('All records have names')
AThe code raises a KeyError because 'name' key is missing.
BThe assertion fails because one record has an empty name string.
CThe code has a SyntaxError due to missing colon after for loop.
DThe print statement is inside the loop causing multiple prints.
Attempts:
2 left
💡 Hint

Look for any record with an empty or missing 'name' value.

framework
expert
2:30remaining
Which test framework feature best supports automated data integrity checks?

When designing automated tests for data integrity, which feature of a test framework is most helpful?

ABuilt-in UI components for creating graphical test reports.
BCode coverage reports showing which lines of code were executed.
CFixtures to set up and tear down consistent test data before and after tests run.
DSyntax highlighting to make test code easier to read.
Attempts:
2 left
💡 Hint

Think about how to ensure tests start with known good data and clean up after themselves.