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 : 43
What will be the output of the following PHP code? If say date is 22/06/2013.

     <?php      printf( date(t) )     ?> 

30
22
JUNE
2013

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

 <?php   $fname = array(Peter, Ben, Joe);
$age = array(35, 37, 43);
$c = array_combine($fname, $age);
print_r($c);
?>

Array ( Peter Ben Joe )
Array ( [Peter] => 35 [Ben] => 37 [Joe] => 43 )
Array ( 35 37 43 )
Array ( [Peter] => 35 [Ben] => 37 [Joe] => 43 )

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

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

00000000000000000000….infinitely
-1-1-1-1-1-1-1-1-1-1…infinitely
no output
error

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

 <?php  $color = red;
echo $color . red ;
?>

red red
red
error
nothing

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

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

redgreen
red green
0
1

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

 <?php  define('GOOD_OCTAL', 0700);
define('BAD_OCTAL', 0600);
print GOOD_OCTAL;
print '
';
print BAD_OCTAL;
?>

448
384
0700
0800
ERROR
No output

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

 <?php  $a1 = array(red, green);
$a2 = array(blue, yellow);
print_r(array_merge($a1, $a2));
?>

Array ( [0] => red [1] => green)
Array ( [0] => blue [1] => yellow [2] => red [3] => green )
Array ( [0] => red [1] => green [2] => blue [3] => yellow )
Array ( [0] => blue [1] => yellow )