Q. What will be the output of the following program?

Code:
<?php    
$a = array(16, 5, 2);  
echo array_product($a);  
?>    
  • (A) 160
  • (B) 1652
  • (C) 80
  • (D) 32
πŸ’¬ Discuss
βœ… Correct Answer: (A) 160

Q. Which of the following function is used to compute the difference between two arrays in PHP?

  • (A) diff_array
  • (B) array_diff
  • (C) arrays_diff
  • (D) diff_arrays
πŸ’¬ Discuss
βœ… Correct Answer: (B) array_diff

Q. What will be the output of the following PHP code ?

Code:
<?php
$n = 9;
while (++$n)
{   
    while (--$n > 0)
        print $n;
}
?>
  • (A) Error
  • (B) 9
  • (C) 987654321
  • (D) Nothing
πŸ’¬ Discuss
βœ… Correct Answer: (C) 987654321

Q. What will be the output of the following PHP code ?

Code:
<?php
$n = 4;
while (++$n)
{   
    while ($n --> 0)
        print $n;
}
?>
  • (A) 43210
  • (B) 4
  • (C) Error
  • (D) 01234
πŸ’¬ Discuss
βœ… Correct Answer: (A) 43210

Q. What will be the output of the following PHP code ?

Code:
<?php
$p = 2;
while ((--$p > ++$p) - 2)
{   
    print $p;
}
?>
  • (A) 0000000000........infinite time
  • (B) 2222222.........infinite time
  • (C) -2-2-2-2-2-2-2-2.......infinite time
  • (D) All of above
πŸ’¬ Discuss
βœ… Correct Answer: (B) 2222222.........infinite time

Q. What will be the output of the following PHP code ?

Code:
<?php
$k = -1;
while (++$k && --$k)
{   
    print $k;
}
?>
  • (A) Nothing
  • (B) Error
  • (C) -1
  • (D) 0
πŸ’¬ Discuss
βœ… Correct Answer: (A) Nothing

Q. What will be the output of the following PHP code ?

Code:
<?php
$p = 0;
while(++$p || --$p)
{   
    print $p;
}
?>
  • (A) 123456789101112.......infinite time
  • (B) Error
  • (C) 12345
  • (D) Nothing
πŸ’¬ Discuss
βœ… Correct Answer: (A) 123456789101112.......infinite time

Q. What will be the output of the following PHP code ?

Code:
<?php
$num = 8;
while (--$num > 0 || ++$num)
{   
    print $num;
}
?>
  • (A) 76543211111111......infinite time
  • (B) Error
  • (C) Nothing
  • (D) 7654321
πŸ’¬ Discuss
βœ… Correct Answer: (A) 76543211111111......infinite time

Q. What will be the output of the following PHP code ?

Code:
<?php
$n = 15;
while (--$n > 0 && ++$n)
{   
    print $n;
}
?>
  • (A) Error
  • (B) 15
  • (C) Nothing
  • (D) 15.......infinite time
πŸ’¬ Discuss
βœ… Correct Answer: (D) 15.......infinite time

Q. What will be the output of the following PHP code ?

Code:
<?php
$k = 10;
while (--$k > 0)
{   
    $k++;
    print $k;
    print "Yami";
}
?>
  • (A) Error
  • (B) nothing
  • (C) Yami......infinite time
  • (D) 10Yami......infinite time
πŸ’¬ Discuss
βœ… Correct Answer: (D) 10Yami......infinite time