Deck 6: Manipulating Arrays

Full screen (f)
exit full mode
Question
PHP creates indexed arrays by default with a starting element of 0.
Use Space or
up arrow
down arrow
to flip the card.
Question
The internal array pointer is a way of keeping track of which element you are working with in an array.
Question
The array_name argument in the array_splice() function indicates the name of the array you want to eliminate.
Question
The in_array() function returns a Boolean value of TRUE if a value exists in an array.
Question
The array_unique() function removes elements that are unique to an array.
Question
If you use an iteration function to move the internal array pointer either before the first element or after the last element in an array, the only way to move the array pointer back to a valid element is to use the unset() function.
Question
The array_unique() function does not renumber the indexes after removing duplicate values in an array.
Question
You can use the unset() function to remove array elements and other variables.
Question
One problem with the unset() function is that is does not renumber the remaining elements in the array.
Question
The array_shift() function adds one or more elements to the beginning of an array.
Question
If you create an associative array and then add a new element without specifying a key, PHP will not assume that the array is indexed.
Question
To remove an indexed array's elements, you need to run the array_values() function.
Question
The array_values() function operates directly on an array.
Question
The array_splice() function adds or removes array elements located anywhere in an array.
Question
The array_push() function adds one or more elements to the end of an array.
Question
Aside from its main function, the array_splice() function also renumbers the indexes in the array.
Question
You use the array_unshift() function to remove the first element from the beginning of an array.
Question
The internal array pointer is a special type of variable that refers to the currently selected element in an array.
Question
The last element is removed from the end of an array using the array_pop() function.
Question
With associative arrays, you can use any alphanumeric keys that you want for the array elements.
Question
Use the array_slice() function to return or copy a portion of an array and assign it to another array.
Question
You refer to the values in a multidimensional indexed array by including two sets of brackets, one which refers to the row and one which refers to the column.
Question
The ____ function lets you add or remove elements anywhere else in the array.

A) array_add()
B) array_split()
C) array_splice()
D) array_values()
Question
The array_unshift() function adds ____ element(s) to the beginning of the array.

A) one or more
B) two or more
C) no new
D) only one
Question
The array_push() function ____ one or more elements to the end of the array.

A) adds
B) deletes
C) moves
D) pushes
Question
The most commonly used array sorting functions are sort() and rsort() for associative arrays.
Question
The array_search() function determines whether a given value exists in an array and returns the negative value of the first matching element is it exists or false if it does not exist.
Question
The ____ function removes duplicate elements from an array.

A) array_dup()
B) array_values()
C) array_unique()
D) array()
Question
To renumber an indexed array's elements, you need to run the ____ function.

A) unset()
B) array_values()
C) array()
D) array_num()
Question
The array_diff() function returns an array of elements that exist in one array but not in any other arrays to which it is compared.
Question
To have PHP store form data in an array, you modify the name attribute of the input element to use array notation.
Question
Instead of appending one array to another you can merge two or more arrays with the array_merge() function.
Question
To remove multiple elements using the unset() function, separate each ____ name with commas.

A) variable
B) array
C) element
D) argument
Question
PHP stores form data in an indexed array but cannot store form data in an associative array.
Question
The ____ argument of the array_splice() function indicates the name of the array you want to modify.

A) array_name
B) array_value
C) array_function
D) array_mod
Question
Use the array_keys() function to return an indexed array containing all the keys in an associative array.
Question
The array_key_exists() function determines whether a given index or key exists.
Question
The ____ is a special type of variable that refers to the currently selected element in an array.

A) external array pointer
B) external element pointer
C) internal array pointer
D) internal element pointer
Question
The array_shift() function removes the ____ element from the beginning of an array.

A) last
B) first
C) second
D) middle
Question
The array_pop() function ____ from the end of the array.

A) moves an element
B) copies the last element
C) deletes the first element
D) removes the last element
Question
The most common type of multidimensional array is a(n) ____ array.

A) multidimensional
B) two-dimensional
C) associative
D) indexed
Question
The array_pop() function removes the ____________________ elements from the end of the array.
Question
A multidimensional array in PHP is essentially ____.

