0% found this document useful (0 votes)
22 views5 pages

MCQ

mcq question
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views5 pages

MCQ

mcq question
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

1. State whether the following statements about arrays in PHP are True or False.

i. PHP doesn’t require to assign a size to an array at creation time.


ii. PHP require to declare the array before using it.
iii. Each element on the PHP array are referenced by denoting the element
between a pair of square brackets.
A) i-False, ii-True, iii-True
B) i-False, ii-True, iii-False
C) i-True, ii-True, iii-True
D) i-True, ii-False, iii-True
2. The … function determines whether the variable is an array, returning TRUE if it is
and FALSE otherwise.
A) array()
B) is_array()
C) check_array()
D) array_check()
3. … function allows us to easily display array contents using the same formatting
syntax used by the printf().
i. vprint()
ii.vprintf()
iii. sprintf()
A) i and ii only
B) ii and iii only
C) i and iii only
D) All i, ii and iii
4. The … function accepts a variable and sends its contents to standard output,
returning TRUE on success and FALSE otherwise.
A) print_r
B) print_v
C) print_s
D) print_o
5. The … function adds elements to the front of the array.
A) array_push()
B) array_shift()
C) array_unshift()
D) array_front()
6. The … function adds a value to the end of an array.
A) array_push()
B) array_shift()
C) array_unshift()
D) array_end()
7. The … function removes and returns the first item found in an array.
A) array_push()
B) array_shift()
C) array_unshift()
D) array_first()
8. The … function removes and returns the last element from an array.
A) array_push()
B) array_shift()
C) array_pop()
D) array_last()
9. The … function searches an array for a specific value, returning TRUE if the value
is found and FALSE otherwise.
A) in_array_value()
B) in_array()
C) array_search()
D) array_value()
10. The … function returns TRUE if the specified key is found in an array and
FALSE otherwise.
A) array_values()
B) array_keys()
C) array_search()
D) array_key_exists()

11. The output of the program mentioned below would be:

<?php

$a = array(16, 5, 2);

echo array_product($a);

?>

a. 32

b. 80

c. 1652

d. 160
12. The … function returns an array consisting of all keys located in an array.
A) keys_array()
B) array_keys()
C) array_search()
D) array_key_exists()
13. The … function returns all values located in an array, automatically providing
numeric indexes for the returned array.
A) numeric_array()
B) array_indexes()
C) array_search()
D) array_values()
14. The … function returns the key located at the current pointer position of the
provided array.
A) key()
B) current_key()
C) array_search()
D) current_key_exists()
15. The … function returns the array value residing at the current pointer position of
the array.
A) current()
B) current_key()
C) each_key()
D) current_key_exists()

16. In PHP, the variable name starts with:

a. # (Hash)

b. & (Ampersand)

c. $ (Dollar)

d. ! (Exclamation)

17. The … function returns the array value residing at the position immediately
following that of the current array pointer.
A) current()
B) current_array()
C) next_array()
D) next()
18. The … function returns the array value residing at the location preceding the
current pointer location, or FALE if the pointer resides at the first position in the
array.
A) reset()
B) preceding_array()
C) prev_array()
D) prev()
19. … is used when you need to review or manipulate an array multiple times within
a script.
A) review()
B) reset_array()
C) reset()
D) manipulate()
20. The function moves the pointer to the last position of an array.
A) end_array()
B) last_array()
C) end()
D) last()
1. D) i-True, ii-False, iii-True
2. B) is_array()
3. C) i and iii only
4. A) print_r
5. C) array_unshift()
6. A) array_push()
7. B) array_shift()
8. C) array_pop()
9. B) in_array()
10. D) array_key_exists()
11. D) 160
12. B) array_keys()
13. D) array_values()
14. A) key()
15. A) current()
16. C) $(dollar)
17. D) next()
18. D) prev()
19. C) reset()
20. C) end()

You might also like