Q1
True / FalseIn Oracle, the SYSDATE function returns the current date and time from the database server.
The SYSDATE function returns the current date and time according to the database server's clock.
Q2
True / FalseThe ADD_MONTHS function in Oracle adds a specified number of months to a date.
The ADD_MONTHS function adds a specified number of months to a given date.
Q3
True / FalseIn Oracle, the CURRENT_DATE function returns the current date and time in the session time zone.
The CURRENT_DATE function returns the current date and time in the time zone of the current session.
Q4
True / FalseIn Oracle, the LAST_DAY function returns the last day of the month for a given date.
The LAST_DAY function returns the last day of the month for the specified date.
Q5
True / FalseThe MONTHS_BETWEEN function in Oracle calculates the number of months between two dates.
The MONTHS_BETWEEN function calculates the number of months between two dates, returning a fractional value if the dates are not exactly an integer number of months apart.
Q6
True / FalseIn Oracle, the NEXT_DAY function returns the date of the next specified weekday after a given date.
The NEXT_DAY function returns the date of the next specified weekday (e.g., 'MONDAY', 'TUESDAY') after the given date.
Q7
True / FalseThe TRUNC function in Oracle can truncate a date to a specified unit, such as year, month, or day.
The TRUNC function can truncate a date to the specified unit, removing the smaller units of time (e.g., truncating to the year removes month, day, and time).
Q8
True / FalseIn Oracle, the EXTRACT function can be used to retrieve a specific part of a date, such as the year, month, or day.
The EXTRACT function retrieves a specific component (e.g., year, month, day) from a date.
Q9
True / FalseThe TO_DATE function in Oracle converts a string to a date, using a specified date format.
The TO_DATE function converts a string to a date based on the provided date format.
Q10
True / FalseThe Oracle Certified Professional (OCP) exam includes knowledge on using date functions effectively, understanding their syntax, and optimizing their performance in SQL queries.
The OCP certification covers advanced topics, including the effective use of date functions, understanding their syntax, and optimizing their performance in SQL queries.
Q26
Multiple ChoiceWhich 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;
Options A, B, and C correctly demonstrate advanced use of the `TRUNC` function to truncate the current date to the start of the year. Option D is incorrect because it does not use the `TRUNC` function.
Q27
Multiple ChoiceWhich 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;
Options A, B, and C correctly demonstrate advanced use of the `MONTHS_BETWEEN` function to calculate the number of months between two dates. Option D is incorrect because it does not use the `MONTHS_BETWEEN` function.
Q29
Multiple ChoiceWhich 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;
Options A, B, and C correctly demonstrate certification-level use of the `TO_CHAR` function to format a date as 'Month DD, YYYY'. Option D is incorrect because it does not use the correct format.
Q30
Multiple ChoiceWhich 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;
Options A, B, and C correctly demonstrate certification-level use of the `NEW_TIME` function to convert a date from GMT to PST. Option D is incorrect because it does not use the `NEW_TIME` function.