
PHP - Array
Authored by Sin Chee L
Computers
University
Used 46+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
8 questions
Show all answers
1.
FILL IN THE BLANK QUESTION
1 min • 1 pt
PHP’s numerically indexed array begin with position ___________
2.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Which of the following are CORRECT ways of creating an array?
i ) disease[0] = "covid19";
ii) $disease[] = array("covid19");
iii) $disease[0] = "covid19";
iv) $disease = array("covid19");
iii) and iv)
Only iii)
Only iv)
ii) and iii)
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following PHP function will return true if a variable is an array or false if it is not an array?
this_array()
is_array()
do_array()
in_array()
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which in-built function will add a value to the end of an array?
array_unshift()
into_array()
inend_array()
array_push()
5.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What will be the output of the following PHP code?
<?php
$diseases = array ("SARS", "STDs", "Covid19");
echo (next($diseases));
echo (next($diseases));
?>
STDsCovid19
SARSCovid19
SARSSTDs
Covid19SARS
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following function is used to get the value of the previous element in an array?
last()
before()
prev()
previous()
7.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What will be the output of the following PHP code?
<?php
$vege = array ("avocado", "broccoli", array ("cabbage", "eggplant"), "fig");
echo (count($vege, 1));
?>
_________________________________________________________
The function count() will return the number of elements in an array. The parameter 1 counts the array recursively i.e it will count all the elements of multidimensional arrays.
2
4
5
6
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?