Read Also: Top 20 MCQ Questions on Handling Files in PHP
1) Which of the following are the valid format parameters of the date() function.
i. A ii. D
iii. K iv. G
A. i, ii and iii only
B. ii, iii and iv only
C. i, ii and iv only
D. All i, ii, iii and iv
2) State whether the following statements about the date() function’s format parameters are TRUE or FALSE.
i. Parameter m specifies the numeric representation of the month with zeros.
ii. Parameter n specifies the numeric representation of the month without zeros.
A. i-True, ii-False
B. i-False, ii-True
C. i-False, ii-False
D. i-True, ii-True
3) The … function returns an associative array consisting of elements regarding the current time.
A. getdate()
B. gettimeofday()
C. gettime()
D. gettimeofdate()
4) The … function accepts a timestamp and returns an associative array consisting of it’s components.
A. getdate()
B. gettimeofday()
C. gettime()
D. gettimeofdate()
5) State whether the following statements about the functions for working with timestamps are TRUE or FALSE.
i. The time function is useful for retrieving the preset UNIX timestamp.
ii. The mktime() function is useful for producing a timestamp based on a given date and time.
A. i-True, ii-False
B. i-False, ii-True
C. i-False, ii-False
D. i-True, ii-True
6) The … function formats a date and time according to the localization setting as specified by setlocale().
A. setflocale()
B. strtime()
C. strftime()
D. localtime()
7) The format parameter of the strftime() function which specifies the numerical day of the month with no leading zero.
A. %e
B. %d
C. %D
D. %g
8) … is the format parameter of the strftime() function which specifies the 12-hour hour format with space preceding single-digit hours.
A. %h
B. %l
C. %I
D. %H
9) The … function changes PHP’s localization default by assigning a new value.
A. setflocale()
B. setlocale()
C. mklocale()
D. localtime()
10) In the … function, if no date and time are provided, the timestamp for the current date and time is required.
A. mkdatetime()
B. mkdate()
C. mktime()
D. currenttimestamp()
11) In total … array elements are returned while converting a timestamp to user-friendly values using the getdate() function.
A. 10
B. 11
C. 12
D. 13
12) State whether the following statements about the array elements returned by getdate() function are TRUE or FALSE.
i. ‘mon’ is the numeric representation of the month.
ii. ‘month’ is the text representation of the month.
iii. ‘yday’ is the text representation of the day of the year.
A. i-True, ii-False, iii-True
B. i-False, ii-True, iii-False
C. i-False, ii-False, iii-True
D. i-True, ii-True, iii-False
13) The … function accomplishes the task of validating dates, returning TRUE if the supplied date is valid and FALSE otherwise.
A. date()
B. checkdate()
C. validatedate()
D. chkdate()
14) The … function returns a string representation of the current date and/or time formatted according to the instructions specified by a predefined format.
A. date()
B. strdate()
C. currentdate()
D. stringdate()
15) … is the function parameter of the strtime() function that specifies the numerical week number where the first Sunday of the year is the first day of the first week of the year.
A. %U
B. %V
C. %u
D. %W
16) … is the function parameter of the strftime() function that specifies the numerical week number, where the first Monday is the first day of the first week.
A. %U
B. %V
C. %u
D. %W
17) The … function returns the value of the page’s last modified header or FALSE in the case of an error.
A. lastmod()
B. getlastmod()
C. getmod()
D. getheader()
18) The … method sets the date objects day, month, and year returning TRUE on success and FALSE otherwise.
A. date()
B. setDate()
C. setDateObjects()
D. dateObjects()
19) The … method sets the date object’s hour, minute, and optionally the second, returning TRUE on success and FALSE otherwise.
A. setTime()
B. setTimeFormat()
C. setTimeObjects()
D. timeObjects()
20) The … method calculates the number of days between today and the subscription termination date.
A. diffdate()
B. diff()
C. calcdate()
D. calcdiffdate()
Answers:
- C. i, ii and iv only
- D. i-True, ii-True
- B. gettimeofday()
- A. getdate()
- D. i-True, ii-True
- C. strftime()
- A. %e
- B. %l
- B. setlocale()
- C. mktime()
- B. 11
- D. i-True, ii-True, iii-False
- B. checkdate()
- A. date()
- A. %U
- D. %W
- B. getlastmod()
- B. setDate()
- A. setTime()
- B. diff()
Comments are closed.