Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

QUESTION 16 \"if you use the array_diff() function to compare arr1 to arr2, the

ID: 3586980 • Letter: Q

Question

QUESTION 16

"if you use the array_diff() function to compare arr1 to arr2, the function returns the array of elements stored in arr1 that are not in arr2."

True

False

QUESTION 17

The array_shift() function removes the ____ element from an array.

first

last

middle

second

QUESTION 18

The array_unshift() function adds ____ element(s) to the beginning of the array.

no new

one or more

only one

two or more

QUESTION 19

The array_pop() function ____ from the end of the array.

copies the last element

moves an element

deletes the first element

removes the last element

QUESTION 20

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

adds

moves

pushes

deletes

QUESTION 21

The ____ function lets you add or remove elements anywhere else in the array.

array_splice()

array_add()

array_split()

array_values()

QUESTION 22

The ____ function returns a Boolean value of true if a given value exists in the array.

in_array()

array_search()

array_boole()

array()

QUESTION 23

You use the ____ function to return a portion of an array and assign it to another array.

array_slice()

array_set()

array_assign()

array_key()

QUESTION 24

"To sort an associative array by key, use the ____ function."

ksort()

asort()

natsort()

rsort()

QUESTION 25

"To perform a reverse sort on an associative array by key and maintain the existing keys, use the _____ function."

ksort()

krsort()

sort()

uk_sort()

QUESTION 26

A multidimensional array in PHP is essentially ____.

an array of arrays

a two-dimensional array

nonexistent

an associative array

QUESTION 27

Which array would result from the execution of this code?

$soups = array("tomato", "onion", "cheese", "chowder");
$c = array_shift($soups);

array("chowder", "tomato", "onion", "cheese");

array("tomato", "onion", "cheese", "chowder");

array("onion", "cheese", "chowder");

array("tomato", "onion", "cheese");

QUESTION 28

What is the output after this code runs?

$soups = array("tomato", "onion", "cheese", "chowder");
$c = array_shift($soups);
echo $c;

onion

cheese

tomato

chowder

QUESTION 29

What does the array look like after this code runs?

$soups = array("tomato", "onion");
array_unshift($soups, "cheese", "chowder");

array("cheese", "chowder", "tomato", "onion")

array("tomato", "onion", "cheese", "chowder")

array("tomato", "onion")

array("cheese", "chowder")

QUESTION 30

What does the array look like after this code runs?

$soups = array("tomato", "onion");
array_push($soups, "cheese", "chowder");

array("tomato", "chowder")

array("cheese", "chowder", "tomato", "onion")

array("tomato", "onion", "cheese", "chowder")

array("onion", "cheese")

QUESTION 31

What does the array look like after this code runs?

$colors = array("tomato", "onion", "cheese", "chowder");
$c = array_pop($colors);

array("onion", "cheese", "chowder")

array("tomato", "cheese", "chowder")

array("tomato", "onion", "chowder")

array("tomato", "onion", "cheese")

QUESTION 32

What prints?

$soups = array("tomato", "onion", "cheese", "chowder");
$c = array_pop($soups); echo $c;

tomato

chowder

onion

cheese

QUESTION 33

Please answer this question as true. You will get 4 points. No fooling. I'm serious.

True

False

first

last

middle

second

Explanation / Answer

Here is your Answers:

Answers:

16:True

Array_diff() function compare two array(array1,array2) and return those elements of array1 which are not in array2

17:First

The array_shift() function removes the first element from an array, and returns the value of the removed element.

18:One or more

The array_unshift() is used to add one or more elements to the beginning of an array.

19:Remove the last element

The array_pop() function is used to remove the last element of an array

20:Adds

The array_push() function is used to add one or more elements onto the end of an array

21: array_splice()

The array_splice() function allows you to add or remove elements anywhere else in the array

22:in_array()

In_array()function returns a Boolean value of true if a given value exists in the array

23: array_slice()

the array_slice() function returns selected parts of an array.

24:ksort()

The ksort() function sorts an associative array, according to the key.

Note: According to chegg’s guideline we are not allow to answer so many questions in one post, You can ask other question in other post.

I hope this solves your problem

Comment if you have any problem in above answers

And please give it a thumbs up if it solved your problem :)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote