Read Also: Top 20 MCQ Questions on Arrays in PHP
1. The … function will pass each element of an array to the user-defined function.
A) array_walk()
B) walk()
C) array_walk_recursive()
D) array_work()
2. … function is useful when you need to perform a particular action based on each array element.
A) array_walk()
B) walk()
C) array_walk_recursive()
D) array_work()
3. … function is capable to recursively apply a user-defined function to every element in an array.
A) array_walk()
B) walk()
C) array_walk_recursive()
D) array_work()
4. … function works functionally the same as count().
A) size()
B) sizeof()
C) countof()
D) countall()
5. The … function returns an array consisting of associative key/value pairs.
A) array_count()
B) array_count_keys()
C) count()
D) array_count_values()
6. The … function removes all duplicate values found in an array, returning an array consisting of solely unique values.
A) array_duplicate()
B) array_unique()
C) array_remove_duplicate()
D) array_unique_values()
7. The … function reverses the roles of the keys and their corresponding values in an array.
A) array_reverse()
B) array_flip()
C) array_flip_roles()
D) array_reverse_roles()
8. The … function returns a section of an array based on a starting and ending offset value.
A) array_slice()
B) array_flip()
C) array_splice()
D) array_reverse()
9. The … function produces a new array consisting of a submitted set of keys and corresponding values.
A) array_merge()
B) array_combine()
C) array_merge_recursive()
D) array_merge_all()
10. … will simply overwrite the preexisting key/value pair, replacing it with the one found in the current input array.
A) array_merge()
B) array_combine()
C) array_merge_recursive()
D) array_merge_all()
11. … will merge the values together, forming a new array with the preexisting key as its name.
A) array_merge()
B) array_combine()
C) array_merge_recursive()
D) array_merge_all()
12. The … function removes all elements of an array found within a specified range, returning those removed elements in the form of an array.
A) array_slice()
B) array_remove()
C) array_remove_all()
D) array_splice()
13. The … function returns a key-preserved array consisting only of those values present in the first array that are also present in each of the other input arrays.
A) array_common()
B) array_intersect()
C) array_intersect_key()
D) array_intersect_ukey()
14. The … function will return keys located in an array that is located in any of the other provided arrays.
A) array_common()
B) array_intersect()
C) array_intersect_key()
D) array_intersect_ukey()
15. The … function allows you to compare the keys of multiple arrays with the comparison algorithm determined by a user-defined function.
A) array_common()
B) array_intersect()
C) array_intersect_key()
D) array_intersect_ukey()
16. The function … returns those values located in the first array that are not located in any of the subsequent arrays.
A) diff()
B) array_diff()
C) array_diff_key()
D) array_diff_ukey()
17. The function … allows you to compare the keys of multiple arrays with the comparison algorithm determined by a user-defined function.
A) diff()
B) array_diff()
C) array_diff_key()
D) array_diff_ukey()
18. The function … will return a random number of keys found in an array.
A) rand()
B) array_random()
C) array_rand()
D) array_rand_key()
19. The … function adds all the values of input_array together, returning the final sum.
A) array_sum()
B) array_final_sum()
C) array_add()
D) array_sum_values()
20. The … function breaks the input array into a multidimensional array that includes several smaller arrays consisting of size elements.
A) array_size()
B) array_fragments()
C) array_chunk()
D) chunk()
Answers
- A) array_walk()
- A) array_walk()
- C) array_walk_recursive()
- B) sizeof()
- D) array_count_values()
- B) array_unique()
- B) array_flip()
- A) array_slice()
- B) array_combine()
- A) array_merge()
- C) array_merge_recursive()
- D) array_splice()
- B) array_intersect()
- C) array_intersect_key()
- D) array_intersect_ukey()
- B) array_diff()
- D) array_diff_ukey()
- C) array_rand()
- A) array_sum()
- C) array_chunk()
Read Next: Top 20 MCQ Questions on Classes and Objects in PHP