πŸ“Š PHP
Q. What will be the output of the following PHP code ?
Code:
<?php
$color = red;
echo "$color";
?>
  • (A) red
  • (B) $color
  • (C) red
  • (D) Error
πŸ’¬ Discuss
βœ… Correct Answer: (B) $color
πŸ“Š PHP
Q. What will be the output of the following PHP code ?
Code:
<?php
$color = red;
echo "$color" . red ;
?>
  • (A) red red
  • (B) red
  • (C) error
  • (D) nothing
πŸ’¬ Discuss
βœ… Correct Answer: (C) error
πŸ“Š PHP
Q. What will be the output of the following PHP code ?
Code:
<?php
$color1 = red;
$color2 = green;
echo "$color1"."$color2";
?>
  • (A) red green
  • (B) red
  • (C) green
  • (D) error
πŸ’¬ Discuss
βœ… Correct Answer: (D) error
πŸ“Š PHP
Q. What will be the output of the following PHP code ?
Code:
<?php
$color = "red";
$color = "green";
echo "$color";
?>
  • (A) red
  • (B) green
  • (C) red green
  • (D) error
πŸ’¬ Discuss
βœ… Correct Answer: (B) green
πŸ“Š PHP
Q. What will be the output of the following PHP code ?
Code:
<?php
$color1 = "red";
$color2 = "green";
echo "$color1" . "$color2";
?>
  • (A) red
  • (B) green
  • (C) red green
  • (D) redgreen
πŸ’¬ Discuss
βœ… Correct Answer: (D) redgreen
πŸ“Š PHP
Q. What will be the output of the following PHP code ?
Code:
<?php
$color1 = "red";
$color2 = "green";
echo "$color1" + "$color2";
?>
  • (A) redgreen
  • (B) 0
  • (C) red green
  • (D) error
πŸ’¬ Discuss
βœ… Correct Answer: (B) 0
πŸ“Š PHP
Q. What will be the output of the following PHP code ?
Code:
<?php
$color1 = "red";
$color2 = "red";
echo "$color1" + "$color2";
?>
  • (A) redgreen
  • (B) red green
  • (C) 0
  • (D) 1
πŸ’¬ Discuss
βœ… Correct Answer: (C) 0
πŸ“Š PHP
Q. What will be the output of the following PHP code ?
Code:
<?php
$color1 = "red";
$color2 = "1";
echo "$color1" + "$color2";
?>
  • (A) red1
  • (B) red 1
  • (C) 0
  • (D) 1
πŸ’¬ Discuss
βœ… Correct Answer: (D) 1
πŸ“Š PHP
Q. What is the value of $a and $b after the function call?
Code:
<?php
function doSomething(&$argument) 
    {
        $Result = $argument;
        $argument += 1;
        return $Result;	
    }
$n = 5;
$m = doSomething($n);
echo "n = " . $n . " and m = " . $m;
?>
  • (A) n = 6
  • (B) n = 6 and m = 5
  • (C) m = 6
  • (D) Error
πŸ’¬ Discuss
βœ… Correct Answer: (B) n = 6 and m = 5
πŸ“Š PHP
Q. If $n = 25 what will be returned when (($n == 25) ? 5 : 1) is executed?
  • (A) 5
  • (B) 1
  • (C) 25
  • (D) Error
πŸ’¬ Discuss
βœ… Correct Answer: (C) 25