Sail E0 Webinar

MCQs

Total Questions : 53 | Page 2 of 6 pages
Question 11. What will be the output of the following PHP code?$cars = array("Volvo", "BMW", "Toyota");echo "I like " . $cars[2] . ", " . $cars[1] . " and " . $cars[0] . ".";
  1.    I like Toyota, BMW and Volvo
  2.    I like BMW, Volvo and Toyota
  3.    I like Volvo, BMW and Toyota
  4.    I like Volvo, Toyota and BMW
 Discuss Question
Answer: Option A. -> I like Toyota, BMW and Volvo
Question 12. What will be the output of the following PHP code?$a=array("A","Cat","Dog","A","Dog");$b=array("A","A","Cat","A","Tiger");$c=array_combine($a,$b);print_r(array_count_values($c));
  1.    Array ( [A] => 2 [Cat] => 1 [Dog] => 4 [Tiger] => 1 )
  2.    Array ( [A] => 2 [Cat] => 2 [Dog] => 1 [Tiger] => 1 )
  3.    Array ( [A] => 6 [Cat] => 1 [Dog] => 2 [Tiger] => 1 )
  4.    Array ( [A] => 5 [Cat] => 2 [Dog] => 2 [Tiger] => 1 )
 Discuss Question
Answer: Option D. -> Array ( [A] => 5 [Cat] => 2 [Dog] => 2 [Tiger] => 1 )
Question 13. What will be the output of the following PHP code?$a1 = array("red", "green");$a2 = array("blue", "yellow");$a3 = array_merge($a1, $a2);$a4 = array("a", "b", "c", "d");$a = array_combine($a4, $a3);print_r($a);
  1.    Array ( [a] => red [b] => green [c] => blue [d] => yellow )
  2.    Array ( [0] => red [1] => green [2] => blue [3] => yellow )
  3.    Array ( [0] => blue [1] => yellow [2] => red [3] => green )
  4.    Array ( [a] => blue [b] => yellow [c] => red [d] => green )
 Discuss Question
Answer: Option A. -> Array ( [a] => red [b] => green [c] => blue [d] => yellow )
Question 14. What will be the output of the following PHP code?$a1 = array("a" => "red", "b" => "green", "c" => "blue", "d" => "yellow");$a2 = array("e" => "red", "f" => "green", "g" => "blue", "h" => "orange");$a3 = array("i" => "orange");$a4 = array_combine($a2, $a3);$result = array_diff($a4, $a2);print_r($result);
  1.    Array ( [i] => orange )
  2.    Array ( [d] => yellow [h] => orange )
  3.    Array ( [d] => yellow )
  4.    Array ( [h] => orange )
 Discuss Question
Answer: Option C. -> Array ( [d] => yellow )
Question 15. What will be the output of the following PHP code?$fname = array("Peter", "Ben", "Joe");$age = array("35", "37", "43");$c = array_combine($age, $fname);print_r($c);
  1.    Array ( [35] => Peter [37] => Ben [43] => Joe )
  2.    Array ( Peter Ben Joe )
  3.    Array ( [Peter] => 35 [Ben] => 37 [Joe] => 43 )
  4.    Array ( 35 37 43 )
 Discuss Question
Answer: Option A. -> Array ( [35] => Peter [37] => Ben [43] => Joe )
Question 16. What will be the output of the following PHP code?$names = array("Sam", "Bob", "Jack");echo $names[0] . "is the brother of " . $names[1] . " and " . $names[1] . ".";
  1.    Sam is the brother of Bob and Jack
  2.    Error
  3.    Sam is the brother of Bob and Bob)
  4.    Sam is the brother of Jack and Bob)
 Discuss Question
Answer: Option C. -> Sam is the brother of Bob and Bob)
Question 17. What will be the output of the following PHP code ?$age = array("Harry" => "21", "Ron" => "23","Malfoy" => "21");array_change_key_case($age, CASE_UPPER);array_pop($age);print_r($age);
  1.    Array ( [HARRY] => 21 [RON] => 23 [MALFOY] => 21 )
  2.    Array ( [Harry] => 21 [Ron] => 23 [Malfoy] => 21 )
  3.    Array ( [Harry] => 21 [Ron] => 23 )
  4.    Array ( [HARRY] => 21 [RON] => 23 )
 Discuss Question
Answer: Option D. -> Array ( [HARRY] => 21 [RON] => 23 )
Question 18. What will be the output of the following PHP code?$place = array("NYC", "LA", "Paris");array_pop($place);$place1 = array("Paris");$place = array_merge($place, $place1);print_r($place);
  1.    Array ( [0] => NYC [1] => LA [2] => Paris)
  2.    Array ( [0] => LA [1] => Paris [2] => Paris )
  3.    Array ( [0] => NYC [1] => LA [2] => Paris [3] => Paris )
  4.    None of the mentioned
 Discuss Question
Answer: Option B. -> Array ( [0] => LA [1] => Paris [2] => Paris )
Question 19. What will be the output of the following PHP code?$names = array("Sam", "Bob", "Jack");echo $names[0] . "is the brother of " . $names[1] . " and " . $names[1] . ".".$brother;
  1.    Error
  2.    Sam is the brother of Bob and Bob) $brother
  3.    Sam is the brother of Bob and Bob)
  4.    $brother
 Discuss Question
Answer: Option A. -> Error
Question 20. What will be the output of the following PHP code ?$a1 = array("a" => "red", "b" => "green", "c" => "blue", "d" => "yellow");$result = array_flip($a1);print_r($result);
  1.    Array ( [red] => a [green] => b [blue] => c [yellow] => d )
  2.    Array ( [a] => a [b] => b [c] => c [d] => d )
  3.    Array ( [a] => red [b] => green [c] => blue [d] => yellow )
  4.    Array ( [red] => red [green] => green [blue] => blue [yellow] => yellow )
 Discuss Question
Answer: Option A. -> Array ( [red] => a [green] => b [blue] => c [yellow] => d )

Latest Videos

Latest Test Papers