0
0
Agentic_aiml~20 mins

Input validation and sanitization in Agentic Ai - Practice Problems & Coding Challenges

Choose your learning style8 modes available
Challenge - 5 Problems
🎖️
Input Validation Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 conceptual
intermediate
2:00remaining
Why is input validation important in AI systems?

Imagine you have an AI model that predicts loan approvals. Why should you validate the input data before feeding it to the model?

ATo increase the size of the dataset by adding random values.
BTo make the model run faster by skipping some data points.
CTo ensure the data is clean and within expected ranges, preventing wrong predictions.
DTo avoid training the model on too much data.
Attempts:
2 left
💻 code output
intermediate
2:00remaining
Output of input sanitization function

What is the output of this Python function that sanitizes input text by removing digits?

Agentic_ai
def sanitize(text):
    return ''.join(c for c in text if not c.isdigit())

result = sanitize('Agent007 is ready!')
print(result)
AAgent is ready!
BAgent007 is ready!
C007 is ready!
DAgent is ready!
Attempts:
2 left
model choice
advanced
2:00remaining
Choosing a model robust to noisy input data

You have input data that may contain some errors or noise. Which model type is best to handle this situation?

AA simple linear regression model without regularization
BA deep neural network with dropout and batch normalization
CA decision tree with no pruning
DA nearest neighbor model using raw input features
Attempts:
2 left
metrics
advanced
2:00remaining
Evaluating input sanitization impact on model accuracy

You trained two models: one on raw input data and one on sanitized input data. The sanitized model has 5% higher accuracy. What does this suggest?

ASanitizing input data improved data quality, helping the model learn better.
BAccuracy is not affected by input data quality.
CThe model with raw data is always better regardless of accuracy.
DSanitizing input data removed useful information, hurting the model.
Attempts:
2 left
🔧 debug
expert
2:00remaining
Identifying input validation bug in AI pipeline

Consider this code snippet that validates numeric input features before prediction. What error will it raise?

Agentic_ai
def validate_features(features):
    for key, value in features.items():
        if value < 0:
            raise ValueError(f"Negative value for {key}")

input_data = {'age': 25, 'income': -5000, 'score': 70}
validate_features(input_data)
ATypeError: unsupported operand type(s) for <: 'str' and 'int'
BNo error, function runs successfully
CKeyError: 'income'
DValueError: Negative value for income
Attempts:
2 left