Home

Php Programming MCQ Question with Answer

Php Programming MCQ with detailed explanation for interview, entrance and competitive exams. Explanation are given for understanding.

Download Php Programming MCQ Question Answer PDF

Question No : 22
What will be the output of the following PHP code ?

 <?php  $i = 2;
while (++$i){ while (--$i > 0) print $i;
} ?>

210
10
no output
infinite loop

Question No : 23
Which function displays the web pages most recent modification date?

lastmod()
getlastmod()
last_mod()
get_last_mod()

Question No : 24
What will be the output of the following PHP code ?

 <?php  $color1 = red;
$color2 = 1;
echo $color1 + $color2;
?>

red1
red 1
0
1

Question No : 25
What will be the output of the following PHP code ?

 <?php  $i = 5;
while (--$i > 0 || ++$i){ print $i;
} ?>

54321111111….infinitely
555555555…infinitely
54321
5

Question No : 26
What is the default number of seconds that cached session pages are made available before the new pages are created?

360
180
3600
1800

Question No : 27
What will be the output of the following PHP code ?

 <?php  define('GREETING_TEST', 'PHP is a scripting language', true);
echo GREETING_TESt;
$changing_variable = 'test';
echo constant('GREETING_' . strtoupper($changing_variable));
?>

PHP is a scripting language
PHP is a scripting language
GREETING_TESt
PHP is a scripting language
PHP is a scripting language
GREETING_TEST

Question No : 28
If the directive session.cookie_lifetime is set to 3600, the cookie will live until..

3600 sec
3600 min
3600 hrs
the browser is restarted