A) a two-dimensional array
B) nonexistent
C) an array of arrays
D) an associative array
Question
The symbol ____ appends one array to another.

A) *
B) ==
C) +
D) &&
Question
You pass to the array_shift() function the name of the array whose first element you want to ____________________ .
Question
To sort an associative array by key, use the ____ function.

A) natsort()
B) ksort()
C) rsort()
D) asort()
Question
To perform a reverse sort on an associative array by key and maintain the existing keys, use the _____ function.

A) ksort()
B) krsort()
C) uk_sort()
D) sort()
Question
After adding or removing array elements, the ____________________ function also renumbers the indexes for an array.
Question
You can create ____ that consist of multiple indexes or keys.

A) indexed arrays
B) two-dimensional arrays
C) multidimensional arrays
D) key arrays
Question
If there are no indexes or keys entered in the value of the name attribute in a form, PHP assigns an index of ____ to the first element.

A) 0
B) 1
C) 2
D) PHP assigns no value
Question
____________________ function removes the first element from the beginning of an array.
Question
The ____ function returns a Boolean value of true if a given value exists in the array.

A) array_search()
B) array_boole()
C) array()
D) in_array()
Question
You use the ____ function to return a portion of an array and assign it to another array.

A) array_slice()
B) array_set()
C) array_assign()
D) array_key()
Question
The ____ function determines whether a given index or key exists.

A) array_values()
B) array_key_exists()
C) array_key()
D) array_set()
Question
The ____ function returns an array of elements that exist in one array but not in any other arrays to which it is compared.

A) array_compare()
B) array_diff()
C) array_search()
D) array_match()
Question
Merge two or more arrays with the ____ function.

A) array_merge()
B) array_plus()
C) array_paste()
D) array_values()
Question
The ____________________ function adds one or more elements to the end of an array.
Question
Multidimensional arrays are not limited to ____.

A) two dimensions
B) associative arrays
C) indexed elements
D) recursive arrays
Question
The data values for input elements that use array notation for the value of the name attribute are stored in a ____ array within the $_POST autoglobal array.

A) sub
B) nested
C) indexed
D) key
Question
The ____ function determines whether a given value exists in an array.

