Oracle Database Quiz Questions

Course Name:Oracle
Chapter Name:Chapter 7 - DQL (Data Query Language)
Lesson Content Link:COALESCE
Current Quiz Count:30
Progress
0%
Q1
True / False

In Oracle, the COALESCE function returns the first non-NULL value from a list of expressions.

Q2
True / False

In Oracle, if all the expressions in the COALESCE function are NULL, the result is NULL.

Q3
True / False

The COALESCE function in Oracle can accept only two arguments.

Q4
True / False

In Oracle, the COALESCE function can be used to handle NULL values in columns when performing calculations.

Q5
True / False

The COALESCE function in Oracle can only be used with numeric data types.

Q6
True / False

In Oracle, the COALESCE function stops evaluating expressions once it finds the first non-NULL value.

Q7
True / False

In Oracle, using the COALESCE function can improve query performance compared to using multiple CASE statements.

Q8
True / False

In Oracle, the COALESCE function can be nested within other COALESCE functions.

Q9
True / False

The COALESCE function in Oracle can be used in the SELECT clause, WHERE clause, and ORDER BY clause of a query.

Q10
True / False

The Oracle Certified Professional (OCP) exam includes knowledge on using the COALESCE function effectively, understanding its syntax, and optimizing its performance in SQL queries.

Q11
Single Choice

What is the primary purpose of the COALESCE function in Oracle SQL?

Q12
Single Choice

Which of the following is a correct usage of the COALESCE function in Oracle SQL?

Q13
Single Choice

What will be the result of the following Oracle SQL query?

SQL Code
SELECT COALESCE(NULL, 'Oracle', 'SQL') FROM dual;
Q14
Single Choice

Consider the following Oracle SQL query:What does this query return?

SQL Code
SELECT COALESCE(manager_id, department_id, 0) AS result
FROM employees;
Q15
Single Choice

Which Oracle SQL function could be used as an alternative to COALESCE when checking multiple columns for non-null values?

Q16
Single Choice

Given the Oracle SQL query:What will be the result?

SQL Code
SELECT COALESCE(NULL, TO_NUMBER('123'), TO_NUMBER('456')) FROM dual;
Q17
Single Choice

What will be the result of the following Oracle SQL query?

SQL Code
SELECT COALESCE(employee_id, TO_CHAR(manager_id), 'Unknown') FROM employees WHERE employee_id IS NULL;
Q18
Single Choice

Consider this Oracle SQL query:What does the query return?

SQL Code
SELECT COALESCE(NULL, 100 / 0, 'Fallback') FROM dual;
Q19
Single Choice

Which Oracle SQL query correctly uses COALESCE to handle multiple null values in a more complex scenario?

Q20
Single Choice

What is the result of the following Oracle SQL query?

SQL Code
SELECT COALESCE(CAST(NULL AS VARCHAR2(10)), TO_CHAR(SYSDATE, 'YYYY-MM-DD'), 'Default') FROM dual;
Q21
Multiple Choice

Which SQL code snippet demonstrates using the `COALESCE` function to return the first non-null value from a list?

SQL Code
SELECT employee_id, COALESCE(phone_number, 'No Phone', 'Unknown') AS contact_info
FROM employees
WHERE department_id = 10;
Q22
Multiple Choice

Which SQL code snippet demonstrates using the `COALESCE` function to handle null values in a salary column?

SQL Code
SELECT employee_id, COALESCE(salary, 0) AS salary_amount
FROM employees
WHERE department_id = 20;
Q23
Multiple Choice

Which SQL code snippet demonstrates using the `COALESCE` function to replace null values in a date column with a default date?

SQL Code
SELECT employee_id, COALESCE(hire_date, TO_DATE('01-JAN-2000', 'DD-MON-YYYY')) AS hire_date_adjusted
FROM employees
WHERE department_id = 30;
Q24
Multiple Choice

Which SQL code snippet demonstrates using the `COALESCE` function to combine columns and handle null values?

SQL Code
SELECT employee_id, COALESCE(first_name, last_name, 'Unknown') AS full_name
FROM employees
WHERE department_id = 40;
Q25
Multiple Choice

Which SQL code snippet demonstrates using the `COALESCE` function to select the first non-null value from a list of expressions?

SQL Code
SELECT employee_id, COALESCE(manager_id, department_id, 0) AS identifier
FROM employees
WHERE department_id = 50;
Q26
Multiple Choice

Which SQL code snippet demonstrates advanced use of the `COALESCE` function to handle null values in a complex expression?

SQL Code
SELECT employee_id, COALESCE(SUBSTR(first_name, 1, 1), 'N/A') || '. ' || last_name AS short_name
FROM employees
WHERE department_id = 60;
Q27
Multiple Choice

Which SQL code snippet demonstrates advanced use of the `COALESCE` function with numeric expressions in Oracle?

SQL Code
SELECT employee_id, salary, COALESCE(salary * commission_pct, salary) AS adjusted_salary
FROM employees
WHERE department_id = 70;
Q28
Multiple Choice

Which SQL code snippet demonstrates certification-level use of the `COALESCE` function in a subquery?

SQL Code
SELECT employee_id, (SELECT COALESCE(manager_id, 'No Manager') FROM employees e WHERE e.employee_id = employees.manager_id) AS manager_info
FROM employees
WHERE department_id = 80;
Q29
Multiple Choice

Which SQL code snippet demonstrates certification-level use of the `COALESCE` function in a GROUP BY query?

SQL Code
SELECT department_id, COALESCE(MAX(salary), 0) AS max_salary
FROM employees
GROUP BY department_id
ORDER BY max_salary DESC;
Q30
Multiple Choice

Which SQL code snippet demonstrates certification-level use of the `COALESCE` function combined with a window function?

SQL Code
SELECT employee_id, COALESCE(salary, 0) + SUM(COALESCE(commission_pct * salary, 0)) OVER (PARTITION BY department_id) AS total_compensation
FROM employees
WHERE department_id = 90;