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

Code:
<?php
$fruits = array ("apple", "orange", array ("pear", "mango"),"banana");
echo (count($fruits, 1));
?>
  • (A) 6
  • (B) 5
  • (C) 4
  • (D) 3
πŸ’¬ Discuss
βœ… Correct Answer: (A) 6

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

Code:
<?php
    function multi($num)
    {
        if ($num == 3)
            echo "I Wonder";
        if ($num == 7)
            echo "Which One";
        if ($num == 8)
            echo "Is The";
        if ($num == 19)
            echo "Correct Answer";
    }
    $can = stripos("I love php, I love php too!","PHP");
    multi($can);
?>
  • (A) Correct Answer
  • (B) Is The
  • (C) I Wonder
  • (D) Which One
πŸ’¬ Discuss
βœ… Correct Answer: (D) Which One

Q. Which of the following PHP functions can be used for generating unique ids?

  • (A) md5()
  • (B) uniqueid()
  • (C) mdid()
  • (D) id()
πŸ’¬ Discuss
βœ… Correct Answer: (B) uniqueid()

Q. In the following PHP program, what is/are the properties?

Code:
<?php
    class Example 
    {
        public $name;
        function Sample()
        {
            echo "Learn PHP";
        }
    } 
?>
  • (A) function sample()
  • (B) echo β€œThis is an example”;
  • (C) public $name;
  • (D) class Example
πŸ’¬ Discuss
βœ… Correct Answer: (C) public $name;

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

Code:
<?php
define("GREETING", "PHP is a scripting language");
echo $GREETING;
?>
  • (A) $GREETING
  • (B) no output
  • (C) PHP is a scripting language
  • (D) GREETING
πŸ’¬ Discuss
βœ… Correct Answer: (B) no output

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

Code:
<?php
print "echo hello world";
?>
  • (A) echo hello world
  • (B) hello world
  • (C) nothing
  • (D) error
πŸ’¬ Discuss
βœ… Correct Answer: (A) echo hello world

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

Code:
<?php
$one = 1;
print($one);
print $one;
?>
  • (A) 01
  • (B) 11
  • (C) 10
  • (D) Error
πŸ’¬ Discuss
βœ… Correct Answer: (B) 11

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

Code:
<?php
$cars = array("Volvo", "BMW", "Toyota");
print $cars[2];
?>
  • (A) Volvo
  • (B) BMW
  • (C) Toyota
  • (D) Error
πŸ’¬ Discuss
βœ… Correct Answer: (C) Toyota

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

Code:
<?php
$one = "one";
$two = "two";
print($one$two);
?>
  • (A) onetwo
  • (B) nothing
  • (C) one
  • (D) error
πŸ’¬ Discuss
βœ… Correct Answer: (D) error

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

Code:
<?php
$one = "one";
$two = "two";
print($one,$two);
?>
  • (A) onetwo
  • (B) one, two
  • (C) one
  • (D) error
πŸ’¬ Discuss
βœ… Correct Answer: (D) error