Weekend Special Sale Limited Time 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: buysanta

Exact2Pass Menu

Question # 4

Consider the following code. What can be said about the call to file_get_contents?

$getdata = "foo=bar";

$opts = array('http' =>

array(

'method' => 'POST',

'header' => 'Content-type: application/x-www-form-urlencoded',

'content' => $getdata

)

);

$context = stream_context_create($opts);

$result = file_get_contents('http://example.com/submit.php', false, $context);

A.

A GET request will be performed on http://example.com/submit.php

B.

A POST request will be performed on http://example.com/submit.php

C.

An error will be displayed

Full Access
Question # 5

Which one of the following XML declarations is NOT valid?

A.

B.

C.

D.

Full Access
Question # 6

Which methods can be used to overload object properties? (Choose 2)

A.

set(), get()

B.

__set(), __get()

C.

__put(), __receive(), __exists()

D.

set(), get(), isset()

E.

__isset(), __unset()

Full Access
Question # 7

What is the output of the following code?

function increment ($val)

{

$_GET['m'] = (int) $_GET['m'] + 1;

}

$_GET['m'] = 1;

echo $_GET['m'];

Full Access
Question # 8

When uploading a file to a PHP script using the HTTP PUT method, where would the file data be found?

A.

the $_FILES super-global

B.

the input stream php://input

C.

the $_POST super-global

D.

the global variable scope

Full Access
Question # 9

When would you use classes and when would you use namespaces?

A.

Use classes to encapsulate code and represent objects, and namespaces to avoid symbol name collisions

B.

Use classes for performance-sensitive code, and namespaces when readability matters more

C.

Use namespaces for performance-sensitive code, and classes when readability matters more

D.

Always use them; namespaces are always superior to classes

Full Access
Question # 10

Which of the following PHP values may NOT be encoded to a JavaScript literal using PHP's ext/json capabilities?

A.

'Hello, world!'

B.

function(){ alert("Hello, world!"); }

C.

array('Hello, world!')

D.

array('message' => 'Hello, world!')

Full Access
Question # 11

Transactions are used to...

A.

guarantee high performance

B.

secure data consistency

C.

secure access to the database

D.

reduce the database server overhead

E.

reduce code size in PHP

Full Access
Question # 12

Consider the following code. Which keyword should be used in the line marked with "KEYWORD" instead of "self" to make this code work as intended?

abstract class Base {

protected function __construct() {

}

public static function create() {

return new self(); // KEYWORD

}

abstract function action();

}

class Item extends Base {

public function action() { echo __CLASS__; }

}

$item = Item::create();

$item->action(); // outputs "Item"

Full Access
Question # 13

Transactions should be used to: (Choose 2)

A.

Prevent errors in case of a power outage or a failure in the SQL connection

B.

Ensure that the data is properly formatted

C.

Ensure that either all statements are performed properly, or that none of them are.

D.

Recover from user errors

Full Access
Question # 14

What will an opcode cache ALWAYS automatically improve?

A.

Running time of a loop in a PHP script

B.

Efficiency of HTML markup generated by a PHP script

C.

Execution speed of a PHP script

D.

Memory footprint of a PHP script

E.

None of the above

Full Access
Question # 15

What is the output of this code?

$world = 'world';

echo <<<'TEXT'

hello $world

TEXT;

A.

hello world

B.

hello $world

C.

PHP Parser error

Full Access
Question # 16

What does the __FILE__ constant contain?

A.

The filename of the current script.

B.

The full path to the current script.

C.

The URL of the request made.

D.

The path to the main script.

Full Access
Question # 17

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()

A.

""

B.

"/wireless"

C.

"wireless"

D.

"/conf.d/wireless"

E.

"/etc"

Full Access
Question # 18

PHP's array functions such as array_values() can be used on an object if the object...

A.

implements Traversable

B.

is an instance of ArrayObject

C.

implements ArrayAccess

D.

None of the above

Full Access
Question # 19

Your public web application needs to provide access to binary files for registered users only. How would you achieve this?

A.

Host the files on a public external file sharing service.

B.

Redirect to the file which resides in the server's document root

C.

Use PHP to send the file to the client, using the header() function to set appropriate HTTP headers

D.

PHP is used for service HTML content, not binary content

Full Access
Question # 20

What DOM method is used to load HTML files?

A.

load()

B.

loadXML()

C.

loadHTML()

D.

loadHTMLFile()

Full Access
Question # 21

Which of the following techniques ensures that a value submitted in a form can only be yes or no ?

A.

Use a select list that only lets the user choose between yes and no .

B.

Use a hidden input field that has a value of yes or no .

C.

Enable the safe_mode configuration directive.

D.

None of the above.

Full Access
Question # 22

What is the recommended method of copying data between two opened files?

A.

copy($source_file, $destination_file);

B.

copy($destination_file, $source_file);

C.

stream_copy_to_stream($source_file, $destination_file);

D.

stream_copy_to_stream($destination_file, $source_file);

E.

stream_bucket_prepend($source_file, $destination_file);

Full Access
Question # 23

What will the $array array contain at the end of this script?

function modifyArray (&$array)

{

foreach ($array as &$value)

{

$value = $value + 1;

}

$value = $value + 2;

}

$array = array (1, 2, 3);

modifyArray($array);

A.

2, 3, 4

B.

2, 3, 6

C.

4, 5, 6

D.

1, 2, 3

Full Access
Question # 24

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

Full Access
Question # 25

Which of the following is NOT possible using reflection?

A.

Analysing of nearly any aspect of classes and interfaces

B.

Analysing of nearly any aspect of functions

C.

Adding class methods

D.

Implement dynamic construction (new with variable class name)

Full Access
Question # 26

Which of the following is an invalid DOM save method?

A.

save()

B.

saveFile()

C.

saveXML()

D.

saveHTML()

E.

saveHTMLFile()

Full Access
Question # 27

What will the following code print out?

$str = '✔ one of the following';

echo str_replace('✔', 'Check', $str);

A.

Check one of the following

B.

one of the following

C.

✔ one of the following

Full Access
Question # 28

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

A.

$_POST

B.

$_SESSION

C.

$_GET

D.

$_SERVER

Full Access
Question # 29

What is the output of the following code?

var_dump(boolval(new StdClass()));

A.

bool(true)

B.

bool(false)

Full Access
Question # 30

Before the headers are sent, how can you remove a previously set header?

A.

Use the header_remove() function, providing the name of the header

B.

Use the die() function to abort the PHP script

C.

Not possible

D.

Use the headers_list() function, providing the name of the header as the second argument

Full Access
Question # 31

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

A.

It has to be well-formed.

B.

It has to be valid.

C.

It has to be associated to a DTD.

D.

It may only contain UTF-8 encoded characters.

Full Access
Question # 32

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 { }

A.

Graphics

B.

Point1

C.

Point2

D.

Point3

E.

None, the code is invalid

Full Access
Question # 33

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

A.

A scalar

B.

An expression

C.

A boolean

D.

All of the above

Full Access