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

Code:
<?php
define('ATTENTION_TEXT', 'MCQ Buddy is good website.', true);
echo ATTENTION_TEXt;
$changing_var = 'text';
echo constant('ATTENTION_' . strtoupper($changing_var));
?>
  • (A) Nothing
  • (B) MCQ Buddy is good website.
  • (C) MCQ Buddy is good website.MCQ Buddy is good website.
  • (D) Error
πŸ’¬ Discuss
βœ… Correct Answer: (C) MCQ Buddy is good website.MCQ Buddy is good website.

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

Code:
<?php
define("ATTENTION", "MCQ Buddy is good website.", true);
echo $ATTENTION;
?>
  • (A) MCQ Buddy is good website.
  • (B) Error
  • (C) $ATTENTION
  • (D) ATTENTION
πŸ’¬ Discuss
βœ… Correct Answer: (B) Error

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

Code:
<?php
define("ATTENTION", "MCQ Buddy is good website..", true);
echo ATTENTION;
echo "\n";
echo ATTENTION;?>
  • (A) Error
  • (B) MCQ Buddy is good website.
  • (C) MCQ Buddy is good website. MCQ Buddy is good website.
  • (D) Nothing
πŸ’¬ Discuss
βœ… Correct Answer: (C) MCQ Buddy is good website. MCQ Buddy is good website.

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

Code:
<?php
$v  =  'Hello';
echo "Wor$ld";
?>
  • (A) Hello
  • (B) World
  • (C) ld
  • (D) Wor$ld
πŸ’¬ Discuss
βœ… Correct Answer: (D) Wor$ld

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

Code:
<?php
$str  =  'Hello';
echo 'World{$str}PHP';
?>
  • (A) Hello
  • (B) PHP
  • (C) World{$str}PHP
  • (D) World
πŸ’¬ Discuss
βœ… Correct Answer: (C) World{$str}PHP

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

Code:
<?php
$str  =  'Hello';
print "PHP".$str."World";
?>
  • (A) Hello
  • (B) PHP
  • (C) HelloPHPWorld
  • (D) World
πŸ’¬ Discuss
βœ… Correct Answer: (C) HelloPHPWorld

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

Code:
<?php
$num  =  '8' ;
print  +  + $num;
?>
  • (A) Error
  • (B) 8
  • (C) Nothing
  • (D) 0
πŸ’¬ Discuss
βœ… Correct Answer: (B) 8

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

Code:
<?php
$n  =  'n' ;
print $n * 8;
?>
  • (A) n
  • (B) 8
  • (C) 0
  • (D) 1
πŸ’¬ Discuss
βœ… Correct Answer: (B) 8

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

Code:
<?php
$n = 0x6db7;
print $n<<8;
?>
  • (A) Error
  • (B) 0
  • (C) 7190272
  • (D) 0x6db7
πŸ’¬ Discuss
βœ… Correct Answer: (C) 7190272

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

Code:
<?php
$m = 10;
$n = 11;
$s = 12;
print (( +  + $m + $n) >! ($n - $s));
?>
  • (A) 1
  • (B) 10
  • (C) 11
  • (D) 12
πŸ’¬ Discuss
βœ… Correct Answer: (A) 1