Explore topic-wise MCQs in Php.

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

1.

What will be the output of the following PHP code if date is 15/03/2019?<?php$date = new DateTime();echo $date->format('l,F,js,Y')?>

A. Friday,March,15th 2019
B. Sunday, 15 03 2019
C. Saturday, 15th March 2019
D. Friday, 15/03, 2019
E. None of these
Answer» B. Sunday, 15 03 2019
2.

What will be the output of the following PHP code? If say date is 12/02/2019.<?phpprintf( date("t") )?>

A. 12
B. 02
C. 2019
D. 28
E. None of these
Answer» E. None of these
3.

What will be the output of the following code? If say date is 30/05/2018.<?phpecho "Today is ".date("F d, Y")?>

A. Today is May 30, 2018
B. Error
C. Nothing
D. 30/05/2018
E. None of these
Answer» B. Error
4.

What will be the output of the following PHP code?<?phpecho (checkdate(6,30,2018) ? 'Valid' : 'Invalid');?>

A. 6,30,2018
B. Valid
C. Invalid
D. Error
E. None of these
Answer» C. Invalid
5.

To create an object and set the date to JULY 28, 2018, which one of the following statement should be executed?

A. $date = DateTime( 28 JULY 2018 )
B. $date = new DateTime( 28 JULY 2018 )
C. $date = Date( 28 JULY 2018 )
D. $date = new Date( JULY 28 2018 )
E. None of these
Answer» C. $date = Date( 28 JULY 2018 )
6.

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

A. totime( +65 days )
B. strtotime( -65 days )
C. totime( +65 )
D. strtotime( +65 days )
E. None of these
Answer» E. None of these
7.

What will be the output of the following PHP code? If say date is 12/02/2019.

A. 12
B. 02
C. 2019
D. 28
E. None of these
Answer» E. None of these
8.

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

A. get_last_mod()
B. last_mod()
C. lastmod()
D. getlastmod()
E. None of these
Answer» E. None of these
9.

What will be the output of the following PHP code if date is 15/03/2019?

A. Friday,March,15th 2019
B. Sunday, 15 03 2019
C. Saturday, 15th March 2019
D. Friday, 15/03, 2019
E. None of these
Answer» B. Sunday, 15 03 2019
10.

What will be the output of the following code? If say date is 30/05/2018.

A. Today is May 30, 2018
B. Error
C. Nothing
D. 30/05/2018
E. None of these
Answer» B. Error
11.

Among the four PHP DateTimeZone classes given below how many are non static?

A. getName()
B. getOffset()
C. getTransitions()
D. _construct()
E. None of these
Answer» D. _construct()