Docsity

Cambridge Certified SQL Associate Exam, Exams of Technology

Toggle sidebar
bg1
Cambridge Certified SQL Associate Practice Exam
Question 1: Which language is primarily used for managing and querying relational databases?
A. HTML
B. CSS
C. SQL
D. XML
Answer: C
Explanation: SQL (Structured Query Language) is specifically designed to manage and query data in
relational databases.
Question 2: What does RDBMS stand for?
A. Relational Database Management System
B. Rapid Database Management Service
C. Relational Data Memory System
D. Random Data Backup Management System
Answer: A
Explanation: RDBMS stands for Relational Database Management System, which organizes data in tables
with rows and columns.
Question 3: Which of the following is NOT a common relational database?
A. MySQL
B. PostgreSQL
C. MongoDB
D. Oracle
Answer: C
Explanation: MongoDB is a NoSQL database, while MySQL, PostgreSQL, and Oracle are relational
databases.
Question 4: What is the primary purpose of SQL normalization?
A. To speed up database queries
B. To reduce redundancy and improve data integrity
C. To increase the number of tables in a database
D. To create more indexes
Answer: B
Explanation: Normalization reduces data redundancy and improves data integrity by organizing data into
well-structured tables.
Question 5: Which SQL clause is used to retrieve data from a database?
A. INSERT
B. UPDATE
C. SELECT
D. DELETE
Answer: C
Explanation: The SELECT statement is used to retrieve data from one or more tables in a database.
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f

Partial preview of the text

Download Cambridge Certified SQL Associate Exam and more Exams Technology in PDF only on Docsity!

Cambridge Certified SQL Associate Practice Exam

Question 1: Which language is primarily used for managing and querying relational databases? A. HTML B. CSS C. SQL D. XML Answer: C Explanation: SQL (Structured Query Language) is specifically designed to manage and query data in relational databases. Question 2: What does RDBMS stand for? A. Relational Database Management System B. Rapid Database Management Service C. Relational Data Memory System D. Random Data Backup Management System Answer: A Explanation: RDBMS stands for Relational Database Management System, which organizes data in tables with rows and columns. Question 3: Which of the following is NOT a common relational database? A. MySQL B. PostgreSQL C. MongoDB D. Oracle Answer: C Explanation: MongoDB is a NoSQL database, while MySQL, PostgreSQL, and Oracle are relational databases. Question 4: What is the primary purpose of SQL normalization? A. To speed up database queries B. To reduce redundancy and improve data integrity C. To increase the number of tables in a database D. To create more indexes Answer: B Explanation: Normalization reduces data redundancy and improves data integrity by organizing data into well-structured tables. Question 5: Which SQL clause is used to retrieve data from a database? A. INSERT B. UPDATE C. SELECT D. DELETE Answer: C Explanation: The SELECT statement is used to retrieve data from one or more tables in a database.

Question 6: In an SQL statement, which clause specifies the source table? A. SELECT B. FROM C. WHERE D. ORDER BY Answer: B Explanation: The FROM clause identifies the table from which data is to be retrieved. Question 7: What does the DISTINCT keyword do in an SQL query? A. Sorts the result set B. Removes duplicate rows from the result set C. Filters rows based on a condition D. Limits the number of rows returned Answer: B Explanation: DISTINCT removes duplicate rows so that each row in the result set is unique. Question 8: Which operator is used to check for equality in an SQL WHERE clause? A. == B. = C. <> D. != Answer: B Explanation: In SQL, the equals sign (=) is used to compare values for equality. Question 9: Which keyword is used to sort query results in ascending or descending order? A. SORT B. GROUP BY C. ORDER BY D. HAVING Answer: C Explanation: ORDER BY is used to sort the result set in either ascending (ASC) or descending (DESC) order. Question 10: Which of the following is a logical operator used in SQL conditions? A. BETWEEN B. AND C. LIKE D. IN Answer: B Explanation: AND is a logical operator that combines multiple conditions in a WHERE clause. Question 11: What does the SQL operator <> represent? A. Greater than B. Less than C. Not equal to D. Equal to

