Main Snake Zend Zend Questions Exam Quicktest MZend Zend-Race Zend-Highscore


Timer

00:00

Question: 1

ID: 1


Which of the following parts must a XML document have in order to be well-formed?






Question: 2

ID: 2


What is the output of the following code?

                        
class C {
   public $x = 1;
   function __construct() { 
      ++$this->x;
   }
   function __invoke() {
      return ++$this->x; 
   }
   function __toString() {
      return (string) --$this->x;
   }
}
$obj = new C();
echo $obj();





Question: 3

ID: 4


What is the difference between the spaceship operator () and the strcmp() function?






Question: 4

ID: 5


What is the output of the following code?

                        
var_dump(boolval(new StdClass()));





Question: 5

ID: 6


Which of the following superglobals does NOT necessarily contain data from the client?






Question: 6

ID: 7


What will the following code print out?

                        
$str = '✔ one of the following'; 
echo str_replace('✔', 'Check', $str);





Question: 7

ID: 8


Which of the following statements is NOT correct?






Question: 8

ID: 9


What is the output of the following code?

                        
echo 0x33, ' monkeys sit on ', 011, ' trees.';





Question: 9

ID: 15


What is the output of the following code?

                        
class test {
  public $value = 0;
  
  function test() {
    $this->value = 1;
  }   
  function __construct() {
    $this->value = 2;
  }
}
$object = new test();
echo $object->value;





Question: 10

ID: 16


What is the output of the following code?

                        
var_dump(boolval([]));





Question: 11

ID: 17


After performing the following operations:

                        
$a = array('a', 'b', 'c');
$a = array_keys(array_flip($a));

What will be the value of $a?




Question: 12

ID: 18


Transactions are used to...






Question: 13

ID: 21


Which of the following expressions will evaluate to a random value from an array below?

                        
$array = array("Sue","Mary","John","Anna");





Question: 14

ID: 24


You want to parse a URL into its single parts. Which function do you choose?






Question: 15

ID: 25


What is the output of the following code?

                        
$string = 'Good luck!';
$start = 10;
var_dump(substr($string, $start));





Question: 16

ID: 30


Which of these databases is NOT supported by a PDO driver?






Question: 17

ID: 32


What is the output of the following code?

                        
for ($i = 0; $i < 1.02; $i += 0.17) {
  $a[$i] = $i;
} 
echo count($a);





Question: 18

ID: 33


What will be the output of the following code?

                        
$a = array(0, 1, 2 => array(3, 4));
$a[3] = array(4, 5);
echo count($a, 1);





Question: 19

ID: 34


What is the output of the following code?

                        
var_dump(boolval(-1));





Question: 20

ID: 37


Which PHP function sets a cookie and URL encodes its value when sending it to the browser?






Question: 21

ID: 38


Which of the following is an invalid DOM save method?






Question: 22

ID: 39


What is the output of the following code?

                        
function increment($val) {
  ++$val;
}
$val = 1; 
increment ($val); 
echo $val;





Question: 23

ID: 40


What is the output of the following code?

                        
echo "22" + "0.2", 23 . 1;





Question: 24

ID: 42


When a class is defined as final it:






Question: 25

ID: 44


