NEW
Font size
WorksheetsQuiz-4: Function & Array
Total questions: 15
Worksheet time: 15mins
Which of the following is the correct way to declare an array in PHP?
array()
array[]
array{}
array<>
What is the output of the following code? $fruits = array('apple', 'banana', 'orange'); echo $fruits[1];
orange
banana
apple
grape
What is the output of the following code? $numbers = array(1, 2, 3, 4, 5); echo count($numbers);
3
2
5
1
Which function is used to remove the last element from an array in PHP?
array_push()
array_shift()
array_slice()
array_pop()
Which function is used to sort an array in ascending order in PHP?
sort
ksort
asort
rsort
How to define a function in PHP?
function {function body}
data type functionName(parameters) {function body}
functionName(parameters) {function body}
function functionName(parameters) {function body}
Total looping techniques supported by PHP are?
1
2
3
4
Choose whether true or false: the do-while loop is an exit control loop.
True
False
Depends on the condition
None of these
Functions in PHP should start with which of the following keyword?
function
fun
def
None of these
Total types of the array in PHP is?
1
2
3
4
Index of an array by default starts with which of the following in PHP?
-1
0
1
2
Another term used for Objects is?
class
instance
reference
None of these
Using which keyword is the object created?
class
new
def
None of these
Total error levels available in PHP are?
15
16
17
18
Find the output of the code below:
<?PHP
ECHO CHR(52);
?>
1
2
3
4
