Coursera Answers

Building Web Applications in PHP | Week 6 Practice Quiz Answer

Building Web Applications in PHP Week 6 Practice Quiz Answer

PHP Arrays

Question 1)
In PHP arrays can either be key / value (i.e. an associative array) or indexed by integers (i.e. a linear array).

  • True
  • False

 

Question 2)
Which symbol is used to associate a key to a value in an associative array?

  • ->
  • ==
  • =>
  • >>

 

Question 3)
Fill in the blank to echo ‘Arrays’

$stuff = array(‘course ‘ => ‘PHP-Intro’, ‘topic’ => ‘Arrays’);

echo ________;

  • $stuff[‘Arrays’]
  • $stuff[‘course’]
  • $stuff[1]
  • $stuff[‘topic’]

 

Question 4)
What is the output of

$stuff = array(‘course’ => ‘PHP-Intro’, ‘topic’ => ‘Arrays’);

echo isset($stuff[‘section’]);</span >

  • True
  • There is no output</span >
  • 1
  • 0
  • False

 

Question 5)
In PHP you cannot make an array of associative arrays.

  • True
  • False

 

Question 6)
The [_____] function is used to rearrange an array in random order.

  • SHUFFLE()

 

Question 7)
Which of these are built-in sorting functions provided by PHP?
  • isort()
  • ksort()
  • sort()
  • asort()

 

Question 8)
What function is used to sort the array in alphabetical order of the keys?

  • ksort()

 

Question 9)
What function is used to sort the values in array and keep the keys intact?

  • asort()

 

Question 10)
What function can be used to split a string into an array words based on a delimiter? For instance, create a three element array from the string ‘I am great!!!’.

  • explode()

 

Question 11)
var_dump will display the name, key/value pairs, and data types of a variable.

  • True
  • False