Oracle Database Quiz Questions

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

In Oracle, the SYSDATE function returns the current date and time from the database server.

Q2
True / False

The ADD_MONTHS function in Oracle adds a specified number of months to a date.

Q3
True / False

In Oracle, the CURRENT_DATE function returns the current date and time in the session time zone.

Q4
True / False

In Oracle, the LAST_DAY function returns the last day of the month for a given date.

Q5
True / False

The MONTHS_BETWEEN function in Oracle calculates the number of months between two dates.

Q6
True / False

In Oracle, the NEXT_DAY function returns the date of the next specified weekday after a given date.

Q7
True / False

The TRUNC function in Oracle can truncate a date to a specified unit, such as year, month, or day.

Q8
True / False

In Oracle, the EXTRACT function can be used to retrieve a specific part of a date, such as the year, month, or day.

Q9
True / False

The TO_DATE function in Oracle converts a string to a date, using a specified date format.

Q10
True / False

The Oracle Certified Professional (OCP) exam includes knowledge on using date functions effectively, understanding their syntax, and optimizing their performance in SQL queries.

Q11
Single Choice

Which Oracle SQL function is used to return the current date and time?

Q12
Single Choice

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

SQL Code
SELECT TO_CHAR(SYSDATE, 'YYYY-MM-DD') FROM dual;
Q13
Single Choice

Which Oracle SQL function can be used to add 7 days to the current date?

Q14
Single Choice

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

SQL Code
SELECT TRUNC(SYSDATE, 'MM') FROM dual;
Q15
Single Choice

Which Oracle SQL function is used to extract the year from a date?

Q16
Single Choice

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

SQL Code
SELECT MONTHS_BETWEEN('01-SEP-2024', '01-JAN-2024') FROM dual;
Q17
Single Choice

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

SQL Code
SELECT NEXT_DAY(SYSDATE, 'MONDAY') FROM dual;
Q18
Single Choice

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

SQL Code
SELECT ADD_MONTHS('01-JAN-2024', 6) FROM dual;
Q19
Single Choice

Which Oracle SQL function can be used to find the last day of the current month?

Q20
Single Choice

What is the result of the following Oracle SQL query?

SQL Code
SELECT ROUND(TO_DATE('15-MAR-2024'), 'YEAR') FROM dual;
Q21
Multiple Choice

Which SQL code snippet uses the `SYSDATE` function to retrieve the current date and time in Oracle?

SQL Code
SELECT SYSDATE FROM dual;

SELECT CURRENT_DATE FROM dual;

SELECT SYSDATE FROM dual;
Q22
Multiple Choice

Which SQL code snippet uses the `TO_DATE` function to convert a string into a date format 'YYYY-MM-DD' in Oracle?

SQL Code
SELECT TO_DATE('2024-08-22', 'YYYY-MM-DD') AS converted_date FROM dual;

SELECT TO_DATE('22-AUG-2024', 'DD-MON-YYYY') AS converted_date FROM dual;

SELECT TO_DATE('2024-08-22', 'YYYY-MM-DD') AS converted_date FROM dual;
Q23
Multiple Choice

Which SQL code snippet uses the `ADD_MONTHS` function to add 6 months to a date in Oracle?

SQL Code
SELECT ADD_MONTHS(SYSDATE, 6) AS future_date FROM dual;

SELECT ADD_MONTHS(SYSDATE, 6) AS future_date FROM dual;

SELECT ADD_MONTHS(SYSDATE, 6) AS future_date FROM dual;
Q24
Multiple Choice

Which SQL code snippet uses the `LAST_DAY` function to find the last day of the current month in Oracle?

SQL Code
SELECT LAST_DAY(SYSDATE) AS last_day_of_month FROM dual;

SELECT LAST_DAY(SYSDATE) AS last_day_of_month FROM dual;

SELECT LAST_DAY(SYSDATE) AS last_day_of_month FROM dual;
Q25
Multiple Choice

Which SQL code snippet uses the `NEXT_DAY` function to find the date of the next Friday in Oracle?

SQL Code
SELECT NEXT_DAY(SYSDATE, 'FRIDAY') AS next_friday FROM dual;

SELECT NEXT_DAY(SYSDATE, 'FRIDAY') AS next_friday FROM dual;

SELECT NEXT_DAY(SYSDATE, 'FRIDAY') AS next_friday FROM dual;
Q26
Multiple Choice

Which SQL code snippet demonstrates advanced use of the `TRUNC` function to truncate the current date to the start of the year in Oracle?

SQL Code
SELECT TRUNC(SYSDATE, 'YEAR') AS start_of_year FROM dual;

SELECT TRUNC(SYSDATE, 'YEAR') AS start_of_year FROM dual;

SELECT TRUNC(SYSDATE, 'YEAR') AS start_of_year FROM dual;
Q27
Multiple Choice

Which SQL code snippet demonstrates advanced use of the `MONTHS_BETWEEN` function to calculate the number of months between two dates in Oracle?

SQL Code
SELECT MONTHS_BETWEEN(TO_DATE('2024-12-31', 'YYYY-MM-DD'), SYSDATE) AS months_diff FROM dual;

SELECT MONTHS_BETWEEN(TO_DATE('2024-12-31', 'YYYY-MM-DD'), SYSDATE) AS months_diff FROM dual;

SELECT MONTHS_BETWEEN(TO_DATE('2024-12-31', 'YYYY-MM-DD'), SYSDATE) AS months_diff FROM dual;
Q28
Multiple Choice

Which SQL code snippet demonstrates certification-level use of the `EXTRACT` function to extract the year from a date column in Oracle?

SQL Code
SELECT EXTRACT(YEAR FROM hire_date) AS hire_year
FROM employees;

SELECT EXTRACT(YEAR FROM hire_date) AS hire_year
FROM employees;

SELECT EXTRACT(YEAR FROM hire_date) AS hire_year
FROM employees;
Q29
Multiple Choice

Which SQL code snippet demonstrates certification-level use of the `TO_CHAR` function to format a date as 'Month DD, YYYY' in Oracle?

SQL Code
SELECT TO_CHAR(SYSDATE, 'Month DD, YYYY') AS formatted_date FROM dual;

SELECT TO_CHAR(SYSDATE, 'Month DD, YYYY') AS formatted_date FROM dual;

SELECT TO_CHAR(SYSDATE, 'Month DD, YYYY') AS formatted_date FROM dual;
Q30
Multiple Choice

Which SQL code snippet demonstrates certification-level use of the `NEW_TIME` function to convert a date from GMT to PST in Oracle?

SQL Code
SELECT NEW_TIME(SYSDATE, 'GMT', 'PST') AS pst_time FROM dual;

SELECT NEW_TIME(SYSDATE, 'GMT', 'PST') AS pst_time FROM dual;

SELECT NEW_TIME(SYSDATE, 'GMT', 'PST') AS pst_time FROM dual;