PHP Date-Time Multiple Choice Questions

1)
Which of the following functions do not return a timestamp?

A) time()
B) date()
C) strtotime()
D) localtime()
E) gmmktime()

2)
The getdate() function returns

A) An integer
B) A floating-point number
C) An array
D) A string
E) A Boolean

3)
.......... Returns the time of sunrise for a given day / location

A) datesunrise()
B) date_sunrise()
C) date-sunrise()
D) date.sunrise()

4)
What will the following script output?

<?php
$time = strtotime ('2004/01/01');
echo date ('H:\i:s', $time);
?>

A) 00:00:00
B) 12:00:00
C) 00:i:00
D) 12:i:00
E) -1

5)
................Checks a date for numeric validity.

A) check_date
B) verifydate
C) Verify_date
D) checkdate

6)
What is the difference, in seconds, between the current timestamp in the GMT time zone and the current timestamp in your local time zone?

A) It depends on the number of hours between the local time zone and GMT
B) There is no difference
C) The two will only match if the local time zone is GMT
D) The two will never match
E) None of the above

7)
You must make a call to ................... to specify what time zone you want calculations to take place in before calling any date functions.

A) date_default_timezone_set()
B) datedefault_timezone_set()
C) date_defaulttimezone_set()
D) date_default_timezoneset()

8)
What would happen if the following script were run on a Windows server set to Moscow, Russia’s time zone?

<?php
echo gmmktime(0, 0, 0, 1, 1, 1970);
?>

A) It would output the number 0
B) It would output the number -1
C) It would output the number 1
D) It would raise an error
E) It would output nothing

9)
The ......... function parses an English textual date or time into a Unix timestamp

A) strtodate()
B) stroftime()
C) strtotime()
D) str_to_time()

10)
................ Formats a local time or date according to locale settings.

A) strftime
B) strgtime
C) strhtime
D) stritime

Answers