1. Question: <?php $string = "111221"; for($i = 0; $i < strlen($string); $i++) { $current = $string[$i]; $count = 1; while(isset($string[$i + $count]) && ($string[$i + $count] == $current)) $count++; $newstring .= "$count{$current}"; $i += $count-1; } print $newstring; ?>

    A
    312211

    B
    3312212

    C
    11221221

    D
    221131

    E
    3211122

    Note: Not available
    1. Report
  2. Question: What is the best way to ensure that a user-defined function is always passed an object as its single parameter?

    A
    function myfunction(stdClass $a)

    B
    function myfunciton($a = stdClass)

    C
    Use is_object() within the function

    D
    There is no way to ensure the parameter will be an object

    E
    <label for="10_5">function myfunction(Object $a)</label>

    Note: Not available
    1. Report
  3. Question: What would go in place of ?????? below to make this script execute without a fatal error? <?php $a = 1; $b = 0; ?????? $c = $a / $b; ?>

    A
    quit();

    B
    die();

    C
    stop();

    D
    __halt_compiler();

    E
    exit();

    Note: Not available
    1. Report
  4. Question: Type-hinting and the instanceof keyword can be used to check what types of things about variables?

    A
    If a particular child class extends from it

    B
    If they are an instance of a particular interface

    C
    If they are an abstract class

    D
    If they have a particular parent class

    E
    If they are an instance of a particular class

    Note: Not available
    1. Report
  5. Question: What three special methods can be used to perform special logic in the event a particular accessed method or member variable is not found?

    A
    __get($variable)

    B
    __call($method, $params)

    C
    __get($method)

    D
    __set($variable, $value)

    E
    __call($method)

    Note: Not available
    1. Report
  6. Question: Which symbol is used for variable declaration?

    A
    #

    B
    $

    C
    @

    D
    %

    Note: Not available
    1. Report
  7. Question: What is the output of the following:
    $str= "good";
    $$str= "bye";
    echo ${$str};

    A
    good

    B
    bye

    C
    good bye

    D
    None

    Note: Not available
    1. Report
  8. Question: Which of the following fall into compound data type categories?

    A
    Array and object

    B
    Resource and null

    C
    Array and null

    D
    Resource and object

    Note: Not available
    1. Report
  9. Question: Which of the following fall into special data type category?

    A
    Array and object

    B
    Resource and null

    C
    Array and null

    D
    Resource and object

    Note: Not available
    1. Report
  10. Question: Which is the correct output of the following script?
    $model="Toyota";
    $obj=(object) $model;
    print $obj->scalar;

    A
    Fatal Error

    B
    Object

    C
    Toyota

    D
    Warning: Scalar property is not defined in the object

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