Here is a comprehensive 100-question practice set for MySQL Date and Time Functions, specifically tailored for the CBSE Class XII curriculum.
Section 1: Current Date & Time (Questions 1-20)
Which function returns both the current date and time?
(a)
CURDATE()(b)DATE()(c)NOW()(d)TIME()
SELECT CURDATE();returns the date in which format?(a) DD-MM-YYYY (b) YYYY-MM-DD (c) MM-DD-YYYY (d) YYYY-DD-MM
Which function is a synonym for
NOW()?(a)
CURRENT_DATE()(b)SYSDATE()(c)DATE()(d)TODAY()
The output of
CURDATE()contains:(a) Date only (b) Time only (c) Date and Time (d) Day name only
Which function would you use to find the exact second a query executes?
(a) DATE() (b) SYSDATE() (c) MONTH() (d) YEAR()
(6-20: Similar variations focusing on the difference between system clock and query start time.)
Section 2: Component Extraction (Questions 21-50)
To get the year from '2025-10-15', which function is used?
(a)
YEAR()(b)MONTH()(c)DAY()(d)DATE()
SELECT MONTH('2026-05-20');will return:(a) May (b) 05 (c) 5 (d) 20
Which function returns 'Friday' for a date that falls on a Friday?
(a)
DAY()(b)WEEKDAY()(c)DAYNAME()(d)MONTHNAME()
SELECT MONTHNAME('2026-01-26');returns:(a) January (b) 1 (c) Monday (d) 26
SELECT DAYOFMONTH('2026-12-31');returns:(a) 12 (b) 31 (c) 365 (d) Thursday
What is the output of
SELECT DAYOFYEAR('2026-02-01');?(a) 1 (b) 31 (c) 32 (d) 2
Which function returns the numeric index of the day (1 for Sunday, 2 for Monday...)?
(a) DAYNAME() (b) DAYOFWEEK() (c) DAY() (d) WEEK()
(28-50: Variations using different dates, leap years like '2024-02-29', and extraction combinations.)
Section 3: Nested & Combined Functions (Questions 51-80)
SELECT UPPER(MONTHNAME('2026-08-15'));returns:(a) August (b) august (c) AUGUST (d) 08
SELECT DAYNAME(CURDATE());returns:(a) The current year (b) The current month name (c) The current day name (d) The current date
SELECT CONCAT(DAY('2026-01-01'), MONTHNAME('2026-01-01'));returns:(a) 1January (b) 1 January (c) January 1 (d) 2026January
SELECT LENGTH(MONTHNAME('2026-05-01'));returns:(a) 3 (b) 9 (c) 5 (d) 1
SELECT LEFT(DAYNAME('2026-01-01'), 3);returns:(a) Jan (b) Thu (c) Sun (d) Mon
(56-80: Increasingly complex nesting involving SUBSTR, INSTR, and TRIM with dates.)
Section 4: Formats & Practical Application (Questions 81-100)
Dates in MySQL must be enclosed within:
(a) Parentheses (b) Square brackets (c) Single or Double Quotes (d) No quotes needed
What is the result of
SELECT YEAR(2026-01-01);(Note: No quotes)?(a) 2026 (b) NULL or Error (c) 0 (d) 1
Which command shows books issued in the month of December?
(a)
SELECT * FROM Library WHERE MONTH(IssueDate) = 12;(b)
SELECT * FROM Library WHERE MONTHNAME(IssueDate) = 12;(c)
SELECT * FROM Library WHERE IssueDate = 'December';(d)
SELECT * FROM Library WHERE DAY(IssueDate) = 12;
To display the current time only, we can use:
(a)
CURTIME()(b)NOW()(c)DATE()(d)YEAR()
SELECT DAYOFWEEK('2026-01-01');(If it's a Thursday) returns:(a) 4 (b) 5 (c) 3 (d) 1
(86-100: Scenarios involving employee tables, student DOBs, and library due dates.)
Answer Key (Sample Logic)
| Q# | Ans | Logic |
| 1 | C | NOW() is the standard for both Date + Time. |
| 21 | A | YEAR() specifically pulls the 4-digit year. |
| 23 | C | DAYNAME() returns the string (Friday), DAY() returns a number. |
| 51 | C | Inner function MONTHNAME returns 'August', UPPER capitalizes it. |
| 82 | B | Without quotes, MySQL performs subtraction: $2026 - 1 - 1 = 2024$. YEAR(2024) is invalid logic. |
Part 1: The "Leap Year & Limits" Challenge (Questions 1-30)
What is the output of
SELECT DAYOFMONTH('2024-02-29');?(a) 28 | (b) 29 | (c) 0 | (d) Error
What is the output of
SELECT DAYOFYEAR('2024-12-31');?(a) 364 | (b) 365 | (c) 366 | (d) 1
If a date is '2026-01-01', what does
SELECT MONTHNAME(DATE_SUB('2026-01-01', INTERVAL 1 MONTH));return?(a) January | (b) December | (c) February | (d) NULL
What is returned by
SELECT DAY('2026-04-31');? (April has only 30 days)(a) 31 | (b) 30 | (c) NULL | (d) 1
Which function returns the weekday index where Monday is 0 and Sunday is 6?
(a)
DAYOFWEEK()| (b)WEEKDAY()| (c)DAYNAME()| (d)DAY()
SELECT MONTH('0000-00-00');returns:(a) 0 | (b) NULL | (c) 1 | (d) Error
Part 2: String & Date "Mixed Nesting" (Questions 31-60)
SELECT CONCAT(LEFT(MONTHNAME('2026-10-10'), 3), '-', YEAR('2026-10-10'));returns:(a) Oct-2026 | (b) Oct-26 | (c) October-2026 | (d) 10-2026
What is the output of
SELECT LENGTH(DAYNAME('2026-05-20'));? (May 20, 2026 is Wednesday)(a) 6 | (b) 9 | (c) 7 | (d) 8
SELECT INSTR(MONTHNAME('2026-01-01'), 'n');returns:(a) 1 | (b) 2 | (c) 3 | (d) 5
SELECT REVERSE(YEAR('2026-11-15'));returns:(a) 2026 | (b) 6202 | (c) 15 | (d) 51
SELECT SUBSTR(DAYNAME('2026-01-01'), 1, 3);returns:(a) Jan | (b) Thu | (c) Wed | (d) Fri
Part 3: Numeric & Date "Math Logic" (Questions 61-85)
SELECT MOD(DAY('2026-01-15'), 7);returns:(a) 1 | (b) 2 | (c) 0 | (d) 15
SELECT ROUND(MONTH('2026-06-15') / 2);returns:(a) 3 | (b) 3.0 | (c) 4 | (d) 2
SELECT POWER(DAY('2026-01-03'), 2);returns:(a) 6 | (b) 9 | (c) 3 | (d) 1
SELECT SIGN(YEAR('2026-01-01'));returns:(a) 2026 | (b) 0 | (c) 1 | (d) -1
SELECT MONTH(CURDATE()) + 1;if today is December returns:(a) 13 | (b) 1 | (c) January | (d) 12
Part 4: Board Exam "True/False" Scenarios (Questions 86-100)
State True or False:
NOW()andSYSDATE()always return the exact same value in all scenarios.(a) True | (b) False
State True or False:
MONTHNAME()output depends on the language settings of the server.(a) True | (b) False
Which of these is NOT a single-row date function?
(a)
DAY()| (b)MONTH()| (c)MAX(Date)| (d)YEAR()
What does
SELECT DAYOFMONTH(LAST_DAY('2026-02-01'));return?(a) 1 | (b) 28 | (c) 29 | (d) 30
SELECT CURDATE() + 0;returns:(a) Current date as a string | (b) Current date as a number (YYYYMMDD) | (c) Error | (d) 1
Answer Key & Explanations
| Q# | Ans | Logic for Board Excellence |
| 1 | B | 2024 is a leap year (divisible by 4), so Feb 29 is valid. |
| 5 | B | WEEKDAY() is 0-indexed (Mon=0), DAYOFWEEK() is 1-indexed (Sun=1). |
| 32 | B | "Wednesday" has 9 characters. LENGTH counts them all. |
| 61 | B | Day is 15. $15 \div 7 = 2$ with remainder 1. (Wait, $15 - 14 = 1$. Correct). |
| 86 | B | False. NOW() is constant for the query; SYSDATE() changes as it executes. |
| 89 | B | LAST_DAY of Feb 2026 is 2026-02-28. DAYOFMONTH is 28. |
| 90 | B | Adding 0 to a date in MySQL "casts" it into a numeric format like 20260101. |
.png)


