1. Question: What is the output of the following?
    <?php
    
    $a = 010;
    $b = 0xA;
    $c = 2;
    
    print $a + $b + $c;
    
    ?>

    A
    20

    B
    22

    C
    18

    D
    $a is an invalid value

    E
    2

    Note: Not available
    1. Report
  2. Question: What is the output of the following?
    <?php
    
    $a = 20;
    
    function myfunction($b) {
    	$a = 30;
    	
    	global $a, $c;
    	return $c = ($b + $a);
    }
    
    print myfunction(40) + $c;
    
    ?>

    A
    120

    B
    Syntax Error

    C
    60

    D
    70

    Note: Not available
    1. Report
  3. Question: What would you replace ??????? with, below, to make the string "Hello, World!" be displayed?
    <?php
    
    function myfunction() {
            ???????
    	print $string;
    }
    
    myfunction("Hello, World!");
    
    ?>

    A
    There is no way to do this

    B
    $string = $argv[1];

    C
    $string = $_ARGV[0];

    D
    list($string) = func_get_args();

    E
    $string = get_function_args()

    Note: Not available
    1. Report
  4. Question: What is the output of the following function?

    <?php

    function &find_variable(&$one, &$two, &$three) {

    if($one > 10 && $one < 20) return $one;
    if($two > 10 && $two < 20) return $two;
    if($three > 10 && $three < 20) return $three;
    }

    $one = 2;
    $two = 20;
    $three = 15;

    $var = &find_variable($one, $two, $three);

    $var++;

    print "1: $one, 2: $two, 3: $three";

    ?>

    A
    1: 2, 2: 20, 3: 15

    B

    C
    1: 2, 2:21, 3:15

    D
    1: 3, 2: 20, 3: 15

    E
    1: 2, 2: 20, 3: 16

    Note: Not available
    1. Report
  5. Question: For an arbitrary string $mystring, which of the following checks will correctly determine if the string PHP exists within it?

    A

    B

    C

    D

    E

    Note: Not available
    1. Report
  6. Question: 

    What are the values of $a in $obj_one and $obj_twowhen this script is executed?


    <?php
    class myClass {
    private $a;

    public function __construct() {
    $this->a = 10;
    }

    public function printValue() {
    print "The Value is: {$this->a}\n";
    }

    public function changeValue($val, $obj = null) {
    if(is_null($obj)) {
    $this->a = $val;
    } else {
    $obj->a = $val;
    }
    }

    public function getValue() {
    return $this->a;
    }
    }

    $obj_one = new myClass();
    $obj_two = new myClass();

    $obj_one->changeValue(20, $obj_two);
    $obj_two->changeValue($obj_two->getValue(), $obj_one);

    $obj_two->printValue();
    $obj_one->printValue();

    ?>
    A

    B
    You cannot modify private member variables of a different class

    C

    D

    E
    20,10

    Note: Not available
    1. Report
  7. Question: What are the three access modifiers that you can use in PHP objects?

    A

    B

    C

    D

    E

    Note: Not available
    1. Report
  8. Question: When checking to see if two variables contain the same instance of an object, which of the following comparisons should be used?

    A

    B

    C

    D

    E

    Note: Not available
    1. Report
  9. Question: In PHP 5 you can use the ______ operator to ensure that an object is of a particular type. You can also use _______ in the function declaration.

    A

    B

    C

    D

    E

    Note: Not available
    1. Report
  10. Question: What is wrong with the following code?
    <?php
    
    function duplicate($obj) {
    	$newObj = $obj;
    	return $newObj;
    }
    
    $a = new MyClass();
    
    $a_copy = duplicate($a);
    
    $a->setValue(10);
    $a_copy->setValue(20);
    
    ?>

    A
    You must use return &$newObj instead

    B
    There is nothing wrong with this code

    C
    duplicate() must accept its parameter by reference

    D
    You must use the clone operator to make a copy of an object

    E
    duplicate() must return a reference

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