C. INNER JOIN is faster than OUTER JOIN D. There is no difference Answer: B Explanation: An INNER JOIN returns only rows with matching values, whereas an OUTER JOIN (such as LEFT or RIGHT JOIN) includes non-matching rows with NULLs. Question 18: Which join produces the Cartesian product of two tables if no join condition is specified? A. INNER JOIN B. CROSS JOIN C. LEFT JOIN D. NATURAL JOIN Answer: B Explanation: A CROSS JOIN returns the Cartesian product, combining every row of the first table with every row of the second. Question 19: What is a self join in SQL? A. Joining two different databases B. Joining a table with itself C. Joining a table with a subquery D. Joining a table with an index Answer: B Explanation: A self join is used to join a table to itself, often to compare rows within the same table. Question 20: What is the benefit of using table aliases in SQL queries? A. They increase query performance B. They shorten table names for readability C. They prevent SQL injection D. They create new tables automatically Answer: B Explanation: Table aliases are used to give tables temporary names, making complex queries easier to read and write. Question 21: Which clause groups rows that have the same values in specified columns? A. WHERE B. HAVING C. GROUP BY D. ORDER BY Answer: C Explanation: GROUP BY groups rows that have the same values into summary rows, useful with aggregate functions. Question 22: Which aggregate function returns the number of rows in a group? A. SUM() B. AVG() C. COUNT() D. MAX()

Answer: C Explanation: COUNT() returns the number of rows or non-null values in a specified column. Question 23: Which aggregate function calculates the total sum of a numeric column? A. COUNT() B. AVG() C. SUM() D. MIN() Answer: C Explanation: SUM() adds up all the values in a numeric column for a given group or entire table. Question 24: How does the AVG() function work in SQL? A. It returns the highest value B. It calculates the average of numeric values C. It sums up values D. It counts the number of rows Answer: B Explanation: AVG() calculates the average value of a numeric column. Question 25: Which clause is used to filter groups after aggregation? A. WHERE B. HAVING C. GROUP BY D. ORDER BY Answer: B Explanation: HAVING filters the grouped results produced by GROUP BY based on aggregate conditions. Question 26: How do you handle NULL values during aggregation in SQL? A. They are automatically counted as zero B. They are ignored in most aggregate functions C. They cause the query to fail D. They are converted to empty strings Answer: B Explanation: In aggregate functions like SUM() and AVG(), NULL values are typically ignored. Question 27: Which SQL function can be used to replace NULL values with a specified value? A. ISNULL() B. COALESCE() C. NULLIF() D. IFNULL() Answer: B Explanation: COALESCE() returns the first non-NULL value in its argument list, effectively replacing NULLs. Question 28: What is a subquery in SQL? A. A query that modifies data B. A query nested inside another query

Question 34: When performing an UPDATE, why is it important to include a WHERE clause? A. To specify which columns to update B. To limit the update to specific rows and avoid unintentional changes C. To improve query performance D. To create a backup of the table Answer: B Explanation: Without a WHERE clause, the UPDATE statement would modify every row in the table, which may not be intended. Question 35: Which SQL command is used to remove rows from a table? A. ERASE B. REMOVE C. DELETE D. TRUNCATE Answer: C Explanation: The DELETE command removes rows from a table based on specified conditions. Question 36: What is the key difference between DELETE and TRUNCATE? A. DELETE removes all rows; TRUNCATE does not B. TRUNCATE is a DDL command and cannot be rolled back in most systems C. DELETE does not remove rows permanently D. TRUNCATE creates a new table Answer: B Explanation: TRUNCATE is a DDL command that quickly removes all rows from a table but often cannot be rolled back, unlike DELETE which is a DML command. Question 37: What is the purpose of a database transaction? A. To allow concurrent access without any issues B. To execute multiple SQL statements as a single unit of work C. To index data for faster retrieval D. To backup the database Answer: B Explanation: A transaction ensures that a series of SQL statements are executed as a single unit, which can be committed or rolled back to maintain data integrity. Question 38: Which SQL keywords are used to manage transactions? A. BEGIN, COMMIT, and ROLLBACK B. START, SAVE, and EXIT C. OPEN, CLOSE, and UNDO D. INIT, FINISH, and CANCEL Answer: A Explanation: BEGIN, COMMIT, and ROLLBACK are used to manage transactions in SQL. Question 39: What is the purpose of creating an index in a database? A. To store additional data B. To improve the speed of data retrieval operations C. To secure the database

