1. Question: Which of the following functions will sort an array in ascending order by value, while preserving key associations?

    A
    asort()

    B

    C

    D

    E

    Note: Not available
    1. Report
  2. Question: What is the output of the following code block?

    <?php

    $a = "The quick brown fox jumped over the lazy dog.";

    $b = array_map("strtoupper", explode(" ", $a));

    foreach($b as $value) {
    print "$value ";
    }

    ?>

    A

    B
    A PHP Error

    C
    Array Array Array Array Array Array Array Array Array>

    D
    None

    E
    Array

    Note: Not available
    1. Report
  3. Question: Which from the following list is not an approrpiate use of an array?

    A

    B
    All of these uses are valid

    C

    D

    E

    Note: Not available
    1. Report
  4. Question: What is the output of this code snippet?

    <?php

    $a = array(0.001 => 'b', .1 => 'c');

    print_r($a);

    ?>

    A

    B
    0.001 => 'b', .1 => c

    C
    0 => 'c'

    D

    E

    Note: Not available
    1. Report
  5. Question: Which of the following functions could be used to break a string into an array?

    A
    array_split()

    B
    split()

    C
    string_split()

    D
    preg_match_all()

    E
    explode()

    Note: Not available
    1. Report
  6. Question: If you wanted a variable containing the letters A through Z, that allowed you to access each letter independently, which of the following approaches could you use?

    A
    $str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

    B
    range('A', 'Z');

    C
    explode("", "ABCDEFGHIJKLMNOPQRSTUVWXYZ");

    D
    You would use the ALPHA_ARRAY constant

    E
    None

    Note: Not available
    1. Report
  7. Question: What is the output of the following code block?

    <?php

    $array = array(1 => 0, 2, 3, 4);

    array_splice($array, 3, count($array), array_merge(array('x'), array_slice($array, 3)));

    print_r($array);

    ?>

    A
    1 => 1, 2 => 2, 3 => x, 4=> 4

    B
    0 => 1, 2 => 2, 3 => 3, 4 => 4, x => 3

    C

    D
    0 => x, 1 => 0, 2 => 1, 3=> 2, 4=>3

    E

    Note: Not available
    1. Report
  8. Question: Which function would you use to add an element to the beginning of an array?

    A
    array_shift()

    B

    C

    D

    E

    Note: Not available
    1. Report
  9. Question: Which key will not be displayed from the following code block?

    <?php

    $array = array('a' => 'John',
    'b' => 'Coggeshall',
    'c' => array('d' => 'John',
    'e' => 'Smith'));

    function display($item, $key) {
    print "$key => $item\n";
    }

    array_walk_recursive($array, "display");

    ?>

    A
    d

    B
    c

    C
    b

    D
    a

    E
    They all will be displayed

    Note: Not available
    1. Report
  10. Question: What is the result of the following code snippet?

    <?php

    $array = array('a' => 'John',
    'b' => 'Coggeshall',
    'c' => array('d' => 'John',
    'e' => 'Smith'));

    function something($array) {
    extract($array);
    return $c['e'];
    }

    print something($array);
    ?>

    A
    Smith

    B
    A PHP Warning

    C

    D

    E
    Array

    Note: Not available
    1. Report
Copyright © 2024. Powered by Intellect Software Ltd