1.Easy
Statements such as CREATE, ALTER and DROP belong to which part of SQL?
- AData Definition Language (DDL)
- BData Control Language (DCL)
- CData Manipulation Language (DML)
- DTransaction Control Language (TCL)
2.Easy
What does a CHECK constraint do?
- AVerifies the user's password
- BRejects rows whose values do not satisfy a condition
- CChecks whether a table exists before a query is run on it
- DCounts the rows in a table
3.Easy
In a LIKE pattern, what does the _ (underscore) wildcard stand for?
- AA space character
- BZero or more characters
- CAny letter but no digits
- DExactly one character
4.Medium
What does GRANT SELECT ON employees TO alice do?
- AAllows the user alice to read the employees table
- BCopies the employees table to alice
- CMakes alice the owner of the database
- DAllows alice to update and delete rows in the employees table
5.Medium
Why are indexes created on columns?
- ATo save disk space
- BTo prevent NULL values
- CTo make inserts and updates faster on those columns
- DTo speed up searches and joins on those columns
6.Medium
What does a common table expression (WITH name AS (...)) provide?
- AA new database user
- BA named temporary result that can be used within one statement
- CA permanent table that stays stored on disk until it is dropped
- DAn index on a column
7.Hard
What does the following return: SELECT name FROM students WHERE grade > (SELECT AVG(grade) FROM students)?
- AAn error because subqueries are not allowed in WHERE
- BThe average grade of all students
- CStudents with the highest grade only
- DStudents with a grade above the average grade
8.Hard
Why do many DBMSs use strict two-phase locking, holding exclusive locks until commit?
- AIt prevents cascading aborts, because nobody can read uncommitted writes
- BIt makes deadlocks impossible
- CIt removes the need for a transaction log
- DIt allows transactions to read dirty data safely
Answer key
- 1. A · Data Definition Language (DDL)
- 2. B · Rejects rows whose values do not satisfy a condition
- 3. D · Exactly one character
- 4. A · Allows the user alice to read the employees table
- 5. D · To speed up searches and joins on those columns
- 6. B · A named temporary result that can be used within one statement
- 7. D · Students with a grade above the average grade
- 8. A · It prevents cascading aborts, because nobody can read uncommitted writes
Full step-by-step solutions: practise this topic on examproblems.com.