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 10 of 15

Explore more Topics under PHP

Q91.
What will be the output of the following PHP code?
<?php
    $fruits = array ("apple", "orange", "banana");
    echo (next($fruits)); 
    echo (next($fruits));
    ?>
Discuss
Answer: (a).orangebanana
Q92.
Which function can be used to move the pointer to the previous array position?
Discuss
Answer: (c).prev()
Q93.
What will be the output of the following PHP code?
<?php
    $fruits = array ("apple", "orange", array ("pear", "mango"),
    "banana");
    echo (count($fruits, 1));
    ?>

a.

3

b.

4

c.

5

d.

6

Discuss
Answer: (d).6
Q94.
Which function returns an array consisting of associative key/value pairs?
Discuss
Answer: (c).array_count_values()
Q95.
What will be the output of the following PHP code?
<?php
$cars = array("Volvo", "BMW", "Toyota");
echo "I like " . $cars[2] . ", " . $cars[1] . " and " . $cars[0] . ".";
?>
Discuss
Answer: (d).I like Toyota, BMW and Volvo
Q96.
What will be the output of the following PHP code?
<?php
$fname = array("Peter", "Ben", "Joe");
$age = array("35", "37", "43");
$c = array_combine($age, $fname);
print_r($c);
?>
Discuss
Answer: (d).Array ( [35] => Peter [37] => Ben [43] => Joe )
Q97.
What will be the output of the following PHP code?
<?php
$a=array("A","Cat","Dog","A","Dog");
$b=array("A","A","Cat","A","Tiger");
$c=array_combine($a,$b);
print_r(array_count_values($c));
?>
Discuss
Answer: (a).Array ( [A] => 5 [Cat] => 2 [Dog] => 2 [Tiger] => 1 )
Q98.
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", "h" => "orange");
$a3 = array("i" => "orange");
$a4 = array_combine($a2, $a3);
$result = array_diff($a4, $a2);
print_r($result);
?>
Discuss
Answer: (a).Array ( [d] => yellow )
Q99.
What will be the output of the following PHP code?
<?php
$a1 = array("red", "green");
$a2 = array("blue", "yellow");
$a3 = array_merge($a1, $a2);
$a4 = array("a", "b", "c", "d");
$a = array_combine($a4, $a3);
print_r($a);
?>
Discuss
Answer: (d).Array ( [a] => red [b] => green [c] => blue [d] => yellow )
Q100.
What will be the output of the following PHP code?
<?php
$a = array("a" => "india", "b" => "brazil", "c" => "china");
echo array_shift($a);
echo "<br>"
array_pop($a);
print_r($a);
?>
Discuss
Answer: (b).india
Array ( [a] => brazil )

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!