D. To join tables automatically Answer: B Explanation: Indexes improve query performance by allowing the database engine to find data faster. Question 40: Which type of index contains multiple columns? A. Unique index B. Composite index C. Clustered index D. Full-text index Answer: B Explanation: A composite index includes more than one column, which can help optimize queries that filter on multiple columns. Question 41: What is the difference between a clustered and a non-clustered index? A. A clustered index determines the physical order of data, while a non-clustered index does not B. A clustered index is always unique C. Non-clustered indexes store data in memory D. There is no difference Answer: A Explanation: A clustered index sorts and stores the data rows of the table physically, whereas a non- clustered index is stored separately from the actual data. Question 42: Which clause is used to analyze the execution plan of a query? A. PLAN B. EXPLAIN C. DESCRIBE D. ANALYZE Answer: B Explanation: The EXPLAIN command shows how the database engine plans to execute a query, which is useful for performance optimization. Question 43: What does normalization aim to achieve in a relational database? A. Increase the number of redundant data B. Reduce data redundancy and improve data integrity C. Speed up query processing by duplicating data D. Merge multiple databases into one Answer: B Explanation: Normalization organizes data to reduce redundancy and improve consistency and integrity. Question 44: What is a view in SQL? A. A physical table that stores data B. A virtual table based on the result of an SQL query C. A backup of a table D. An index on a table Answer: B Explanation: A view is a virtual table that is generated by a stored query and does not store data physically.

D. SHARE

Answer: C Explanation: The GRANT statement is used to assign specific permissions to a user for accessing database objects. Question 51: How do you revoke a previously granted permission from a user? A. DELETE B. REMOVE C. REVOKE D. CANCEL Answer: C Explanation: The REVOKE command removes previously granted permissions from a user or role. Question 52: What type of constraint ensures that each row in a table has a unique value? A. FOREIGN KEY B. PRIMARY KEY C. CHECK D. UNIQUE Answer: D Explanation: A UNIQUE constraint ensures that all values in a column are distinct, although a PRIMARY KEY also enforces uniqueness along with NOT NULL. Question 53: Which constraint is used to enforce a relationship between two tables? A. CHECK B. PRIMARY KEY C. FOREIGN KEY D. UNIQUE Answer: C Explanation: A FOREIGN KEY constraint creates a link between two tables, ensuring referential integrity. Question 54: Which command is used to permanently remove a table structure from the database? A. DELETE TABLE B. DROP TABLE C. REMOVE TABLE D. ERASE TABLE Answer: B Explanation: DROP TABLE removes the table structure and its data permanently from the database. Question 55: In SQL, what does the term "schema" refer to? A. A specific query structure B. The physical storage of data C. The structure or organization of the database objects D. A type of index Answer: C Explanation: A schema defines the organization and structure of database objects such as tables, views, and relationships.

Question 56: What does the term "data manipulation" refer to in SQL? A. Changing the database structure B. Retrieving, inserting, updating, or deleting data C. Backing up the database D. Indexing the database Answer: B Explanation: Data manipulation involves the operations that modify or retrieve data, such as SELECT, INSERT, UPDATE, and DELETE. Question 57: Which SQL command is used to create a new table? A. NEW TABLE B. BUILD TABLE C. CREATE TABLE D. MAKE TABLE Answer: C Explanation: The CREATE TABLE command is used to define a new table and its columns in a database. Question 58: What is a composite primary key? A. A primary key that consists of a single column B. A primary key that is automatically generated C. A primary key that consists of multiple columns D. A primary key that allows duplicate values Answer: C Explanation: A composite primary key uses two or more columns to uniquely identify a row in a table. Question 59: Which clause would you use to filter rows based on a condition before grouping them? A. HAVING B. WHERE C. ORDER BY D. GROUP BY Answer: B Explanation: The WHERE clause filters rows before any grouping or aggregation takes place. Question 60: When combining rows from two or more tables, which SQL clause is essential to define the join condition? A. GROUP BY B. ORDER BY C. ON D. USING Answer: C Explanation: The ON clause specifies the condition used to join tables, ensuring that related rows are matched correctly. Question 61: Which operator would you use to check if a column contains a specific substring? A. IN B. BETWEEN C. LIKE