A) array_search()
B) in_array()
C) find_array()
D) array_values()
Question
To remove multiple elements using the unset() function, you must separate each element name with a ____________________ .
Question
You would use the ____________________ function t return an array of the elements that are common to all arrays that are compared.
Question
As with the array_values() function the ____________________ function does not operate directly on an array.
Question
The ____________________ function does not operate directly on an array; but, returns a new array with the renumbered indexes.
Question
The____________________ function returns a Boolean value of TRUE if a given value exists in an array.
Question
The ____________________ is a special type of variable that refers to the currently selected element in an array.
Question
You use the ____________________ function to create a new associative array that uses the values from one array as keys and the values from another array as element values.
Question
You pass the unset() function the array name and the ____________________ of the element you want to remove.
Question
The ____________________ function moves the internal array pointer to the last element in an array.
Question
Instead of appending one array to another, you can merge two or more arrays with the ____________________ function.
Question
The start_index argument of the array_slice() function indicates the ____________________ position within the array to begin extracting elements.
Question
The ____________________ function determines whether a given value exists in an array and returns the index or key of the first matching element if it exists or FALSE if it does not.
Question
Run the ____________________ function to renumber an indexed array's element.
Question
To assign the first element of an associative array with a number other than zero (0), use the array operator ____________________ .
Question
The array_unique() function removes ____________________ elements from an array.
Question
The array_key_exists() function determines whether a given____________________ or key exists.
Question
To refer to an element in an associative array, you place an element's ____________________ in single or double quotation marks inside the array brackets.
Question
The ____________________ function removes array elements and other variables.
Question
To randomize the order of array elements, you can use the ____________________ function.
Question
The most commonly used array sorting functions are ____________________ and rsort() for indexed arrays.
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/83
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 6: Manipulating Arrays
1
PHP creates indexed arrays by default with a starting element of 0.
False
2
The internal array pointer is a way of keeping track of which element you are working with in an array.
True
3
The array_name argument in the array_splice() function indicates the name of the array you want to eliminate.
False
4
The in_array() function returns a Boolean value of TRUE if a value exists in an array.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
5
The array_unique() function removes elements that are unique to an array.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
6
If you use an iteration function to move the internal array pointer either before the first element or after the last element in an array, the only way to move the array pointer back to a valid element is to use the unset() function.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
7
The array_unique() function does not renumber the indexes after removing duplicate values in an array.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
8
You can use the unset() function to remove array elements and other variables.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
9
One problem with the unset() function is that is does not renumber the remaining elements in the array.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
10
The array_shift() function adds one or more elements to the beginning of an array.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
11
If you create an associative array and then add a new element without specifying a key, PHP will not assume that the array is indexed.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
12
To remove an indexed array's elements, you need to run the array_values() function.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
13
The array_values() function operates directly on an array.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
14
The array_splice() function adds or removes array elements located anywhere in an array.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
15
The array_push() function adds one or more elements to the end of an array.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
16
Aside from its main function, the array_splice() function also renumbers the indexes in the array.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
17
You use the array_unshift() function to remove the first element from the beginning of an array.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
18
The internal array pointer is a special type of variable that refers to the currently selected element in an array.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
19
The last element is removed from the end of an array using the array_pop() function.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
20
With associative arrays, you can use any alphanumeric keys that you want for the array elements.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
21
Use the array_slice() function to return or copy a portion of an array and assign it to another array.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
22
You refer to the values in a multidimensional indexed array by including two sets of brackets, one which refers to the row and one which refers to the column.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
23
The ____ function lets you add or remove elements anywhere else in the array.

A) array_add()
B) array_split()
C) array_splice()
D) array_values()
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
24
The array_unshift() function adds ____ element(s) to the beginning of the array.

A) one or more
B) two or more
C) no new
D) only one
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
25
The array_push() function ____ one or more elements to the end of the array.

A) adds
B) deletes
C) moves
D) pushes
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
26
The most commonly used array sorting functions are sort() and rsort() for associative arrays.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
27
The array_search() function determines whether a given value exists in an array and returns the negative value of the first matching element is it exists or false if it does not exist.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
28
The ____ function removes duplicate elements from an array.

A) array_dup()
B) array_values()
C) array_unique()
D) array()
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
29
To renumber an indexed array's elements, you need to run the ____ function.

A) unset()
B) array_values()
C) array()
D) array_num()
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
30
The array_diff() function returns an array of elements that exist in one array but not in any other arrays to which it is compared.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
31
To have PHP store form data in an array, you modify the name attribute of the input element to use array notation.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
32
Instead of appending one array to another you can merge two or more arrays with the array_merge() function.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
33
To remove multiple elements using the unset() function, separate each ____ name with commas.

A) variable
B) array
C) element
D) argument
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
34
PHP stores form data in an indexed array but cannot store form data in an associative array.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
35
The ____ argument of the array_splice() function indicates the name of the array you want to modify.

A) array_name
B) array_value
C) array_function
D) array_mod
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
36
Use the array_keys() function to return an indexed array containing all the keys in an associative array.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
37
The array_key_exists() function determines whether a given index or key exists.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
38
The ____ is a special type of variable that refers to the currently selected element in an array.

A) external array pointer
B) external element pointer
C) internal array pointer
D) internal element pointer
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
39
The array_shift() function removes the ____ element from the beginning of an array.

A) last
B) first
C) second
D) middle
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
40
The array_pop() function ____ from the end of the array.

A) moves an element
B) copies the last element
C) deletes the first element
D) removes the last element
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
41
The most common type of multidimensional array is a(n) ____ array.

A) multidimensional
B) two-dimensional
C) associative
D) indexed
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
42
The array_pop() function removes the ____________________ elements from the end of the array.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
43
A multidimensional array in PHP is essentially ____.

