Arrays in PHP MCQ

Answer all questions carefully. After submission, you will see a detailed result and answer review.

Question 1
What will be the output of the following php code? <pre class="prettyprint"> < ?php $states = array("karnataka" => array ( "population" => "11,35,000", "captial" => "Bangalore"), "Tamil Nadu" => array( "population" => "17,90,000", "captial" => "Chennai") ); echo $states["karnataka"]["population"]; ?> </pre>
Question 2
Which function will return true if a variable is an array or false if it is not?
Question 3
Which function returns an array consisting of associative key/value pairs?
Question 4
Which in-built function will add a value to the end of an array?
Question 5
What will be the output of the following PHP code? <pre class="prettyprint"> < ?php $fruits = array ("apple", "orange", "banana"); echo (next($fruits)); echo (next($fruits)); ?> </pre>
Question 6
PHP
Question 7
What will be the output of the following PHP code? <pre class="prettyprint"> < ?php $number = array ("4", "hello", 2); echo (array_sum ($number)); ?> </pre>
Question 8
Say in the above question you need to get the array sorted in the manner we humans would have done it i.e picture1 then picture2 etc.. Which of the following function should be used?
Question 9
Which of the following are correct ways of creating an array? <div>(i) state[0] = "karnataka";</div> <div>(ii) $state[] = array("karnataka");</div> <div>(iii) $state[0] = "karnataka";</div> <div>(iv) $state = array("karnataka");</div>
Question 10
What will be the output of the following PHP code? <pre class="prettyprint"> < ?php $state = array ("Karnataka", "Goa", "Tamil Nadu", "Andhra Pradesh"); echo (array_search ("Tamil Nadu", $state) ); ?> </pre>