Question 67: When would you use the EXISTS operator in a subquery? A. To check if a subquery returns any rows B. To compare two columns C. To calculate aggregates D. To create a view Answer: A Explanation: EXISTS checks whether a subquery returns any rows, often used for conditional filtering. Question 68: Which clause is used to combine the results of two or more SELECT statements? A. JOIN B. UNION C. MERGE D. INTERSECT Answer: B Explanation: UNION combines the results of multiple SELECT queries into a single result set, removing duplicates by default. Question 69: How can you include duplicate rows when using UNION? A. Use UNION ALL B. Use UNION DISTINCT C. Use UNION DUPLICATE D. It is not possible Answer: A Explanation: UNION ALL returns all rows from the combined queries, including duplicates. Question 70: What does the TRUNCATE statement do? A. Deletes all rows in a table and resets identity values B. Removes the table structure C. Deletes specific rows based on a condition D. Creates a backup of the table Answer: A Explanation: TRUNCATE removes all rows from a table quickly and typically resets any auto-increment counters. Question 71: Which function would you use to count only unique non-null values in a column? A. COUNT() B. COUNT(DISTINCT column) C. SUM() D. AVG() Answer: B Explanation: COUNT(DISTINCT column) counts only unique non-null values in a specified column. Question 72: What is the role of the CHECK constraint in SQL? A. To enforce uniqueness of data B. To ensure that all values in a column meet a specific condition C. To automatically increment values D. To create a foreign key relationship

Answer: B Explanation: The CHECK constraint limits the values that can be inserted into a column by specifying a condition that must be met. Question 73: Which clause is used to rename a column or table temporarily in a query? A. ALIAS B. RENAME C. AS D. LABEL Answer: C Explanation: The AS keyword assigns an alias to a column or table for clarity in query results. Question 74: What is the function of the IFNULL() function in SQL? A. It converts a value to NULL B. It returns a specified replacement value if the expression is NULL C. It filters out NULL values D. It counts NULL values Answer: B Explanation: IFNULL() returns an alternative value when a NULL is encountered in an expression, ensuring no NULL is returned. Question 75: Which of the following best describes a denormalized database? A. A database with many redundant data points B. A database with no indexes C. A database that strictly adheres to normalization rules D. A database used exclusively for backups Answer: A Explanation: Denormalization involves intentionally introducing redundancy into a database to improve read performance in specific scenarios. Question 76: What is the main advantage of using stored procedures? A. They reduce network traffic by executing complex logic on the server side B. They require no parameters C. They automatically create indexes D. They eliminate the need for transactions Answer: A Explanation: Stored procedures execute on the server, reducing network traffic by handling complex operations internally. Question 77: In SQL, what is a recursive query typically used for? A. To update rows recursively B. To perform iterative operations such as traversing hierarchical data C. To create recursive stored procedures D. To sort data in a recursive manner Answer: B Explanation: Recursive queries are useful for dealing with hierarchical or self-referential data, such as organizational charts.

B. It simplifies complex expressions in the result set C. It improves query performance D. It encrypts the column data Answer: B Explanation: Column aliases make the output more readable by providing a temporary name for complex expressions in the result set. Question 84: Which aggregate function ignores NULL values by default? A. COUNT(*) B. SUM() C. AVG() D. MAX() Answer: B Explanation: Aggregate functions like SUM(), AVG(), MIN(), and MAX() ignore NULL values during calculations. Question 85: When would you use the COALESCE() function over IFNULL()? A. When you need to check multiple expressions for non-null values B. When you only have one expression C. When working with numeric data only D. When creating a new table Answer: A Explanation: COALESCE() can take multiple arguments and returns the first non-NULL value, making it more flexible than IFNULL(). Question 86: Which command is used to modify data in a table without affecting its structure? A. ALTER B. UPDATE C. MODIFY D. CHANGE Answer: B Explanation: UPDATE is used to change existing data in a table without modifying the table structure. Question 87: What is the purpose of the DELETE statement in SQL? A. To remove specific rows from a table B. To delete the table structure C. To update rows with NULL values D. To create backup copies of a table Answer: A Explanation: DELETE removes specific rows based on a condition, without affecting the table structure. Question 88: Which of the following is an example of a Data Definition Language (DDL) command? A. SELECT B. INSERT C. CREATE D. UPDATE Answer: C

