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

Code:
<?php
$n = "";
while ($n = 20)
{   
    print "Yami";
}
print "Thakur";
?>
  • (A) Yami
  • (B) Thakur
  • (C) YamiThakur
  • (D) Infinite loop
πŸ’¬ Discuss
βœ… Correct Answer: (D) Infinite loop

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

Code:
<?php
$k = 0;
while ($k = 20)
{   
    print "Yami";
}
print "Thakur";
?>
  • (A) Yami
  • (B) infinite loop
  • (C) Yami Thakur
  • (D) Thakur
πŸ’¬ Discuss
βœ… Correct Answer: (C) Yami Thakur

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

Code:
<?php
$n;
if ($n == 0)
    print "MCQ" ;
else
    print "Buddy";
    print "App"
?>
  • (A) MCQ
  • (B) Buddy
  • (C) App
  • (D) Buddy App
πŸ’¬ Discuss
βœ… Correct Answer: (D) Buddy App

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

Code:
<?php
$n = 5;
if ($n++)
    print "Hello World";
else
    print "Hey MCQ Buddy";
?>
  • (A) Hello World
  • (B) Hello MCQ Buddy
  • (C) Error
  • (D) Nothing
πŸ’¬ Discuss
βœ… Correct Answer: (A) Hello World

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

Code:
<?php
$str;
if ($str)
    print "Hello" ;
else
    print "MCQ Buddy";
?>
  • (A) Hello
  • (B) MCQ Buddy
  • (C) Hello MCQ Buddy
  • (D) Error
πŸ’¬ Discuss
βœ… Correct Answer: (B) MCQ Buddy

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

Code:
<?php
$num = 20;
if (1) 
    print "First";
else 
    print "Second";
else 
    print "Third";
?>
  • (A) Error
  • (B) First
  • (C) Second
  • (D) Third
πŸ’¬ Discuss
βœ… Correct Answer: (A) Error

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

Code:
<?php
$num = 15;
if (print $num)
    print "Hello";
else
    print "world"; 
?>
  • (A) Nothing
  • (B) Hello
  • (C) world
  • (D) 15Hello
πŸ’¬ Discuss
βœ… Correct Answer: (D) 15Hello

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

Code:
<?php
$num = 12;
if (echo $num)
    print "True";
else
    print "False"; 
?>
  • (A) 0
  • (B) 1
  • (C) True
  • (D) Error
πŸ’¬ Discuss
βœ… Correct Answer: (D) Error

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

Code:
<?php
$num = 1;
if ($num--)
    print "False";
if ($num++)
    print "True"; 
?>
  • (A) Nothing
  • (B) False
  • (C) True
  • (D) Error
πŸ’¬ Discuss
βœ… Correct Answer: (C) True

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

Code:
<?php
$n = 0;
if ($n == 1)
    if ($n >= 0)
        print "True";
    else
        print "False"; 
?>
  • (A) 0
  • (B) 1
  • (C) True
  • (D) Nothing
πŸ’¬ Discuss
βœ… Correct Answer: (D) Nothing