Assume you would like to sort an array in ascending order by value while preserving key associations. Which of the following PHP sorting functions would you use? sort() krsort() ksort() asort() usort() TRUE ANSWER : ? YOUR ANSWER : ?
What will be the output of the following PHP code?<br/>$array1 = array ("KA", "LA", "CA", "MA", "TA");<br/>$array2 = array ("KA", "IA", "CA", "GA", "TA");<br/>$inter = array_intersect ($array1, $array2);<br/>print_r ($inter); Array ( [1] => IA [3] => GA ) Array ( [0] => KA [1] => LA [2] => CA [3] => MA [4] => TA [5] => IA [6] => GA ) Array ( [1] => LA [3] => MA ) Array ( [0] => KA [2] => CA [4] => TA ) TRUE ANSWER : ? YOUR ANSWER : ?
What array will you get if you convert an object to an array? An array with properties of that object as the array's elements An array with keys of that object as the array's elements An array with properties of that object as the Key elements An array with properties of that array as the object's elements TRUE ANSWER : ? YOUR ANSWER : ?
What will be the output of the following PHP code?<br/>$fruits = array ("mango", "apple", "pear", "peach");<br/>$fruits = array_flip($fruits);<br/>echo ($fruits[0]); error peach mango 0 TRUE ANSWER : ? YOUR ANSWER : ?
What will be the output of the following php code?<br/>$states = array("karnataka" => array( "population" => "11,35,000", "captial" => "Bangalore"),"Tamil Nadu" => array( "population" => "17,90,000","captial" => "Chennai") );<br/>echo $states["karnataka"]["population"]; population 11,35,000 karnataka 11,35,000 11,35,000 karnataka population TRUE ANSWER : ? YOUR ANSWER : ?
What will be the output of the following PHP code?<br/>$a1 = array("a"=>"red", "b"=>"green", "c"=>"blue", "d"=>"yellow");<br/>$a2 = array("e"=>"red", "f"=>"green", "g"=>"blue");<br/>$result = array_diff($a1, $a2);<br/>print_r($result); Array ( [c] => blue ) Array ( [d] => yellow ) Array ( [e] => yellow ) Array ( [a] => red ) TRUE ANSWER : ? YOUR ANSWER : ?
Absent any actual need for choosing one method over the other, does passing arrays by value to a read-only function reduce performance compared to passing them by reference? Yes, but only if the array is large. No Yes, but only if the function modifies the contents of the array. Yes, because PHP must monitor the execution of the function to determine if changes are made to the array. Yes, because the interpreter must always create a copy of the array before passing it to the function. TRUE ANSWER : ? YOUR ANSWER : ?
Which array function checks if the specified key exists in the array? array_key_exists() array_keys_exists() array_key_exist() arrays_key_exists() TRUE ANSWER : ? YOUR ANSWER : ?
What will be the output of the following PHP code?<br/>$cars = array("Volvo", "BMW", "Toyota", "Honda", "Mercedes", "Opel");<br/>print_r(array_chunk($cars, 2)); Array ( [0] => Array ( [1] => Volvo [2] => BMW ) [1] => Array ( [1] => Toyota [2] => Honda ) [2] => Array ( [1] => Mercedes [2] => Opel ) ) Array ( [1] => Array ( [1] => Volvo [2] => BMW ) [2] => Array ( [1] => Toyota [2] => Honda ) [3] => Array ( [1] => Mercedes [2] => Opel ) ) Array ( [0] => Array ( [0] => Volvo [1] => Volvo ) [1] => Array ( [0] => BMW [1] => BMW ) [2] => Array ( [0] => Toyota [1] => Toyota ) ) Array ( [0] => Array ( [0] => Volvo [1] => BMW ) [1] => Array ( [0] => Toyota [1] => Honda ) [2] => Array ( [0] => Mercedes [1] => Opel ) ) TRUE ANSWER : ? YOUR ANSWER : ?