Home / CSE MCQs / PHP MCQs :: Arrays - PHP

CSE MCQs :: PHP MCQs

  1. Say in the above question you need to get the array sorted in the manner we humans would have done it i.e picture1 then picture2 etc.. Which of the following function should be used?
  2. A.
    dsort()
    B.
    casesort()
    C.
    natcasesort()
    D.
    naturalsort()

  3. What will be the output of the following PHP code?
    < ?php      $fruits = array ("apple", "mango", "peach", "pear",     "orange");     $subset = array_slice ($fruits, 2);     print_r ($subset); ?>
  4. A.
    Array ( [0] => peach )
    B.
    Array ( [0] => apple [1] => mango [2] => peach )
    C.
    Array ( [0] => apple [1] => mango )
    D.
    Array ( [0] => peach [1] => pear [2] => orange )

  5. What will be the output of the following PHP code?
    < ?php      $fruits = array ("apple", "mango", "peach", "pear",     "orange");     $subset = array_splice ($fruits, 2);     print_r ($fruits); ?>
  6. A.
    Error
    B.
    Array ( [0] => apple [1] => mango [2] => peach )
    C.
    Array ( [0] => apple [1] => mango )
    D.
    Array ( [0] => pear [1] => orange )

  7. What will be the output of the following PHP code?
    < ?php      $number = array ("4", "hello", 2);     echo (array_sum ($number)); ?>
  8. A.
    4hello2
    B.
    4
    C.
    2
    D.
    6