php programming language MCQ : Arrays-Converting between arrays and variables Link4

php programming language MCQ : Arrays-Converting between arrays and variables Link4

Arrays MCQ

       Are you worried about the answers to PHP programming-Arrays-Identifying elements of an array, Storing data in arrays, Multidimensional arrays, Extracting multiple values, Converting between arrays and variables, Traversing arrays, Sorting questions? We have arranged the Show Answer button under the each question. Candidates can click on it to know the right option among the given alternatives. Furthermore, the applicants can check our web portal @ www.totalmcq.com to take part in more MCQ on various subject. Wish, the given information about the Arrays MCQ will helpful to the advance and can learn the various types of questions and answers.


Q.1. For getting rid of an assigned variable in an array which function is used?

A. delete_array ( )                                                              B. reset_array
C. reset ( )                                                       D. unset ( )

Q.2. Foreach ( ), current ( ), next ( ), reset ( ), each ( ) and array_walk ( ) all these functions are example of---------

A. Searching arrays                                                              B. Creating arrays
C. Iteration of arrays                                                       D. Deleting of arrays

Q.3. A function that takes two integers as arguments and returns an array filled with all integers between them, is known as-------.

A. Range ( ) function B. Value ( ) function
C. Limit ( ) function
D. None of the above

Q.4. Next ( ) function returns value after the -----.

A. pointer is reversed
B. pointer is moved
C. array is empty
D. None of the above

Q.5. $multi_array [1] [2] [3] [4] = "I am working on PHP"; will create ------.

A. One dimensional array
B. 5 dimensional array
C. 4 dimensional array
D. None of the above

Q.6. In vector arrays, the elements must have -----------.

A. Same size
B. Same type
C. Different size
D. Different type

Q.7. Other than index values an array can be retrieved by a function that is called as -------.

A. Retrieve ( ) function
B. Array_retrive ( ) function
C. list ( ) function
D. Array_call ( ) function

Q.8. Three ways to create an array is Direct assignment, array ( ) construct and ---------.

A. Functions returning arrays
B. Functions creating arrays
C. Keys creating arrays
D. None of the above

Q.9. What will be the output of the following PHP code?

 <?php \\
\$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)); \\
?>

A. Array ( [A] => 5 [Cat] => 2 [Dog] => 2 [Tiger] => 1 )
B. Array ( [A] => 2 [Cat] => 2 [Dog] => 1 [Tiger] => 1 )
C. Array ( [A] => 6 [Cat] => 1 [Dog] => 2 [Tiger] => 1 )
D. Array ( [A] => 2 [Cat] => 1 [Dog] => 4 [Tiger] => 1 )

Q.10. What will be the output of the following PHP code?

 <?php \\
\$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); \\
?>

A. Array ( [i] => orange )                                                                  B. Array ( [d] => yellow )
C. Array ( [h] => orange )                                                    D. Array ( [d] => yellow [h] => orange )