Explore topic-wise MCQs in Php.

This section includes 17 Mcqs, each offering curated multiple-choice questions to sharpen your Php knowledge and support exam preparation. Choose a topic below to get started.

1.

To create an object and set the date to JUNE 22, 2013, which one of the following statement should be executed?

A. $date = Date(“22 JUNE 2013”)
B. $date = new Date(“JUNE 22 2013”)
C. $date = DateTime(“22 JUNE 2013”)
D. $date = new DateTime(“22 JUNE 2013”)
Answer» E.
2.

Suppose you want to calculate the date 45 days from the present date which one of the following statement will you use?

A. totime(“+45”)
B. totime(“+45 days”)
C. strtotime(“+45 days”)
D. strtotime(“-45 days”)
Answer» D. strtotime(“-45 days”)
3.

What will be the output of the following PHP code? (If say date is 22/06/2013.)

A. 30
B. 22
C. JUNE
D. 2013View Answer
Answer» B. 22
4.

Which function displays the web page’s most recent modification date?

A. lastmod()
B. getlastmod()
C. last_mod()
D. get_last_mod()
Answer» C. last_mod()
5.

Which one of the following function is useful for producing a timestamp based on a given date and time?

A. time()
B. mktime()
C. mrtime()
D. mtime()
Answer» C. mrtime()
6.

What will be the output of the following code? (If say date is 22/06/2013.)

A. Today is 22 June, 2013
B. Today is 22-06-2013
C. Today is 06-22-2013
D. Today is June 22, 2013View Answer
Answer» E.
7.

If the format is F then which one of the following will be returned?

A. Complete text representation of month
B. Day of month, with leading zero
C. Daylight saving time
D. Day of month, without zeros
Answer» B. Day of month, with leading zero
8.

Which one of the following format parameter can be used to identify timezone?

A. T
B. N
C. E
D. I
Answer» D. I
9.

The date() function returns ___ representation of the current date and/or time.

A. Integer
B. String
C. Boolean
D. Float
Answer» C. Boolean
10.

What will be the output of the following code? If say date is 22/06/2013.

A. oday is 22 June, 2013
B. oday is 22-06-2013
C. oday is 06-22-2013
D. oday is June 22, 2013
Answer» E.
11.

What will be the output of the following PHP code?

A. RUE
B. ALSE
C. alid
D. nvalid
Answer» E.
12.

What will be the output of the following PHP code if date is 24/02/2008?format('l,F,js,Y')?>

A. unday, February 24th 2008
B. unday, 02 24 2008
C. unday, 24 02 2008
D. unday, 24th February 2008
Answer» B. unday, 02 24 2008
13.

What will be the output of the following PHP code? If say date is 22/06/2013.

A. 0
B. 2
C. UNE
D. 013
Answer» B. 2
14.

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

A. t would output the number 0
B. t would output the number -1
C. t would output the number 1
D. t would raise an error
E. t would output nothing
Answer» C. t would output the number 1
15.

Which function displays the web page’s most recent modification date?#

A. lastmod()
B. getlastmod()
C. last_mod()
D. get_last_mod()
Answer» D. get_last_mod()
16.

Today is 22 June, 2013

A. Today is 22-06-2013
B. Today is 06-22-2013
C. Today is June 22, 2013
Answer» C. Today is June 22, 2013
17.

TRUE

A. FALSE
B. Valid
C. Invalid
Answer» C. Invalid