A) a two-dimensional array
B) nonexistent
C) an array of arrays
D) an associative array
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
44
The symbol ____ appends one array to another.

A) *
B) ==
C) +
D) &&
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
45
You pass to the array_shift() function the name of the array whose first element you want to ____________________ .
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
46
To sort an associative array by key, use the ____ function.

A) natsort()
B) ksort()
C) rsort()
D) asort()
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
47
To perform a reverse sort on an associative array by key and maintain the existing keys, use the _____ function.

A) ksort()
B) krsort()
C) uk_sort()
D) sort()
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
48
After adding or removing array elements, the ____________________ function also renumbers the indexes for an array.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
49
You can create ____ that consist of multiple indexes or keys.

A) indexed arrays
B) two-dimensional arrays
C) multidimensional arrays
D) key arrays
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
50
If there are no indexes or keys entered in the value of the name attribute in a form, PHP assigns an index of ____ to the first element.

A) 0
B) 1
C) 2
D) PHP assigns no value
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
51
____________________ function removes the first element from the beginning of an array.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
52
The ____ function returns a Boolean value of true if a given value exists in the array.

A) array_search()
B) array_boole()
C) array()
D) in_array()
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
53
You use the ____ function to return a portion of an array and assign it to another array.

A) array_slice()
B) array_set()
C) array_assign()
D) array_key()
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
54
The ____ function determines whether a given index or key exists.

A) array_values()
B) array_key_exists()
C) array_key()
D) array_set()
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
55
The ____ function returns an array of elements that exist in one array but not in any other arrays to which it is compared.

A) array_compare()
B) array_diff()
C) array_search()
D) array_match()
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
56
Merge two or more arrays with the ____ function.

A) array_merge()
B) array_plus()
C) array_paste()
D) array_values()
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
57
The ____________________ function adds one or more elements to the end of an array.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
58
Multidimensional arrays are not limited to ____.

A) two dimensions
B) associative arrays
C) indexed elements
D) recursive arrays
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
59
The data values for input elements that use array notation for the value of the name attribute are stored in a ____ array within the $_POST autoglobal array.

A) sub
B) nested
C) indexed
D) key
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
60
The ____ function determines whether a given value exists in an array.

A) array_search()
B) in_array()
C) find_array()
D) array_values()
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
61
To remove multiple elements using the unset() function, you must separate each element name with a ____________________ .
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
62
You would use the ____________________ function t return an array of the elements that are common to all arrays that are compared.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
63
As with the array_values() function the ____________________ function does not operate directly on an array.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
64
The ____________________ function does not operate directly on an array; but, returns a new array with the renumbered indexes.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
65
The____________________ function returns a Boolean value of TRUE if a given value exists in an array.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
66
The ____________________ is a special type of variable that refers to the currently selected element in an array.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
67
You use the ____________________ function to create a new associative array that uses the values from one array as keys and the values from another array as element values.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
68
You pass the unset() function the array name and the ____________________ of the element you want to remove.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
69
The ____________________ function moves the internal array pointer to the last element in an array.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
70
Instead of appending one array to another, you can merge two or more arrays with the ____________________ function.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
71
The start_index argument of the array_slice() function indicates the ____________________ position within the array to begin extracting elements.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
72
The ____________________ function determines whether a given value exists in an array and returns the index or key of the first matching element if it exists or FALSE if it does not.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
73
Run the ____________________ function to renumber an indexed array's element.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
74
To assign the first element of an associative array with a number other than zero (0), use the array operator ____________________ .
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
75
The array_unique() function removes ____________________ elements from an array.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
76
The array_key_exists() function determines whether a given____________________ or key exists.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
77
To refer to an element in an associative array, you place an element's ____________________ in single or double quotation marks inside the array brackets.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
78
The ____________________ function removes array elements and other variables.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
79
To randomize the order of array elements, you can use the ____________________ function.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
80
The most commonly used array sorting functions are ____________________ and rsort() for indexed arrays.
Unlock Deck
Unlock for access to all 83 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 83 flashcards in this deck.