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 : 29
What will be the output of the following PHP code ?

 <?php  define(NEW_GOOD_NAME_CONSTANT, I have a value);
define(OLD_BAD_NAME_CONSTANT, NEW_GOOD_NAME_CONSTANT);
�echo NEW_GOOD_NAME_CONSTANT;
echo OLD_BAD_NAME_CONSTANT;
?>

I have a value
I have a valueI have a value
ERROR
I have a valueNEW_GOO_NAME_CONSTANTS

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

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

1234567891011121314….infinitely
01234567891011121314…infinitely
no output
error

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

 <?php  $cars = array(Volvo, BMW, Toyota);
echo I like . $cars[0] . , . $cars[1] . and . $cars[2] . .;
?>

I like Volvo BMW and Toyota.
I like Volvo, BMW and Toyota)
I like Volvo, BMW and Toyota.
I like. Volvo.,. BMW. and. Toyota)

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

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

PHP is a scripting language
GREETING
GREEtING
GREETING
PHP is a scripting language
PHP is a scripting language

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

$date = Date(22 JUNE 2013)
$date = new Date(JUNE 22 2013)
$date = DateTime(22 JUNE 2013)
$date = new DateTime(22 JUNE 2013)

Question No : 34
If the format is F then which one of the following will be returned?

Complete text representation of month
Day of month, with leading zero
Daylight saving time
Day of month, without zeros

Question No : 35
Neglecting to set which of the following cookie will result in the cookies domain being set to the host name of the server which generated it.

session.domain
session.path
session.cookie_path
session.cookie_domain