Explanation: CREATE is a DDL command used to define and create new database objects such as tables, views, and indexes. Question 89: What does DML stand for in SQL? A. Data Manipulation Language B. Data Management Logic C. Database Modeling Language D. Data Modification List Answer: A Explanation: DML stands for Data Manipulation Language, which includes commands like SELECT, INSERT, UPDATE, and DELETE used for managing data. Question 90: Which SQL statement is used to change the structure of a table, such as adding a column? A. UPDATE TABLE B. ALTER TABLE C. MODIFY TABLE D. CHANGE TABLE Answer: B Explanation: ALTER TABLE is used to modify the structure of an existing table by adding, deleting, or modifying columns. Question 91: What is the purpose of the GRANT statement in SQL? A. To back up the database B. To provide specific permissions to users C. To delete user accounts D. To update table data Answer: B Explanation: GRANT is used to assign privileges to users or roles, controlling access to database objects. Question 92: Which clause would you use to filter groups after the GROUP BY operation? A. WHERE B. HAVING C. ORDER BY D. FILTER Answer: B Explanation: HAVING is used to filter aggregated data after the GROUP BY clause has been applied. Question 93: What is one advantage of using views in SQL? A. They permanently store data B. They simplify complex queries by encapsulating them C. They increase database size D. They are faster than tables Answer: B Explanation: Views encapsulate complex queries into a single virtual table, making it easier to retrieve data without rewriting the logic.

Answer: B Explanation: The ON clause defines the join condition that specifies how rows from different tables are related. Question 100: Which SQL keyword is used to combine the results of two SELECT statements while eliminating duplicates? A. INTERSECT B. UNION C. JOIN D. MERGE Answer: B Explanation: UNION combines the results of two queries and eliminates duplicate rows by default. Question 101: What does the CROSS JOIN operation produce? A. Only matching rows from both tables B. A Cartesian product of the two tables C. All rows from the left table only D. All rows from the right table only Answer: B Explanation: A CROSS JOIN returns the Cartesian product, meaning every row from the first table is combined with every row from the second table. Question 102: Which SQL statement is used to create a new index on a table? A. CREATE INDEX B. ADD INDEX C. NEW INDEX D. MAKE INDEX Answer: A Explanation: CREATE INDEX is used to add an index to one or more columns of a table to improve query performance. Question 103: What does the EXPLAIN statement in SQL help you understand? A. The data types of columns B. The query execution plan and performance details C. The schema of the database D. The backup process of the database Answer: B Explanation: EXPLAIN provides details on how the database engine executes a query, which can help optimize performance. Question 104: Which operator would you use to check if a column's value is NULL? A. = NULL B. IS NULL C. LIKE NULL D. <> NULL Answer: B Explanation: The IS NULL operator is used to test for NULL values in SQL.

Question 105: What is the purpose of the NOT operator in SQL? A. To include additional rows in a query B. To reverse the logical value of a condition C. To join tables D. To count rows Answer: B Explanation: The NOT operator negates a condition, effectively reversing its logic. Question 106: In SQL, what does the term "alias" refer to? A. A permanent change to a column name B. A temporary name assigned to a table or column in a query C. A new type of index D. A backup copy of a table Answer: B Explanation: An alias is a temporary name used in a query to simplify references to tables or columns. Question 107: What is the result of using COUNT() in an SQL query?* A. It counts only non-null values in a column B. It counts all rows in the result set, including rows with NULL values C. It returns the sum of numeric values D. It calculates the average of a column Answer: B Explanation: COUNT(*) counts every row in the result set, regardless of whether any column values are NULL. Question 108: Which clause would you use to limit the results of a query to a certain number of rows? A. OFFSET B. LIMIT C. TOP D. ROWCOUNT Answer: B Explanation: The LIMIT clause restricts the number of rows returned by a query, often used for pagination. Question 109: What is the purpose of the UNION ALL operator? A. To combine queries while removing duplicates B. To combine queries while preserving duplicate rows C. To join tables on matching columns D. To filter out duplicate rows Answer: B Explanation: UNION ALL returns the combined results of two queries, including duplicate rows. Question 110: Which SQL clause is used to specify the order in which rows are returned? A. GROUP BY B. ORDER BY C. HAVING D. SORT BY