PHP Chapter 6

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

True

17. If you use the array_merge() function with indexed arrays, all elements in one array are appended to another array and renumbered. True or False?

d. array_intersect()

18. Which of the following returns an array of elements that exist in all of the arrays that are compared? a. usort() b. array_common() c. array_diff() d. array_intersect()

associative

PHP includes two types of arrays: indexed and _______.

a. array_shift()

1. Which of the following functions removes the first element from the beginning of an array? a. array_shift() b. array_unshift() c. array_push() d. array_pop()

d. reset()

10. Which of the following functions moves an array's internal pointer to the first element? a. first() b. top() c. start() d. reset()

a. current()

11. Which of the following functions returns the value of an element where an array's internal pointer is positioned? a. current() b. key() c. array() d. array_values()

d. array_key_exists("Ford", $AutoMakers);

13. Which of the following locates a key named "Ford" in an array named $AutoMakers[]? a. array_key_exists($AutoMakers => "Ford"); b. $AutoMakers = array_key_exists("Ford"); c. array_key_exists($AutoMakers, "Ford"); d. array_key_exists("Ford", $AutoMakers);

b. + c. +=

16. Which of the following operators can you use to append one array to another? (Choose all that apply.) a. . b. + c. += d. =>

b. $InterestRates[1][2]

19. Suppose you are working with an indexed two-dimensional array named $InterestRates[][], where each dimension begins with an index of 0. Which of the following refers to the second element in the first dimension and the third element in the second dimension? a. $InterestRates[1],[2] b. $InterestRates[1][2] c. $InterestRates[1, 2] d. $InterestRates[1].[2]

c. <input type="text" name='item[quantity]' />

20. Which is the correct Web form syntax for creating the autoglobal element $_POST['item']['quantity']? a. <input type="text" name="item['quantity']" /> b. <input type="text" name='item["quantity"]' /> c. <input type="text" name='item[quantity]' /> d. <input type="text" name="item["quantity"]" />

d. array_pop()

3. Which of the following functions removes the last element from the end of an array? (Choose all that apply.) a. array_shift() b. array_unshift() c. array_push() d. array_pop()

False

5. After removing elements from an array, the unset() function automatically renumbers the remaining elements. True or False?

c. rsort() d. krsort()

5. Which of the following functions performs a reverse sort on an array? (Choose all that apply.) a. asort() b. usort() c. rsort() d. krsort()

d. $AutoMakers = array("Ford" => "Mustang", "Chevrolet" => "Corvette");

7. What is the correct syntax for declaring and initializing an associative array? a. $AutoMakers = array("Ford" . "Mustang", "Chevrolet" . "Corvette"); b. $AutoMakers = array("Ford" = "Mustang", "Chevrolet" = "Corvette"); c. $AutoMakers = array("Ford" > "Mustang", "Chevrolet" > "Corvette"); d. $AutoMakers = array("Ford" => "Mustang", "Chevrolet" => "Corvette");

False

9. If you declare an array in PHP and use a starting index other than 0, empty elements are created for each index between 0 and the index value you specify. True or False?

array_values()

The return value of the _______ function is the renumbered array.

array_unique()

You can use the function _______ to remove duplicate elements from an array.

alphanumeric

You refer to the elements in an associative array with an _______ key.

numeric

You refer to the elements in an indexed array by their _______ position


Ensembles d'études connexes

Chapter 11: Motivation & Emotion

View Set

Group 7_Chapter 9: Void or Inexistent Contracts

View Set

AP Euro Isms and 19th century revolution key terms

View Set

Cardiac PassPoint: Extra Alternate-Format

View Set

Chapter 23: Integumentary Problems

View Set

Hazards, behavior, and identification of Haz Mat/WMD

View Set