CDS Automation & Scripting 2 — Questions and Answers
Question 1: A data steward wants to schedule a Python script to run every night at 2 AM to refresh data quality metrics. Which tool is most appropriate in a Linux environment?
- cron (Correct answer)
- Makefile
- Docker Compose
- Git hooks
Correct answer: cron
cron is the standard Linux scheduler for running scripts at defined time intervals.
Question 2: Which scripting concept allows a data steward to reuse the same validation logic across multiple datasets without duplicating code?
- Hard-coding values
- Functions or modules (Correct answer)
- Inline scripts
- Manual execution
Correct answer: Functions or modules
Functions and modules encapsulate logic for reuse, reducing duplication and maintenance burden.
Question 3: When automating data ingestion, a script encounters a missing required field in an incoming record. What is the best automated response?
- Skip the record silently
- Log the error and route the record to a quarantine table (Correct answer)
- Insert NULL and continue
- Halt the entire ingestion pipeline
Correct answer: Log the error and route the record to a quarantine table
Logging and quarantining preserves bad records for review while allowing valid records to continue processing.
Question 4: A data steward is automating a metadata tagging process using a REST API. Which HTTP method should be used to update an existing metadata record?
- GET
- POST
- PUT or PATCH (Correct answer)
- DELETE
Correct answer: PUT or PATCH
PUT replaces an entire resource and PATCH updates partial fields; both are correct for updating existing records.
Question 5: In a data pipeline automation script, what is the purpose of idempotency?
- Ensuring the script runs faster on repeated executions
- Ensuring the script produces the same result regardless of how many times it is run (Correct answer)
- Preventing the script from running more than once
- Logging all script executions to a database
Correct answer: Ensuring the script produces the same result regardless of how many times it is run
Idempotency guarantees that re-running a script (e.g., after failure) does not cause duplicate or inconsistent results.
Question 6: Which file format is most commonly used to store configuration parameters (such as database credentials and thresholds) for automation scripts?
- .csv
- .yaml or .json (Correct answer)
- .sql
- .html
Correct answer: .yaml or .json
YAML and JSON are human-readable, structured formats widely used for storing configuration parameters.
Question 7: A data steward's automation script reads from a production database. Which practice best protects the database from script-related performance issues?
- Run scripts during peak business hours
- Use a read replica for reporting and automation queries (Correct answer)
- Grant the script superuser credentials
- Disable query timeouts for the script user
Correct answer: Use a read replica for reporting and automation queries
Read replicas offload query traffic from the primary database, protecting production performance.
A data steward wants to schedule a Python script to run every night at 2 AM to refresh data quality metrics.
Which tool is most appropriate in a Linux environment?