Tag: Arrays
-
PHP Questions & Answers – Arrays – 5
PHP Multiple Choice Questions & Answers (MCQs) focuses on “Arrays – 5”. Q 1. What will be the output of the following PHP code? <?php $fruits = array (“mango”, “apple”, “pear”, “peach”); $fruits = array_flip($fruits); echo ($fruits[0]); ?> A. mangoB. 0C. peachD. error Show Answer Answer:-D. error Explanation As we are flipping the values, $fruits[“mango”]…
-
PHP Coding Questions and Answers – Arrays – 4
PHP Multiple Choice Questions & Answers (MCQs) focuses on “Arrays – 4”. Q 1. What will be the output of the following PHP code? A. I like Volvo BMW and Toyota.B. I like Volvo, BMW and Toyota)C. I like Volvo, BMW and Toyota.D. I like. Volvo.,. BMW. and. Toyota) Show Answer Answer:-C. I like Volvo,…
-
PHP Coding Questions and Answers – Arrays – 3
PHP Multiple Choice Questions & Answers (MCQs) focuses on “Arrays – 3”. Q 1. What will be the output of the following PHP code? <?php $age = array(“Harry” => “21”, “Ron” => “23”,”Malfoy” => “21”); array_pop($age); print_r(array_change_key_case($age, CASE_UPPER)); ?> A. Array ( [HARRY] => 21 [RON] => 23 )B. Array ( [HARRY] => 21 [RON]…
-
PHP Coding Questions and Answers – Arrays – 2
PHP Multiple Choice Questions & Answers (MCQs) focuses on “Arrays – 2”. Q 1. 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] . “.”; ?> A. I like Volvo, Toyota…
-
PHP Multiple Choice Questions – Array
PHP Multiple Choice Questions & Answers (MCQs) focuses on “Array”. Q 1. PHP’s numerically indexed array begin with position ___________A. 0B. 1C. 2D. -1 Show Answer Answer:-A. 0 Explanation Like all the other programming languages, the first element of an array always starts with ‘0’. Q 2. Which of the following are correct ways of…
-
C++ Programming MCQ – Arrays
Q 1. Which of the following correctly declares an array?A. int array; B. int array[10];C. array{10};D. array array[10]; Show Answer Answer:-B. int array[10]; Explanation Because array variable and values need to be declared after the datatype only. Q2. What is the index number of the last element of an array with 9 elements?A. 8B. 9C.…
-
PHP Quizs Question & Answers Arrays – 5
Q 1. What will be the output of the following PHP code? A. Array ( [0] => picture1.JPG [1] => Picture10.jpg [2] => picture2.jpg [3] => picture20.jpg )B. Array ( [0] => picture1.JPG [1] => picture2.jpg [2] => Picture10.jpg [3] => picture20.jpg )C. Array ( [0] => Picture10.jpg [1] => picture1.JPG [2] => picture2.jpg [3]…
-
PHP Coding Quizs Question & Answers Arrays – 4
Q 1. What will be the output of the following PHP code? A. Array ( [0] => Array ( [1] => Volvo [2] => BMW ) [1] => Array ( [1] => Toyota [2] => Honda ) [2] => Array ( [1] => Mercedes [2] => Opel ) ) B. Array ( [1] => Array…
-
PHP Coding Quizs Question & Answers Arrays – 3
Q 1. What will be the output of the following PHP code? A. Key = Harry, Value = 21 Key = Ron, Value = 21 Key = Malfoy, Value = 23 B. Key = Harry, Value = 21 Key = Ron, Value = 19 Key = Malfoy, Value = 23 C. Key = Harry, Value…
-
PHP Quizs Question & Answers Arrays -1
1. Which function returns an array consisting of associative key/value pairs?A. count()B. array_count()C. array_count_values()D. count_values() Answer:-C. array_count_values() Explanation: The function array_count_values() will count all the values of an array. It will return an associative array, where the keys will be the original array’s values, and the values are the number of occurrences. 2. What will…