Sail E0 Webinar

MCQs

Total Questions : 53 | Page 4 of 6 pages
Question 31. What will be the output of the following PHP code?$a = array("A", "Cat", "Dog", "A", "Dog");print_r(array_count_values($a));
  1.    Array ( [A] => 2 [Cat] => 2 [Dog] => 1 )
  2.    Array ( [A] => 2 [Cat] => 1 [Dog] => 1)
  3.    Array ( [A] => 2 [Cat] => 1 [Dog] => 2 )
  4.    Array ( [A] => 1 [Cat] => 1 [Dog] => 2 )
 Discuss Question
Answer: Option C. -> Array ( [A] => 2 [Cat] => 1 [Dog] => 2 )
Question 32. 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");$result = array_diff($a1, $a2);print_r($result);
  1.    Array ( [d] => yellow )
  2.    Array ( [c] => blue )
  3.    Array ( [a] => red )
  4.    Array ( [e] => yellow )
 Discuss Question
Answer: Option A. -> Array ( [d] => yellow )
Question 33. What will be the output of the following PHP code?$a = array("red", "green", "blue");array_pop($a);print_r($a);
  1.    Array ( [0] => green [1] => blue )
  2.    Array ( [0] => red [1] => green )
  3.    Array ( [0] => blue [1] => blue )
  4.    Array ( [0] => red [1] => blue )
 Discuss Question
Answer: Option B. -> Array ( [0] => red [1] => green )
Question 34. What will be the output of the following PHP code?$a = array("a"=>"red", "b"=>"green", "c"=>"blue");echo array_shift($a);print_r ($a);
  1.    none of the mentioned
  2.    red
  3.    green
  4.    blue
 Discuss Question
Answer: Option B. -> red
Question 35. What will be the output of the following PHP code?$a1 = array("red", "green");$a2 = array("blue", "yellow");print_r(array_merge($a1, $a2));
  1.    Array ( [0] => blue [1] => yellow [2] => red [3] => green )
  2.    Array ( [0] => red [1] => green [2] => blue [3] => yellow )
  3.    Array ( [0] => blue [1] => yellow )
  4.    Array ( [0] => red [1] => green)
 Discuss Question
Answer: Option B. -> Array ( [0] => red [1] => green [2] => blue [3] => yellow )
Question 36. What will be the output of the following PHP code?$fruits = array ("mango", "apple", "pear", "peach");$fruits = array_flip($fruits);echo ($fruits[0]);
  1.    peach
  2.    error
  3.    0
  4.    mango
 Discuss Question
Answer: Option B. -> error
Question 37. What will be the output of the following PHP code?$fruits = array ("mango", "apple", "peach", "pear");$fruits = asort ($fruits);printr ($fruits);
  1.    Array ( [1] => apple [0] => mango [2] => peach [3] => pear )
  2.    Array ( [0] => apple [1] => mango [2] => peach [3] => pear )
  3.    Array ( [1] => apple [0] => mango [3] => peach [2] => pear )
  4.    Error
 Discuss Question
Answer: Option A. -> Array ( [1] => apple [0] => mango [2] => peach [3] => pear )
Question 38. What will be the output of the following PHP code?$arr = array ("picture1.JPG", "picture2.jpg", "Picture10.jpg", "picture20.jpg");sort($arr);print_r($arr);
  1.    Array ( [0] => Picture10.jpg [1] => picture1.JPG [2] => picture2.jpg [3] => picture20.jpg )
  2.    Array ( [0] => picture1.JPG [1] => Picture10.jpg [2] => picture2.jpg [3] => picture20.jpg )
  3.    Array ( [0] => picture1.JPG [1] => picture2.jpg [2] => Picture10.jpg [3] => picture20.jpg )
  4.    Array ( [0] => Picture10.jpg [1] => picture1.JPG [2] => picture20.jpg [3] => picture2.jpg )
 Discuss Question
Answer: Option A. -> Array ( [0] => Picture10.jpg [1] => picture1.JPG [2] => picture2.jpg [3] => picture20.jpg )
Question 39. What will be the output of the following PHP code?$fruits = array ("apple", "mango", "peach", "pear", "orange");$subset = array_slice ($fruits, 2);print_r ($subset);
  1.    Array ( [0] => peach [1] => pear [2] => orange )
  2.    Array ( [0] => apple [1] => mango )
  3.    Array ( [0] => peach )
  4.    Array ( [0] => apple [1] => mango [2] => peach )
 Discuss Question
Answer: Option A. -> Array ( [0] => peach [1] => pear [2] => orange )
Question 40. What will be the output of the following PHP code?$face = array ("A", "J", "Q", "K");$number = array ("2","3","4", "5", "6", "7", "8", "9", "10");$cards = array_merge ($face, $number);print_r ($cards);
  1.    Array ( [0] => A [1] => 2 [2] => J [3] => 3 [4] => Q [5] => 4 [6] => K [7] => 5 [8] => 6 [9] => 7 [10] => 8 [11] => 9 [12] => 10 )
  2.    Array ( [0] => A [1] => J [2] => Q [3] => K [4] => 2 [5] => 3 [6] => 4 [7] => 5 [8] => 6 [9] => 7 [10] => 8 [11] => 9 [12] => 10 )
  3.    Error
  4.    Array ( [0] => 2 [1] => 3 [2] => 4 [3] => 5 [4] => 6 [5] => 7 [6] => 8 [7] => 9 [8] => 10 [9] => A [10] => J [11] => Q [12] => K )
 Discuss Question
Answer: Option B. -> Array ( [0] => A [1] => J [2] => Q [3] => K [4] => 2 [5] => 3 [6] => 4 [7] => 5 [8] => 6 [9] => 7 [10] => 8 [11] => 9 [12] => 10 )

Latest Videos

Latest Test Papers