πŸ“Š PHP
Q. What will be the output of the following PHP code?
Code:
<?php
    function uppercase($string)
    {
        echo ucwords($string);
    }
    $wow = "uppercase";
    $wow("Time to live king size");
?> 
  • (A) Time To Live King Size
  • (B) Uppercase
  • (C) Time to live king size
  • (D) TIME TO LIVE KING SIZE
πŸ’¬ Discuss
βœ… Correct Answer: (A) Time To Live King Size
πŸ“Š PHP
Q. What will be the output of the following PHP code?
Code:
<?php
    function calc($num1, $num2)
    {
        $total = $num1 * $num2; 
    }
    $result = calc(42, 0);
    echo $result;    
?>
  • (A) 84
  • (B) 0
  • (C) Error
  • (D) 42
πŸ’¬ Discuss
βœ… Correct Answer: (C) Error
πŸ“Š PHP
Q. What will be the output of the following PHP code?
Code:
<?php
function constant()
{
    define("GREETING", "Welcome to Narnia",true);
    echo greeting;
}
?>
  • (A) ERROR
  • (B) GREETING
  • (C) Welcome to Narnia
  • (D) greeting
πŸ’¬ Discuss
βœ… Correct Answer: (C) Welcome to Narnia
πŸ“Š PHP
Q. What will be the output of the following PHP code?
Code:
<?php
    echo str_pad("Salad", 5)." is good.";
?>
  • (A) Salad is good
  • (B) is good Salad
  • (C) SaladSaladSaladSaladSalad is good
  • (D) is good SaladSaladSaladSaladSalad
πŸ’¬ Discuss
βœ… Correct Answer: (A) Salad is good
πŸ“Š PHP
Q. What will be the output of the following PHP code?
Code:
<?php
function colour()
{ 
    $colors = array("red", "green", "blue", "yellow"); 
    foreach ($colors as $value)
    {
        echo "$value <br>";
    }
}
colour();
?> 
  • (A) red green yellow blue
  • (B) green blue yellow red
  • (C) red green blue yellow
  • (D) red blue yellow green
πŸ’¬ Discuss
βœ… Correct Answer: (C) red green blue yellow
πŸ“Š PHP
Q. What will be the output of the following PHP code?
Code:
<?php
function 2myfunc()
{
    echo "Hello World";
}
2myfunc();
?>
  • (A) ERROR
  • (B) No Output
  • (C) Hello World
  • (D) None of the mentioned
πŸ’¬ Discuss
βœ… Correct Answer: (A) ERROR
πŸ“Š PHP
Q. What will be the output of the following PHP code?
Code:
<?php
        function foo($msg)
        {
            echo "$msg";
        }
        $var1 = "foo";
        $var1("will this work");
    ?>
  • (A) error
  • (B) $msg
  • (C) 0
  • (D) will this work
πŸ’¬ Discuss
βœ… Correct Answer: (D) will this work
πŸ“Š PHP
Q. What will be the output of the following PHP code?
Code:
<?php
$user = array("Ashley", "Bale", "Shrek", "Blank");
    for ($x=0; $x < count($user) - 1; $x++)	
    {
        if ($user[$x++] == "Shrek") 
		    continue;
        printf ($user[$x]); 
    }
?>
  • (A) Bale
  • (B) AshleyShrek
  • (C) BaleBlank
  • (D) AshleyBaleBlank
πŸ’¬ Discuss
βœ… Correct Answer: (D) AshleyBaleBlank
πŸ“Š PHP
Q. Within a namespace, for accessing the built-in PHP classes you can prefix the class name with a . . . . . and let PHP look in the global class list.
  • (A) percent
  • (B) ampersand
  • (C) asterix
  • (D) backslash
πŸ’¬ Discuss
βœ… Correct Answer: (D) backslash
πŸ“Š PHP
Q. Which of the below namespace declaration is correct?
  • (A) namespace ORA:
  • (B) namespace 1_RA;
  • (C) namespace ORA;
  • (D) namespace ORA_#;
πŸ’¬ Discuss
βœ… Correct Answer: (C) namespace ORA;