PHP_Chapter06_ReviewQuestions

True/False
Indicate whether the statement is true or false.

____	1.	The array_shift() function adds one or more elements to the beginning of an array.

____	2.	You use the array_unshift() function to remove the first element from the beginning of an array.

____	3.	The last element is removed from the end of an array using the array_pop() function.

____	4.	The array_push() function adds one or more elements to the end of an array.

____	5.	The array_splice() function adds or removes array elements located anywhere in an array.

____	6.	The array_name argument in the array_splice() function indicates the name of the array you want to eliminate.

____	7.	Aside from its main function, the array_splice() function also renumbers the indexes in the array.

____	8.	You can use the unset() function to remove array elements and other variables.

____	9.	One problem with the unset() function is that is does not renumber the remaining elements in the array.

____	10.	To remove an indexed array’s elements, you need to run the array_values() function.

____	11.	The array_unique() function removes elements that are unique to an array.

____	12.	The array_values() function operates directly on an array.

____	13.	The array_unique() function does not renumber the indexes after removing duplicate values in an array.

____	14.	PHP creates indexed arrays by default with a starting element of 0.

____	15.	With associative arrays, you can use any alphanumeric keys that you want for the array elements.

____	16.	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.

____	17.	The internal array pointer is a special type of variable that refers to the currently selected element in an array.

____	18.	The internal array pointer is a way of keeping track of which element you are working with in an array.

____	19.	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.

____	20.	The in_array() function returns a Boolean value of TRUE if a value exists in an array.

____	21.	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.

____	22.	The array_key_exists() function determines whether a given index or key exists.

____	23.	Use the array_keys() function to return an indexed array containing all the keys in an associative array.

____	24.	Use the array_slice() function to return or copy a portion of an array and assign it to another array.

____	25.	The most commonly used array sorting functions are sort() and rsort() for associative arrays.

____	26.	Instead of appending one array to another you can merge two or more arrays with the array_merge() function.

____	27.	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.

____	28.	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.

____	29.	To have PHP store form data in an array, you modify the name attribute of the input element to use array notation.

____	30.	PHP stores form data in an indexed array but cannot store form data in an associative array.

Multiple Choice
Identify the choice that best completes the statement or answers the question.

____	31.	The array_shift() function removes the ____ element from the beginning of an array.
a.	last	c.	second	
b.	first	d.	middle	

____	32.	The array_unshift() function adds ____ element(s) to the beginning of the array.
a.	one or more	c.	no new	
b.	two or more	d.	only one	

____	33.	The array_pop() function ____ from the end of the array.
a.	moves an element	c.	deletes the first element	
b.	copies the last element	d.	removes the last element	

____	34.	The array_push() function ____ one or more elements to the end of the array.
a.	adds	c.	moves	
b.	deletes	d.	pushes	

____	35.	The ____ function lets you add or remove elements anywhere else in the array.
a.	array_add()	c.	array_splice()	
b.	array_split()	d.	array_values()	

____	36.	The ____ argument of the array_splice() function indicates the name of the array you want to modify.
a.	array_name	c.	array_function	
b.	array_value	d.	array_mod	

____	37.	To remove multiple elements using the unset() function,  separate each ____ name with commas.
a.	variable	c.	element	
b.	array	d.	argument	

____	38.	To renumber an indexed array’s elements, you need to run the ____ function.
a.	unset()	c.	array()	
b.	array_values()	d.	array_num()	

____	39.	The ____ function removes duplicate elements from an array.
a.	array_dup()	c.	array_unique()	
b.	array_values()	d.	array()	

____	40.	The ____ is a special type of variable that refers to the currently selected element in an array.
a.	external array pointer	c.	internal array pointer	
b.	external element pointer	d.	internal element pointer	

____	41.	The ____ function returns a Boolean value of true if a given value exists in the array.
a.	array_search()	c.	array()	
b.	array_boole()	d.	in_array()	

____	42.	The ____ function determines whether a given value exists in an array.

a.	array_search()	c.	find_array()	
b.	in_array()	d.	array_values()	

____	43.	The ____ function determines whether a given index or key exists.
a.	array_values()	c.	array_key()	
b.	array_key_exists()	d.	array_set()	

____	44.	You use the ____ function to return a portion of an array and assign it to another array.
a.	array_slice()	c.	array_assign()	
b.	array_set()	d.	array_key()	

____	45.	To sort an associative array by key, use the ____ function.
a.	natsort()	c.	rsort()	
b.	ksort()	d.	asort()	

____	46.	To perform a reverse sort on an associative array by key and maintain the existing keys, use the _____ function.
a.	ksort()	c.	uk_sort()	
b.	krsort()	d.	sort()	

____	47.	The symbol ____ appends one array to another.
a.	*	c.	+	
b.	==	d.	&&	

____	48.	Merge two or more arrays with the ____ function.

a.	array_merge()	c.	array_paste()	
b.	array_plus()	d.	array_values()	

____	49.	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()	c.	array_search()	
b.	array_diff()	d.	array_match()	

____	50.	You can create ____ that consist of multiple indexes or keys.
a.	indexed arrays	c.	multidimensional arrays	
b.	two-dimensional arrays	d.	key arrays	

____	51.	The most common type of multidimensional array is a(n) ____ array.
a.	multidimensional	c.	associative	
b.	two-dimensional	d.	indexed	

____	52.	A multidimensional array in PHP is essentially ____.
a.	a two-dimensional array	c.	an array of arrays	
b.	nonexistent	d.	an associative array	

____	53.	Multidimensional arrays are not limited to ____. 
a.	two dimensions	c.	indexed elements 	
b.	associative arrays	d.	recursive arrays	

____	54.	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	c.	indexed	
b.	nested	d.	key	

____	55.	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	c.	2	
b.	1	d.	PHP assigns no value	

PHP_Chapter06_ReviewQuestions
Answer Section

TRUE/FALSE

	1.	REF:	304

	2.	REF:	304

	3.	REF:	309

	4.	REF:	309

	5.	REF:	310

	6.	REF:	310

	7.	REF:	310

	8.	REF:	313

	9.	REF:	313

	10.	REF:	313

	11.	REF:	314

	12.	REF:	314

	13.	REF:	314

	14.	REF:	316

	15.	REF:	317

	16.	REF:	318

	17.	REF:	323

	18.	REF:	323

	19.	REF:	325

	20.	REF:	328

	21.	REF:	328

	22.	REF:	333

	23.	REF:	334

	24.	REF:	334

	25.	REF:	337

	26.	REF:	346

	27.	REF:	348

	28.	REF:	352

	29.	REF:	359

	30.	REF:	361

MULTIPLE CHOICE

	31.	REF:	304

	32.	REF:	304

	33.	REF:	309

	34.	REF:	309

	35.	REF:	310

	36.	REF:	310

	37.	REF:	313

	38.	REF:	313

	39.	REF:	314

	40.	REF:	323

	41.	REF:	328

	42.	REF:	328

	43.	REF:	333

	44.	REF:	334

	45.	REF:	342

	46.	REF:	342

	47.	REF:	343

	48.	REF:	346

	49.	REF:	348

	50.	REF:	350

	51.	REF:	351

	52.	REF:	351

	53.	REF:	357

	54.	REF:	360

	55.	REF:	360