Which of the following constraints is used to enforce referential integrity?
Correct answer:
B. Foreign key
Explanation:
A foreign key is the constraint specifically designed to enforce referential integrity between two tables. It ensures that values in a column (or columns) in one table match values in the primary key or unique key column of another table (or the same table). This maintains consistency by preventing actions that would orphan records or create invalid links.
Why other options are incorrect:
A. Surrogate key: Incorrect. A surrogate key is an artificial primary key (often an auto-incrementing number) with no business meaning. It does not enforce relationships between tables.
C. Unique key: Incorrect. A unique key constraint ensures all values in a column (or set of columns) are distinct (except NULLs), but it does not define relationships between tables.
D. Primary key: Incorrect. A primary key uniquely identifies each row within its own table. While foreign keys often reference primary keys, the primary key itself does not enforce referential integrity.
Reference:
CompTIA DataSys+ DS0-001 Objective 1.3: "Given a scenario, create and modify database objects using scripts and SQL." This includes understanding constraints, particularly foreign keys for maintaining referential integrity.
Question 32Choose 1
Following a security breach, a database administrator needs to ensure users cannot
change data unless a request is approved by the management team. Which of the
following principles addresses this issue?
Correct answer:
D. Least privilege
Explanation:
The principle of least privilege states that users should be granted only the minimum level of access necessary to perform their job functions. In this scenario, the administrator needs to ensure users cannot change data without management approval, which means users should not have write/update privileges by default. This aligns perfectly with least privilege—users would need their privileges temporarily elevated (through an approved request) to perform data changes.
Why other options are incorrect:
A. Open access: Incorrect. Open access would mean unrestricted access to data, which is the opposite of what the administrator needs to implement after a security breach.
B. Least resistance: Incorrect. "Least resistance" is not a recognized security principle. It generally refers to making things easy for users, which conflicts with security requirements.
C. Elevated privilege: Incorrect. Elevated privilege refers to temporarily granting higher access levels, which might be part of the approval process but is not the underlying principle preventing unauthorized changes.
Reference:
CompTIA DataSys+ DS0-001 Objective 4.2: "Given a scenario, implement and configure database security controls." This includes understanding the principle of least privilege for access control and authorization.
Question 33Choose 1
Which of the following sets the age requirement for data that should be recovered after a
major disaster?
Correct answer:
D. RPO
Explanation:
Recovery Point Objective (RPO) defines the maximum acceptable age of data that must be recovered after a disaster. It answers the question: "How much data can we afford to lose?" For example, an RPO of 24 hours means data can be no older than 24 hours at recovery time, requiring at least daily backups. This directly matches the scenario's "age requirement for data that should be recovered."
Why other options are incorrect:
A. MTBF (Mean Time Between Failures): Incorrect. MTBF measures the average time between system failures, indicating reliability. It does not relate to data recovery age requirements.
B. RTO (Recovery Time Objective): Incorrect. RTO defines the maximum acceptable downtime after a disaster—how quickly systems must be restored. It addresses time to recovery, not data age.
C. MTTF (Mean Time To Failure): Incorrect. MTTF measures the average time until a non-repairable system fails. Like MTBF, it's a reliability metric, not a data recovery requirement.
Reference:
CompTIA DataSys+ DS0-001 Objective 5.1: "Explain the purpose and importance of business continuity and disaster recovery concepts." This includes understanding RPO and RTO as key recovery metrics.
Question 34Choose 1
Given the following customer table:
Which of the following ORM snippets would return the ID, state, and country of all
customers with the newest customers appearingfirst?
Correct answer:
B. Option B
Explanation:
Option B correctly uses order_by() with desc() to sort results in descending order based on First_Purchase_Date. When "newest customers" should appear first, this means customers with the most recent (largest/highest) first purchase date should be at the top of the result set. Descending order (desc()) accomplishes this by placing the most recent dates first.
The syntax order_by(Customer.First_Purchase_Date.desc()) is proper ORM (likely SQLAlchemy) syntax for descending sorting.
Why other options are incorrect:
A. Option A: Incorrect. This uses asc() (ascending order), which would show the oldest customers first (smallest/earliest dates), the opposite of what is requested.
C. Option C: Incorrect. This has no order_by clause at all, so results would be returned in arbitrary order (typically based on database internal storage), not with newest customers first.
D. Option D: Incorrect. This uses order_by without specifying ascending or descending. The default behavior varies by ORM/database but typically defaults to ascending order, which would show oldest customers first.
Reference:
CompTIA DataSys+ DS0-001 Objective 3.2: "Compare and contrast different data movement strategies." This includes understanding how to query and sort data using programming languages and ORM frameworks.
Question 35Choose 1
Which of the following is thebestway to migrate a large data load from one table to another,
considering total time and blocking?
Correct answer:
C. Batch into small loads and run in parallel.
Explanation:
Batching data into smaller chunks and running them in parallel is the optimal strategy for large data migrations when considering both total time and blocking. This approach:
Minimizes blocking: Small transactions hold locks for shorter periods, reducing the impact on concurrent database users
Reduces total time: Parallel execution processes multiple batches simultaneously, completing the migration faster than sequential processing
Provides better manageability: Small batches are easier to monitor, restart if failures occur, and tune individually
Prevents transaction log overflow: Large transactions can fill transaction logs; smaller batches keep log usage manageable
Why other options are incorrect:
A. Split the load size into many transactions: Incorrect. While splitting into smaller transactions reduces blocking, running them sequentially (implied by not specifying parallel) would significantly increase total migration time.
B. Split the load size in half and run simultaneously: Incorrect. Only two parallel streams limits parallelism benefits. Also, halves may still be too large, causing blocking and log issues.
D. Batch large loads into one transaction: Incorrect. This is the worst approach—a single massive transaction causes prolonged blocking, potential transaction log exhaustion, and complete failure if anything goes wrong mid-process.
Reference:
CompTIA DataSys+ DS0-001 Objective 3.2: "Compare and contrast different data movement strategies." This includes optimizing large data migrations by balancing transaction size, concurrency, and performance impact.
Question 36Choose 1
Which of the following commands is part of DDL?
Correct answer:
C. CREATE
Explanation:
CREATE is a Data Definition Language (DDL) command. DDL commands are used to define, modify, and remove database structures and objects, not to manipulate the data within them. CREATE specifically is used to create new database objects such as tables, views, indexes, schemas, and databases.
A. UPDATE: Incorrect. UPDATE is a DML command used to modify existing data within tables.
B. GRANT: Incorrect. GRANT is a DCL command used to give privileges and access rights to users.
D. INSERT: Incorrect. INSERT is a DML command used to add new rows of data to tables.
Reference:
CompTIA DataSys+ DS0-001 Objective 1.3: "Given a scenario, create and modify database objects using scripts and SQL." This includes understanding the different categories of SQL commands, particularly DDL for creating database structures.
That's the last free question
You've seen the free 30% of every topic (36 of 120 questions). Get complete access for every question, explanation and the timed mock exam.