πŸ“Š PHP
Q. Which of the conditional statements is/are supported by PHP?
1. if statements
2. if-else statements
3. if-elseif statements
4. switch statements
  • (A) Only 1
  • (B) 1, 2 and 4
  • (C) 2, 3 and 4
  • (D) All of the mentioned.
πŸ’¬ Discuss
βœ… Correct Answer: (D) All of the mentioned.
πŸ“Š PHP
Q. What will be the output of the following PHP code?
Code:
<?php
$team = "arsenal";
switch ($team) 
{
case "manu":
  echo "I love man u";
case "arsenal":
  echo "I love arsenal";
case "manc":
  echo "I love manc"; 
}
?>
  • (A) I love arsenal
  • (B) Error
  • (C) I love arsenalI love manc
  • (D) I love arsenalI love mancI love manu
πŸ’¬ Discuss
βœ… Correct Answer: (C) I love arsenalI love manc
πŸ“Š PHP
Q. Which of the looping statements is/are supported by PHP?
1. for loop
2. while loop
3. do-while loop
4. foreach loop
  • (A) 1 and 2
  • (B) 1, 2 and 3
  • (C) All of the mentioned
  • (D) None of the mentioned
πŸ’¬ Discuss
βœ… Correct Answer: (C) All of the mentioned
πŸ“Š 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); $x++)
{
  if ($user[$x] == "Shrek") continue;
  printf ($user[$x]); 
}
?>
  • (A) AshleyBale
  • (B) AshleyBaleBlank
  • (C) ShrekBlank
  • (D) Shrek
πŸ’¬ Discuss
βœ… Correct Answer: (B) AshleyBaleBlank
πŸ“Š PHP
Q. If $a = 12 what will be returned when ($a == 12) ? 5 : 1 is executed?
  • (A) 12
  • (B) 1
  • (C) Error
  • (D) 5
πŸ’¬ Discuss
βœ… Correct Answer: (D) 5
πŸ“Š PHP
Q. What is the value of $a and $b after the function call?
Code:
<?php
function doSomething( &$arg ) 
{
  $return = $arg;
  $arg += 1;
  return $return;	
}
$a = 3;
$b = doSomething( $a );
?>
  • (A) a is 3 and b is 4
  • (B) a is 4 and b is 3
  • (C) Both are 3
  • (D) Both are 4
πŸ’¬ Discuss
βœ… Correct Answer: (B) a is 4 and b is 3
πŸ“Š PHP
Q. Who is the father of PHP?
  • (A) Rasmus Lerdorf
  • (B) Willam Makepiece
  • (C) Drek Kolkevi
  • (D) List Barely
πŸ’¬ Discuss
βœ… Correct Answer: (A) Rasmus Lerdorf
πŸ“Š PHP
Q. How does the identity operator === compare two values?
  • (A) It converts them to a common compatible data type and then compares the resulting values
  • (B) It returns True only if they are both of the same type and value
  • (C) If the two values are strings, it performs a lexical comparison
  • (D) It bases its comparison on the C strcmp function exclusively
πŸ’¬ Discuss
βœ… Correct Answer: (A) It converts them to a common compatible data type and then compares the resulting values
πŸ“Š PHP
Q. What should be the correct syntax to write a PHP code?
  • (A) < php >
  • (B) < ? php ?>
  • (C)
  • (D)
πŸ’¬ Discuss
βœ… Correct Answer: (D)
πŸ“Š PHP
Q. Under what circumstance is it impossible to assign a default value to a parameter while declaring a function?
  • (A) When the parameter is Boolean
  • (B) When the function is being declared as a member of a class
  • (C) When the parameter is being declared as passed by reference
  • (D) When the function contains only one parameter
πŸ’¬ Discuss
βœ… Correct Answer: (C) When the parameter is being declared as passed by reference