Which constant must be passed as the second argument to htmlentities() to convert single quotes (') to HTML entities?






Question: 26

ID: 45


Which of the following can NOT be used to send a cookie from within a PHP application?






Question: 27

ID: 46


Which one of the following XML declarations is NOT valid?






Question: 28

ID: 49


What is the name of the PHP function used to automatically load non-yet defined classes?






Question: 29

ID: 50


What would be the output of the following code?

                        
namespace MyFramework\DB;
class MyClass {
   static function myName() {
      return __METHOD__;
  }
}
print MyClass::myName();





Question: 30

ID: 52


Which class of HTTP status codes is used for server error conditions?






Question: 31

ID: 54


Which of the following rules must every correct XML document adhere to? (Choose 2)






Question: 32

ID: 56


Which of the following may be used in conjunction with CASE inside a SWITCH statement?






Question: 33

ID: 59


What is the name of the key for the element in $_FILES['name'] that contains the provisional name of the uploaded file?






Question: 34

ID: 62


What is the output of this code?

                        
$world = 'world';
echo <<<'TEXT'
hello $world
TEXT;





Question: 35

ID: 67


Assuming UTF-8 encoding, what is the value of $count?

                        
$data = '$la2';
$count = strlen($data);





Question: 36

ID: 70


Which PHP function sets a cookie whose value does NOT get URL encoded when sending it to the browser?






Question: 37

ID: 71


Which value will be assigned to the key 0 in the following code?

                        
$a = array(true, '0' => false, false => true);





Question: 38

ID: 72


What is the name of the method that can be used to provide read access to virtual properties in a class?






Question: 39

ID: 75


What DOM method is used to load HTML files?






Question: 40

ID: 76


What is the name of the key in $_FILES['name'] that contains the number of bytes of the uploaded file?






Question: 41

ID: 77


Given a php.ini setting of default_charset = utf-8 what will the following code print in the browser?

                        
header('Content-Type: text/html; charset=iso-8859-1');
echo '✂✔✝';





Question: 42

ID: 80


What is the length of a string returned by:

                        
md5(rand(), TRUE);





Question: 43

ID: 83


An unbuffered database query will: (Choose 2)






Question: 44

ID: 84


What is the output of the following code?

                        
$f = function () {
    return "hello";
}; 
echo gettype($f);





Question: 45

ID: 87


What is the output of the following code?

                        
function increment (&$val) {
  return $val + 1;
}
$a = 1;
echo increment ($a);
echo increment ($a);





Question: 46

ID: 88


What is the result of the following code?

                        
define('PI', 3.14);
class T {
   const PI = PI;
}
class Math {
   const PI = T::PI;
}
echo Math::PI;





Question: 47

ID: 91


Which string will be returned by the following function call?

                        
$test = '/etc/conf.d/wireless';
substr($test, strrpos($test, '/')); // note that strrpos() is being called, and NOT strpos()





Question: 48

ID: 94


What is the return value of the following code?

                        
strpos("me myself and I", "m", 2);





Question: 49

ID: 99


What method can be used to find the tag <any> via the DOM extension?






Question: 50

ID: 100


How can the id attribute of the 2nd baz element from the XML string below be retrieved from the SimpleXML object found inside $xml?

                        
<?xml version='1.0'?>
<foo>
  <bar>
    <baz id="1">One</baz>
    <baz id="2">Two</baz>
  </bar>
</foo>





Question: 51

ID: 102


In the following code, which classes can be instantiated?

                        
abstract class Graphics {
    abstract function draw($im, $col);
}
abstract class Point1 extends Graphics {
    public $x, $y;
    
    function __construct($x, $y) {
        $this->x = $x;
        $this->y = $y;
    }
    function draw($im, $col) {
        ImageSetPixel($im, $this->x, $this->y, $col);
    }
}     
class Point2 extends Point1 { }
abstract class Point3 extends Point2 { }





Question: 52

ID: 103


The following form is loaded in a recent browser and submitted, with the second select option selected:

                        

<form method="post">
  <select name="list">
    <option>one</option>
    <option>two</option>
    <option>three</option>
  </select>
 </form>
 

In the server-side PHP code to deal with the form data, what is the value of $_POST['list'] ?




Question: 53

ID: 108


What is the output of the following code?

                        
function append($str){
   $str = $str.'append';
}
function prepend(&$str) {
   $str = 'prepend'.$str;
}
$string = 'zce';
append(prepend($string));
echo $string;





Question: 54

ID: 110


What will the following function call print?

                        
printf('%010.6f', 22);





Question: 55

ID: 111


What is the output of the following code?

                        
function fibonacci (&$x1 = 0, &$x2 = 1) {
    $result = $x1 + $x2;
    $x1 = $x2;
    $x2 = $result;
    return $result;
}     
for ($i = 0; $i <10; $i++) {
     echo fibonacci() . ','; 
}





Question: 56

ID: 112


Which of these elements can be encapsulated by namespaces and made accessible from the outside?






Question: 57

ID: 114


What is the output of the following code?

                        
class Test {
   public $var = 1;
}
function addMe(Test $t) {
  $t->var++;
}
$t = new Test();
addMe($t);
echo $t->var;





Question: 58

ID: 116


What super-global should be used to access information about uploaded files via a POST request?






Question: 59

ID: 121


What is the output of the following code?

                        
function increment ($val) {
  $_GET['m'] = (int) $_GET['m'] + 1;
}
$_GET['m'] = 1;
echo $_GET['m'];





Question: 60

ID: 122


The following form is loaded in a browser and submitted, with the checkbox activated:

                        
<form method="post">
  <input type="checkbox" name="accept" /> 
</form>

In the server-side PHP code to deal with the form data, what is the value of $_POST['accept'] ?




Question: 61

ID: 125


Which elements does the array returned by the function pathinfo() contain?






Question: 62

ID: 126


What is the output of the following code?

                        
function ratio ($x1 = 10, $x2) {
     if (isset ($x2)) {
	return $x2 / $x1;
    }
} 
echo ratio (0);





Question: 63

ID: 127


What is the output of the following code?

                        
$text = 'This is text';
$text1 = <<<'TEXT'
$text
TEXT;
$text2 = <<<TEXT
$text1
TEXT; 
echo "$text2";





Question: 64

ID: 131


What information can be used to reliably determine the type of an uploaded file?






Question: 65

ID: 136


You want to allow your users to submit HTML code in a form, which will then be displayed as real code and NOT affect your page layout. Which function do you apply to the text, when displaying it? (Choose 2)






Question: 66

ID: 139


Which of the following functions are used to escape data within the context of HTML? (Choose 2)






Question: 67

ID: 140


Which class of HTTP status codes is used for redirections?






Question: 68

ID: 149


Which MIME type is always sent by a client if a JPEG file is uploaded via HTTP?






Question: 69

ID: 150


What is the output of the following code?

                        
echo '1' . (print '2') + 3;





Question: 70

ID: 151


What will the following code piece print?

                        
echo strtr('Apples and bananas', 'ae', 'ea');





Question: 71

ID: 152


What is the output of the following code?

                        
echo "1" + 2 * "0x02";





Question: 72

ID: 160


What is the result of the following bitwise operation in PHP?

                        
1 ^ 2





Question: 73

ID: 161


You want to access the 3rd character of a string, contained in the variable $test. Which of the following possibilites work? (Choose 2)






Question: 74

ID: 163


Given the following array:

                        
$a = array(28, 15, 77, 43);

Which function will remove the value 28 from $a?




Question: 75

ID: 178


What exception type will catch the error raised by the expression 2 / 0?






Question: 76

ID: 180


What is the difference between "print" and "echo"?






Question: 77

ID: 185


How many elements does the array $pieces contain after the following piece of code has been executed?

                        
$pieces = explode("/", "///");





Question: 78

ID: 186


Which function can NOT help prevent cross-site scripting? (Choose 2)






Question: 79

ID: 189


What is the output of the following code?

                        
$a = 3;
switch ($a) {
   case 1:	echo 'one';
   break;
   case 2:	echo 'two';
   break;
   default:	echo 'four';
   break;
   case 3:	echo 'three';
   break;
}





Question: 80

ID: 190


Consider the following table data and PHP code. What is a possible outcome? Table data (table name "users" with primary key "id"):

                        
  id	name           email
-------------------------------------
  1	anna     alpha@example.com
  2	betty    beta@example.org
  3	clara    gamma@example.net
  5	sue      sigma@example.info
PHP code (assume the PDO connection is correctly established): $dsn = 'mysql:host=localhost;dbname=exam'; $user = 'username'; $pass = '********'; $pdo = new PDO($dsn, $user, $pass); $cmd = "SELECT name, email FROM users LIMIT 1"; $stmt = $pdo->prepare($cmd); $stmt->execute(); $result = $stmt->fetchAll(PDO::FETCH_BOTH); $row = $result[0];





Question: 81

ID: 191


What purpose do namespaces fulfill?






Question: 82

ID: 193


What does the __FILE__ constant contain?






Question: 83

ID: 199


The XML document below has been parsed into $xml via SimpleXML. How can the value of <foo> tag accessed?

                        
<?xml version '1.0'>
<document>
  <bar>
    <foo>Value</foo>
  </bar>
</document>





Question: 84

ID: 204


Consider the following two files. When you run test.php, what would the output look like?

                        
//test.php:
include "MyString.php"; print ","; print strlen("Hello world!"); //MyString.php:
namespace MyFramework\String; function strlen($str) { return \strlen($str)*2; // return double the string length } print strlen("Hello world!");





Question: 85

ID: 205


What is "instanceof" an example of?






Question: 86

ID: 206


Given the default PHP configuration, how can all of the parameters provided via GET be accessed in a form of a string?






Question: 87

ID: 208


What is the output of the following code?

                        
$a = 'a'; 
$b = 'b';
echo isset($c) ? $A.$B.$c : ($c = 'c').'d';





Question: 88

ID: 211


What is the output of the following code?

                        
$first = "second";
$second = "first";
echo $$$first;





Question: 89

ID: 213


Which of the following is NOT a valid function declaration?






Question: 90

ID: 215


Consider the following table data and PHP code. What is the outcome? Table data (table name "users" with primary key "id"):

                        
  id	name            email
-------------------------------------
  1	anna      alpha@example.com
  2	betty     beta@example.org
  3	clara     gamma@example.net
  5	sue       sigma@example.info
PHP code (assume the PDO connection is correctly established): $dsn = 'mysql:host=localhost;dbname=exam'; $user = 'username'; $pass = '********'; $pdo = new PDO($dsn, $user, $pass); try { $cmd = "INSERT INTO users (id, name, email) VALUES (:id, :name, :email)"; $stmt = $pdo->prepare($cmd); $stmt->bindValue('id', 1); $stmt->bindValue('name', 'anna'); $stmt->bindValue('email', 'alpha@example.com'); $stmt->execute(); echo "Success!"; } catch (PDOException $e) { echo "Failure!"; throw $e; }





Question: 91

ID: 222


Which PHP function is used to validate whether the contents of $_FILES['name'] ['tmp_name'] have really been uploaded via HTTP?






Question: 92

ID: 223


What is the output of the following code?

                        
function increment ($val) {
  $val = $val + 1;
}
$val = 1;
increment($val);
echo $val;





Question: 93

ID: 224


What is the result of the following code?

                        
class T {
   const A = 42 + 1;
}
echo T::A;