Aptitude Reasoning English GK Computer Knowledge Programming Skill Banking Software Testing



Question - 1

How many types of array are available in php?

  • 1
  • 2
  • 3
  • 4
Solutions
Question - 2

Which of the following PHP function will return true if a variable is an array or false if it is not an array?

  • this_array()
  • is_array()
  • do_array()
  • in_array()
Solutions
Question - 3

Which array function will add a value to the end of an array?

  • array_unshift()
  • into_array()
  • inend_array()
  • array_push()
Solutions
Question - 4

What will be the output of the following PHP code?

<?php 
$animals = array("cow","cat",array("tiger","lion"),"goat");
echo count($animals,1);
?>

  • 2
  • 4
  • 6
  • 1
Solutions
Question - 5

What is the output of the following php code?

<?php
 $alpha_arr = array ("Free", "Online", "Test");
 echo (next($alpha_arr ));
 ?>

  • Free
  • Online
  • Test
  • FreeOnlineTest
Solutions
Question - 6

What will be the output of the following PHP code?


< ?php $fruits = array ("A", "B", "C", "D"); $fruits = array_flip($fruits); echo ($fruits[0]);
?>

  • A
  • B
  • D
  • Error
Solutions
Question - 7

What will be the output of the following PHP code?

<?php $arr=array("a"=>"red","b"=>"green","c"=>"blue");
echo array_search("red",$arr);
?>

  • a
  • b
  • c
  • error
Solutions
Question - 8

What will be the output of the following PHP code?

< ?php 
    $number = array ("10", "Freeonlinetest", 2);
    echo (array_sum ($number));
?>

  • 10
  • 12
  • 2
  • error
Solutions
Question - 9

What will be the output of the following PHP code?

<?php
$name_array = array("Subha Kalyan", "Swasat Kalyan", "Paban Kalyana");
$age = array("6", "2", "43");
$c = array_combine($name_array , $age);
print_r($c);
?>

  • Array ( [6] => Subha Kalyan [2] => Swasat Kalyan [43] => Paban Kalyana )
  • Array ( [Subha Kalyan] => 6 [Swasat Kalyan] => 2 [Paban Kalyana] => 43 )
  • Array ( "Subha Kalyan"=> 6, "Swasat Kalyan" => 2, "Paban Kalyana" => 43 );
  • Error
Solutions
Question - 10

What will be the output of the following PHP code?

<?php
$animals = array("Cow", "Cat", "Dog", "Cow", "Dog");
print_r(array_count_values($animals));
?>

  • Array ( [Cow] => 1 [Cat] => 1 [Dog] => 1 )
  • Array ( [Cow] => 2 [Cat] => 1 [Dog] => 2 )
  • Array ( [Cow] => 2 [Cat] => 0 [Dog] => 2 )
  • error
Solutions
Question - 11

Which of the functions is used to sort an array in descending order?

  • sort()
  • rsort()
  • asort()
  • dsort()
Solutions
Question - 12

What will be the output of the following PHP code?
$Animals = array("Cow", "Cat", "Dog", "Elephant");
array_pop($Animals);
print_r($Animals);
?>

  • Array ( [0] => Cow [1] => Cat [2] => Dog )
  • Array ( [0] => Cat [1] => Dog [2]=>Elephant )
  • Both A or B
  • error
Solutions
Question - 13

What will be the output of the following PHP code?

<?php 
$City = array("A"=>"Hyderabad", "B"=>"Vizag", "C"=>"Delhi");
echo array_shift($City);
print_r ($City);
?>

  • HyderabadArray ( [B] => Vizag [C] => Delhi )
  • HyderabadArray ( [B] => Vizag )
  • HyderabadArray ( [C] => Delhi )
  • None of the above
Solutions
Question - 14

How in_array() function work in PHP?

  • It will check one array is exit in main array or not
  • It will check particular item exist or not in given array
  • Both A Or B
  • None of these
Solutions
Question - 15

Why sizeof() function uses in PHP?
<?php
$cars=array("Volvo","BMW","Toyota");
echo sizeof($cars);
?>

  • 2
  • 3
  • VolvoBMWToyota
  • 14
Solutions
Question - 16

Which function can be used to move the pointer to the previous array position?

  • last()
  • before()
  • prev()
  • previous()
Solutions
Question - 17

What will be the output of the following PHP code?

<?php
$Alphabet =array("A","B","C","D","E","F");
print_r(array_chunk($Alphabet,3));
?>

 

  • Array ( [0] => Array ( [0] => A [1] => B [2] => C ) [1] => Array ( [0] => D [1] => E [2] => F ) )
  • Array ( [0] => Array ( [0] => A [1] => B [2] => C ) [1] => Array ( [3] => D [4] => E [5] => F ) )
  • Array ( [0] => Array ( [0] => A [1] => B [2] => C ) [1] => Array ( [0] => D [1] => E ) [2] => Array( [0] => F ) )
  • error
Solutions
Question - 18

What will be the output of the following PHP code?

<?php
$num = array(2, 5, 10, 1);
echo(array_product($num));
?>

  • 10
  • 3
  • 100
  • 6
Solutions
Question - 19

What will be the output of the following PHP code?

<?php
$Student = array ("Saroj", "Kishore", "Sameer",
"Raju");
echo (array_search ("Kishore", $Student) );
?>

  • 0
  • 1
  • 2
  • 3
Solutions
Question - 20

What will be the output of the following PHP code?

<?php
$a=array("a"=>"Volvo","b"=>"BMW","c"=>"Toyota");
print_r(array_reverse($a));
?>

  • array("a"=>"Volvo","b"=>"BMW","c"=>"Toyota")
  • Array ( [c] => Toyota [b] => BMW [a] => Volvo )
  • Array ( [0] => Toyota [1] => BMW [2] => Volvo )
  • None of the above
Solutions
Tags:
PHP Array MCQ (Multiple Choice Questions), Advanced PHP Array MCQ, PHP Array MCQ Online test,PHP Array MCQ Questions and answers PDF, PHP Array Interview Questions With Answers, PHP Array Technical Questions with full explanation