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

Code:
<?php
$math = "25 students";
$Science = 35;
$math = $math + $Science;
echo "$math";
?>
  • (A) 25
  • (B) 35
  • (C) Error
  • (D) 60
πŸ’¬ Discuss
βœ… Correct Answer: (D) 60

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

Code:
<?php
$num = 10120;
$num1 = (array) $num;
echo $num1[0];
?>
  • (A) 10120
  • (B) Error
  • (C) 101
  • (D) 120
πŸ’¬ Discuss
βœ… Correct Answer: (A) 10120

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

Code:
<?php
$var = "YELLOW";
$var1 = $var[5];
echo "$var1";
?>
  • (A) Y
  • (B) E
  • (C) L
  • (D) W
πŸ’¬ Discuss
βœ… Correct Answer: (D) W

Q. Which of the following PHP statements will output Hello interview Mania on the screen?

  • (A) sprintf (β€œHello interview Mania ”);
  • (B) echo (β€œHello interview Mania ”);
  • (C) print (β€œHello interview Mania ”);
  • (D) B and C
πŸ’¬ Discuss
βœ… Correct Answer: (D) B and C

Q. Which of following variables can be assigned a value to it?

  • (A) $this
  • (B) $3hello
  • (C) $This
  • (D) None of these
πŸ’¬ Discuss
βœ… Correct Answer: (C) $This

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

Code:
<?php
$n  = "12";
$n1 = "21";
print $n+$n1;
?>
  • (A) 33
  • (B) Error
  • (C) 12+21
  • (D) 12
πŸ’¬ Discuss
βœ… Correct Answer: (A) 33

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

Code:
<?php
$n  = 10;
$n1 = 12;
print $n . "+". $n1;
?>
  • (A) 10
  • (B) 12
  • (C) 10+12
  • (D) 12+10
πŸ’¬ Discuss
βœ… Correct Answer: (C) 10+12

Q. Which of the following php statement/statements will store 120 in variable n?

  • (A) 120 = $n;
  • (B) int $n= 120;
  • (C) int n= 120;
  • (D) $n= 120;
πŸ’¬ Discuss
βœ… Correct Answer: (D) $n= 120;

Q. Which of the following must be installed on your computer so as to run PHP script?

  • (A) PHP
  • (B) Apache
  • (C) IIS
  • (D) A, B and C
πŸ’¬ Discuss
βœ… Correct Answer: (D) A, B and C

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

Code:
<?php
$color1 = "1";
$color2 = "1";
echo "$color1" + "$color2";
?>
  • (A) 11
  • (B) 2
  • (C) 0
  • (D) 1
πŸ’¬ Discuss
βœ… Correct Answer: (B) 2