OA Exams

  • web.groovymark@gmail.com
  • October 25, 2024

Question 21

In database design, what does a composite primary key consist of?

a) A single column
b) Multiple columns
c) A combination of primary and foreign keys
d) Two foreign keys

Correct Answer: b) Multiple columns

Explanation: A composite primary key is made up of two or more columns in a table, and together these columns uniquely identify each row.

Question 22

Which type of join includes all rows from the left and right tables, regardless of whether they have matches?

a) INNER JOIN
b) FULL JOIN
c) LEFT JOIN
d) RIGHT JOIN

Correct Answer: b) FULL JOIN

Explanation: A FULL JOIN selects all rows from both tables, regardless of whether there is a match, filling in NULLs where necessary.

Question 23

Which type of index is used in SQL databases to assign entries to buckets?

a) Sparse Index
b) Hash Index
c) Bitmap Index
d) Dense Index

Correct Answer: b) Hash Index

Explanation: A Hash Index assigns index entries to buckets using a hash function, which computes a bucket number from the value of the indexed column.

Question 24

What does the SQL clause GROUP BY do?

a) Orders the results by a specified column
b) Filters the results based on a condition
c) Groups rows that have the same values in specified columns
d) Joins two or more tables based on a condition

Correct Answer: c) Groups rows that have the same values in specified columns

Explanation: The GROUP BY clause groups rows that have the same values in specified columns, often used with aggregate functions like SUM() or COUNT(). EQUIJOIN is used to compare columns using the = operator in SQL. It is the most common type of join where two tables are joined based on equality between specified columns.

Question 25

Which command in SQL deletes a table from a database entirely, including all rows and structure?

a) DELETE
b) TRUNCATE
c) DROP TABLE
d) REMOVE TABLE

Correct Answer: c) DROP TABLE

Explanation: The DROP TABLE command removes an entire table, including its rows and structure, from the database.

Question 26

In SQL, which operator is used for pattern matching with wildcards?

a) LIKE
b) IN
c) BETWEEN
d) EXISTS

Correct Answer: a) LIKE

Explanation: The LIKE operator is used for pattern matching in SQL, often with wildcard characters such as '%' for multiple characters or '_' for a single character.

Question 27

Which SQL statement is used to change the data in an existing row in a table?

a) INSERT
b) UPDATE
c) DELETE
d) CREATE

Correct Answer: b) UPDATE

Explanation: The UPDATE statement is used to modify the data in existing rows in a table by specifying new values for the columns.

Question 28

Which SQL command is used to create an index on one or more columns of a table?

a) CREATE INDEX
b) ALTER TABLE
c) CREATE TABLE
d) CREATE VIEW

Correct Answer: a) CREATE INDEX

Explanation: The CREATE INDEX command creates an index on one or more columns of a table to improve the speed of data retrieval operations.

Question 29

Which clause in SQL is used to limit the number of rows returned by a SELECT statement?

a) WHERE
b) HAVING
c) LIMIT
d) ORDER BY

Correct Answer: c) LIMIT

Explanation: The LIMIT clause is used to specify the maximum number of rows to be returned by a SELECT query, limiting the result set.

Question 30

In a relational database, what does the term “schema” refer to?

a) The structure of a database, including tables, columns, and relationships
b) A subset of data in a table
c) A specific row in a table
d) A command to retrieve data from a table

Correct Answer: a) The structure of a database, including tables, columns, and relationships

Explanation: The schema of a database defines its structure, including the tables, columns, data types, and relationships between tables. established when a foreign key in one table refers to the primary key in another table, allowing multiple rows in the first table to relate to a single row in the second.

Question 31

Which SQL operator is used to return unique values from a column?

a) DISTINCT
b) UNIQUE
c) LIKE
d) BETWEEN

Correct Answer: a) DISTINCT

Explanation: The DISTINCT operator returns only unique values from a column, removing any duplicate values from the result set.

Question 32

Which type of key in a table is used to refer to the primary key in another table?

a) Foreign Key
b) Composite Key
c) Primary Key
d) Unique Key

Correct Answer: a) Foreign Key

Explanation: A Foreign Key is used to refer to the primary key in another table, establishing a relationship between the two tables.

Question 33

What is the purpose of a CHECK constraint in SQL?

a) To ensure that values in a column follow a specific rule
b) To create a relationship between two tables
c) To remove duplicate rows from a result set
d) To limit the number of rows returned by a query

Correct Answer: a) To ensure that values in a column follow a specific rule

Explanation: A CHECK constraint ensures that values in a column must satisfy a specified condition or rule, enforcing data integrity.

Question 34

In which normal form is a table if all columns are functionally dependent on the primary key, and there are no transitive dependencies?

a) First Normal Form (1NF)
b) Second Normal Form (2NF)
c) Third Normal Form (3NF)
d) Boyce-Codd Normal Form (BCNF)

Correct Answer: c) Third Normal Form (3NF)

Explanation: A table is in Third Normal Form (3NF) when all columns are functionally dependent on the primary key and there are no transitive dependencies between non-key columns.

Question 35

Which SQL statement is used to delete specific rows from a table based on a condition?

a) DELETE
b) TRUNCATE
c) DROP TABLE
d) UPDATE

Correct Answer: a) DELETE

Explanation: The DELETE statement is used to remove specific rows from a table based on a condition specified in the WHERE clause.

Question 36

Which clause in SQL is used to filter rows before grouping them in a GROUP BY query?

a) HAVING
b) WHERE
c) LIMIT
d) ORDER BY

Correct Answer: b) WHERE

Explanation: The WHERE clause filters rows before they are grouped in a GROUP BY query, applying conditions to individual rows.

Question 37

Which type of key uniquely identifies each row in a table and must always contain unique, non-null values?

a) Primary Key
b) Foreign Key
c) Composite Key
d) Unique Key

Correct Answer: a) Primary Key

Explanation: The Primary Key uniquely identifies each row in a table and ensures that no two rows have the same value in the primary key column(s).

Question 38

What is the main purpose of the ALTER TABLE command in SQL?

a) To modify the structure of an existing table
b) To delete all rows from a table
c) To add rows to a table
d) To create a new index on a table

Correct Answer: a) To modify the structure of an existing table

Explanation: The ALTER TABLE command is used to change the structure of an existing table, such as adding, removing, or modifying columns.

Question 39

Which type of join includes all rows from the right table and only matching rows from the left table?

a) LEFT JOIN
b) INNER JOIN
c) RIGHT JOIN
d) FULL JOIN

Correct Answer: c) RIGHT JOIN

Explanation: A RIGHT JOIN includes all rows from the right table and only the matching rows from the left table. Rows from the right table without a match in the left table will still appear in the result.

Question 40

Which term describes the dependence of one column on another in a table, where one value determines another?

a) Functional Dependence
b) Composite Key
c) Foreign Key
d) Index

Correct Answer: a) Functional Dependence

Explanation: Functional Dependence occurs when one column's value is determined by another column's value in a database table.

Complete the Captcha to view next question set.

Prev Post
WGU D426 Practice Exam Questions – Set 1 – Part 1
Next Post
WGU D426 Practice Exam Questions – Set 1 – Part 3