Arrays
1.
PHP’s numerically indexed array begin with position ___________
2.
Which of the following are correct ways of creating an array?
i) state[0] = "karnataka";
ii) $state[] = array("karnataka");
iii) $state[0] = "karnataka";
iv) $state = array("karnataka");
3.
What will be the output of the following PHP code?
<?php
$states = array("Karnataka" => array
("population" => "11,35,000", "capital" => "Bangalore"),
"Tamil Nadu" => array( "population" => "17,90,000",
"capital" => "Chennai") );
echo $states["Karnataka"]["population"];
?>
4.
Which of the following PHP function will return true if a variable is an array or false if it is not an array?
5.
Which in-built function will add a value to the end of an array?
6.
What will be the output of the following PHP code?
<?php
$state = array ("Karnataka", "Goa", "Tamil Nadu",
"Andhra Pradesh");
echo (array_search ("Tamil Nadu", $state) );
?>
7.
What will be the output of the following PHP code?
<?php
$fruits = array ("apple", "orange", "banana");
echo (next($fruits));
echo (next($fruits));
?>
8.
What will be the output of the following PHP code?
<?php
$fruits = array ("apple", "orange", "banana");
echo (next($fruits));
echo (next($fruits));
?>
9.
Which of the following function is used to get the value of the previous element in an array?
10.
What will be the output of the following PHP code?
<?php
$fruits = array ("apple", "orange", array ("pear", "mango"),
"banana");
echo (count($fruits, 1));
?>