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 : 15
What is the default time(in seconds) for which session data is considered valid?

1800
3600
1440
1540

Question No : 16
If session.use_cookie is set to 0, this results in use of..

Session
Cookie
URL rewriting
Nothing happens

Question No : 17
Which directive determines how the session information will be stored?

save_data
session.save
session.save_data
session.save_handler

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

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

4hello4hello4hello4hello4hello…..infinite
5hello5hello5hello5hello5hello…..infinite
no output
error

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

 <?php  $i = 0;
while ($i = 10){ print hi;
}print hello;
?>

hello
infinite loop
hihello
error

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

 <?php  define(GREETING, PHP is a scripting language);
echo $GREETING;
?>

$GREETING
no output
PHP is a scripting language
GREETING

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

 <?php  $color1 = red;
$color2 = green;
echo $color1.$color2;
?>

red green
red
green
error