adplus-dvertising

Welcome to the Arrays and Functions in PHP MCQs Page

Dive deep into the fascinating world of Arrays and Functions in PHP with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of Arrays and Functions in PHP, a crucial aspect of PHP. In this section, you will encounter a diverse range of MCQs that cover various aspects of Arrays and Functions in PHP, from the basic principles to advanced topics. Each question is thoughtfully crafted to challenge your knowledge and deepen your understanding of this critical subcategory within PHP.

frame-decoration

Check out the MCQs below to embark on an enriching journey through Arrays and Functions in PHP. Test your knowledge, expand your horizons, and solidify your grasp on this vital area of PHP.

Note: Each MCQ comes with multiple answer choices. Select the most appropriate option and test your understanding of Arrays and Functions in PHP. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!

Arrays and Functions in PHP MCQs | Page 12 of 15

Explore more Topics under PHP

Q111.
What will be the output of the following PHP code ?
<?php
$people = array("Peter", "Susan", "Edmund", "Lucy");
echo pos($people);
?>
Discuss
Answer: (b).Peter
Discuss
Answer: (a).Array ( [0] => 0 [1] => 1 [2] => 2 [3] => 3 [4] => 4 [5] => 5 )
Q113.
What will be the output of the following PHP code ?
<?php
$array = array("red", "green");
array_push($array, "blue", "yellow");
print_r($array);
?>
Discuss
Answer: (a).Array ( [0] => red [1] => green [2] => blue [3] => yellow )
Q114.
What will be the output of the following PHP code ?
<?php
$age = array("Harry" => "21", "Ron" => "19", "Malfoy" => "23");
ksort($age);
foreach($age as $x => $x_value)
{
    echo "Key=" . $x . ", Value=" . $x_value;
    echo "<br>";
}
?>
Discuss
Answer: (c).Key = Harry, Value = 21
Key = Malfoy, Value = 23
Key = Ron, Value = 19
Q115.
What will be the output of the following PHP code?
<?php
$age = array("Peter"=>"35", "Ben"=>"37", "Joe"=>"43");
print_r(array_change_key_case($age, CASE_UPPER));
?>
Discuss
Answer: (c).Array ( [PETER] => 35 [BEN] => 37 [JOE] => 43 )
Discuss
Answer: (d).Array ( [0] => Array ( [0] => Volvo [1] => BMW ) [1] => Array ( [0] => Toyota [1] => Honda ) [2] => Array ( [0] => Mercedes [1] => Opel ) )
Q117.
What will be the output of the following PHP code?
<?php
$fname = array("Peter", "Ben", "Joe");
$age = array("35", "37", "43");
$c = array_combine($fname, $age);
print_r($c);
?>
Discuss
Answer: (b).Array ( [Peter] => 35 [Ben] => 37 [Joe] => 43 )
Q118.
What will be the output of the following PHP code?
<?php
$a = array("A", "Cat", "Dog", "A", "Dog");
print_r(array_count_values($a));
?>
Discuss
Answer: (a).Array ( [A] => 2 [Cat] => 1 [Dog] => 2 )
Q119.
What will be the output of the following PHP code?
<?php
$a1 = array("a"=>"red", "b"=>"green", "c"=>"blue", "d"=>"yellow");
$a2 = array("e"=>"red", "f"=>"green", "g"=>"blue");
$result = array_diff($a1, $a2);
print_r($result);
?>
Discuss
Answer: (a).Array ( [d] => yellow )
Q120.
What will be the output of the following PHP code?
<?php
$a1 = array_fill(3, 4, "blue");
$b1 = array_fill(0, 1, "red");
print_r($a1);
echo "<br>";
print_r($b1);
?>
Discuss
Answer: (d).Array ( [3] => blue [4] => blue [5] => blue [6] => blue )

Suggested Topics

Are you eager to expand your knowledge beyond PHP? We've curated a selection of related categories that you might find intriguing.

Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!