πŸ“Š PHP
Q. Which of the following PHP statements will output Hello World on the screen?
1. echo (β€œHello World”);
2. print (β€œHello World”);
3. printf (β€œHello World”);
4. sprintf (β€œHello World”);
  • (A) 1 and 2
  • (B) 1, 2 and 3
  • (C) All of the mentioned
  • (D) 1, 2 and 4
πŸ’¬ Discuss
βœ… Correct Answer: (B) 1, 2 and 3
πŸ“Š PHP
Q. What will be the output of the following PHP code?
Code:
<?php
$color = "maroon";
$var = $color[2];
echo "$var";
?>
  • (A) a
  • (B) $var
  • (C) r
  • (D) Error
πŸ’¬ Discuss
βœ… Correct Answer: (C) r
πŸ“Š PHP
Q. What will be the output of the following PHP code?
Code:
<?php
$score = 1234;
$scoreboard = (array) $score;
echo $scoreboard[0];
?>
  • (A) 1
  • (B) Error
  • (C) 1234
  • (D) 2
πŸ’¬ Discuss
βœ… Correct Answer: (C) 1234
πŸ“Š PHP
Q. What will be the output of the following PHP code?
Code:
<?php
$total = "25 students";
$more = 10;
$total = $total + $more;
echo "$total";
?>
  • (A) Error
  • (B) 35 students
  • (C) 35
  • (D) 25 students
πŸ’¬ Discuss
βœ… Correct Answer: (C) 35
πŸ“Š PHP
Q. Which of the below statements is equivalent to $add += $add ?
  • (A) $add = $add
  • (B) $add = $add +$add
  • (C) $add = $add + 1
  • (D) $add = $add + $add + 1
πŸ’¬ Discuss
βœ… Correct Answer: (B) $add = $add +$add
πŸ“Š PHP
Q. Which statement will output $x on the screen?
  • (A) echo β€œ$x”;
  • (B) echo β€œ$$x”;
  • (C) echo β€œ/$x”;
  • (D) echo β€œ$x;”;
πŸ’¬ Discuss
βœ… Correct Answer: (A) echo β€œ$x”;
πŸ“Š PHP
Q. What will be the output of the following code?
Code:
<?php
function track() 
{
	static $count = 0;
	$count++;
	echo $count;
}
track();
track();
track();
?>
  • (A) 123
  • (B) 111
  • (C) 000
  • (D) 011
πŸ’¬ Discuss
βœ… Correct Answer: (A) 123
πŸ“Š PHP
Q. What will be the output of the following PHP code?
Code:
<?php
$a = "clue";
$a .= "get";
echo "$a";
?>
  • (A) get
  • (B) true
  • (C) false
  • (D) clueget
πŸ’¬ Discuss
βœ… Correct Answer: (D) clueget
πŸ“Š PHP
Q. What will be the output of the following PHP code?
Code:
<?php
$a = 5;
$b = 5;
span class="sys-fun">echo ($a === $b);
?>
  • (A) 5 === 5
  • (B) Error
  • (C) 1
  • (D) False
πŸ’¬ Discuss
βœ… Correct Answer: (C) 1
πŸ“Š PHP
Q. Which of the below symbols is a newline character?
  • (A)
  • (B)
  • (C) /n
  • (D) /r
πŸ’¬ Discuss
βœ… Correct Answer: (B)