1. Question: What will be the output of the following code? function fn(&$var) {    $var = $var - ($var/10 *5);     return $var;   } echo fn (100);

    A
    100

    B
    50

    C
    98

    D
    Error message

    E
    None of the above

    Note: Not available
    1. Report
  2. Question: What does the following function do, when passed two integer values for $p and $q?
    <?php
    function magic($p, $q) {
      return ($q == 0)?$p:magic($q, $p % $q);
    }
    ?>

    A
    Loops infinitely

    B
    Switches the values of $p and $q

    C
    Determines if they are both even or odd

    D
    Determines the greatest common divisor between them

    E
    Calculates the modulus between the two

    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
Copyright © 2024. Powered by Intellect Software Ltd