1. Question: Which of the following tags are an acceptable way to begin a PHP Code block?

    A
    <SCRIPT LANGUAGE="php">

    B
    <!

    C
    <%

    D
    <?php

    E
    <?

    Note: Not available
    1. Report
  2. Question: Which of the following are valid PHP variables?

    A
    @$foo

    B
    &$variable

    C
    ${0x0}

    D
    $variable

    E
    $0x0

    Note: Not available
    1. Report
  3. Question: What is the output of the following PHP code?
    <?php
    
    define('FOO', 10);
    $array = array(10 => FOO, "FOO" => 20);
    print $array[$array[FOO]] * $array["FOO"];
    
    ?>

    A
    FOO

    B
    100

    C
    200

    D
    20

    E
    20

    Note: Not available
    1. Report
  4. Question: What is the output of the following PHP script?
    <?php
    
    $a = 1;
    $b = 2.5;
    $c = 0xFF;
    
    $d = $b + $c;
    $e = $d * $b;
    $f = ($d + $e) % $a;
    
    print ($f + $e);
    
    ?>

    A
    643.75

    B
    432

    C
    643

    D
    257

    E
    432.75

    Note: Not available
    1. Report
  5. Question: What combination of boolean values for $a, $b, $c, and $d will result in the variable $number being equal to 3?
    <?php
    
    $a = null;
    $b = null;
    $c = null;
    $d = null;
    
    if($a && !$b) {
      if(!!$c && !$d) {
        if($d && ($a || $c)) {
          if(!$d && $b) {
            $number = 1;
          } else {
            $number = 2;
          }
        } else {
          $number = 3;
        }
      } else {
        $number = 4;
      }
    } else {
      $number = 5;
    }
    ?>

    A
    false, true, true, true

    B
    true, false, true, false

    C
    true, true, false, false

    D
    false, true, true, false

    E
    false, false, true, false

    Note: Not available
    1. Report
  6. Question: What is the output of the following code?
    <?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
  7. Question: Which operator is used to test if two values are identical in every way?

    A
    !==

    B
    instanceof

    C
    =

    D
    ==

    E
    ===

    Note: Not available
    1. Report
  8. 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
  9. Question: Choose the selection that best matches the following statements: PHP is a _____ scripting language based on the ____ engine. It is primarily used to develop dynamic _____ content, although it can be used to generate ____ documents (among others) as well.

    A
    Dynamic, PHP, Database, HTML

    B
    Embedded, Zend, HTML, XML

    C
    Perl-based, PHP, Web, Static

    D
    Embedded, Zend, Docbook, MySQL

    E
    Zend-based, PHP, Image, HTML

    Note: Looking at the answers, the only one that makes sense for every blank is B. PHP is a scripting language based on the Zend Engine that is usually embedded in HTML code. As such, it is primarily used to develop HTML documents, although it can be used just as nicely to develop other types of documents, such as XML.
    1. Report
  10. Question: Which of the following tags is not a valid way to begin and end a PHP code block?

    A
    <% %>

    B
    <? ?>

    C
    <?= ?>

    D
    <! !>

    E
    <?php ?>

    Note: While tags such as <% %> and <?= ?> are often forgotten in PHP programming, they are valid ways to delimit a PHP code block. The <! and !> tags, however, are not valid and, therefore, the correct answer is D. Keep in mind, in any case, that some of these tags are not always available, depending on how the php.ini file on which the PHP interpreter runs is configured.
    1. Report
Copyright © 2024. Powered by Intellect Software Ltd