Labour Day Sale - Limited Time 60% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: 575363r9

Welcome To DumpsPedia

200-550 Sample Questions Answers

Questions 4

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

Options:

A.

implements Traversable

B.

is an instance of ArrayObject

C.

implements ArrayAccess

D.

None of the above

Buy Now
Questions 5

Which of the following statements is true?

Options:

A.

All PHP database extensions support prepared statements

B.

All PHP database extensions come with their own special helper functions to escape user data to be used in dynamic SQL queries

C.

All PHP database extensions provide an OOP interface

D.

All PHP database extensions appear in the output of php -m , if installed and enabled

Buy Now
Questions 6

An HTML form has two submit buttons. After submitting the form, how can you determine with PHP which button was clicked?

Options:

A.

An HTML form may only have one button.

B.

You cannot determine this with PHP only. You must use JavaScript to add a value to the URL depending on which button has been clicked.

C.

Put the two buttons in different forms, but make sure they have the same name.

D.

Assign name and value attributes to each button and use $_GET or $_POST to find out which button has been clicked.

Buy Now
Questions 7

When retrieving data from URLs, what are valid ways to make sure all file_get_contents calls send a certain user agent string? (Choose 2)

Options:

A.

$default_opts = array('http'=>array('user_agent'=>"My Cool Browser"));

$default = stream_context_set_default($default_opts);

B.

stream_context_set_option("user_agent", "My Cool Browser");

C.

ini_set('user_agent', "My Cool Browser");

D.

stream_context_set_option($context, "http", "user_agent", "My Cool Browser");

Buy Now
Questions 8

What is the output of the following code?

$a = array('a', 'b'=>'c');

echo property_exists((object) $a, 'a')?'true':'false';

echo '-';

echo property_exists((object) $a, 'b')?'true':'false';

Options:

A.

false-false

B.

false-true

C.

true-false

D.

true-true

Buy Now
Questions 9

What content-type is required when sending an HTTP POST using JavaScript to ensure that PHP can access the data?

Options:

A.

application/x-www-form-urlencoded

B.

http/post

C.

text/html

D.

object/multipart-formdata

Buy Now
Questions 10

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

$cmd = "SELECT * FROM users WHERE id = :id";

$stmt = $pdo->prepare($cmd);

$id = 3;

$stmt->bindParam('id', $id);

$stmt->execute();

$stmt->bindColumn(3, $result);

$row = $stmt->fetch(PDO::FETCH_BOUND);

Options:

A.

The database will return no rows.

B.

The value of $row will be an array.

C.

The value of $result will be empty.

D.

The value of $result will be 'gamma@example.net'.

Buy Now
Questions 11

Given the following array:

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

Which function will remove the value 28 from $a?

Options:

A.

array_shift()

B.

array_pop()

C.

array_pull()

D.

array_unshift()

Buy Now
Questions 12

Consider the following table data and PHP code, and assume that the database supports transactions. 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 {

$pdo->exec("INSERT INTO users (id, name, email) VALUES (6, 'bill', 'delta@example.com')");

$pdo->begin();

$pdo->exec("INSERT INTO users (id, name, email) VALUES (7, 'john', 'epsilon@example.com')");

throw new Exception();

} catch (Exception $e) {

$pdo->rollBack();

}

Options:

A.

The user 'bill' will be inserted, but the user 'john' will not be.

B.

Both user 'bill' and user 'john' will be inserted.

C.

Neither user 'bill' nor user 'john' will be inserted.

D.

The user 'bill' will not be inserted, but the user 'john' will be.

Buy Now
Questions 13

What is the output of the following code?

class Base {

protected static function whoami() {

echo "Base ";

}

public static function whoareyou() {

static::whoami();

}

}

class A extends Base {

public static function test() {

Base::whoareyou();

self::whoareyou();

parent::whoareyou();

Options:

A.

:whoareyou();

static::whoareyou();

}

public static function whoami() {

echo "A ";

}

}

class B extends A {

public static function whoami() {

echo "B ";

}

}

B.

:test();

C.

B B B B B

D.

Base A Base A B

E.

Base B B A B

F.

Base B A A B

Buy Now
Questions 14

Given the following code, what is correct?

function f(stdClass &$x = NULL) { $x = 42; }

$z = new stdClass;

f($z);

var_dump($z);

Options:

A.

Error: Typehints cannot be NULL

B.

Error: Typehints cannot be references

C.

Result is NULL

D.

Result is object of type stdClass

E.

Result is 42

Buy Now
Questions 15

Your application uses PHP to accept and process file uploads. It fails to upload a file that is 5 MB in size, although upload_max_filesize is set to "10M". Which of the following configurations could be responsible for this outcome? (Choose 2)

Options:

A.

The PHP configuration option post_max_size is set to a value that is too small

B.

The web server is using an incorrect encoding as part of the HTTP response sent to the client

C.

The browser uses an incorrect encoding as part of the HTTP request sent to the server

D.

The hidden form field MAX_FILE_SIZE was set to a value that is too small

E.

PHP cannot process file uploads larger than 4 MB

Buy Now
Questions 16

An object can be counted with count() and sizeof() if it...

Options:

A.

implements ArrayAccess

B.

has a public __count() method

C.

was cast to an object from an array

D.

None of the above

Buy Now
Questions 17

What is the output of the following code?

class Test {

public function __call($name, $args)

{

call_user_func_array(array('static', "test$name"), $args);

}

public function testS($l) {

echo "$l,";

}

}

class Test2 extends Test {

public function testS($l) {

echo "$l,$l,";

}

}

$test = new Test2();

$test->S('A');

Options:

A.

A,

B.

A,A,

C.

A,A,A,

D.

PHP Warning: call_user_func_array() expects parameter 1 to be a valid callback

Buy Now
Questions 18

Which interfaces could class C implement in order to allow each statement in the following code to work? (Choose 2)

$obj = new C();

foreach ($obj as $x => $y) {

echo $x, $y;

}

Options:

A.

Iterator

B.

ArrayAccess

C.

IteratorAggregate

D.

ArrayObject

Buy Now
Questions 19

Which of the following code snippets DO NOT write the exact content of the file "source.txt" to "target.txt"? (Choose 2)

Options:

A.

file_put_contents("target.txt", fopen("source.txt", "r"));

B.

file_put_contents("target.txt", readfile("source.txt"));

C.

file_put_contents("target.txt", join(file("source.txt"), "\n"));

D.

file_put_contents("target.txt", file_get_contents("source.txt"));

E.

$handle = fopen("target.txt", "w+"); fwrite($handle, file_get_contents("source.txt")); fclose($handle);

Buy Now
Questions 20

Which PHP function is used to validate whether the contents of $_FILES['name']['tmp_name'] have really been uploaded via HTTP, and also save the contents into another folder?

Options:

Buy Now
Questions 21

You'd like to use the class MyDBConnection that's defined in the MyGreatFramework\MyGreatDatabaseAbstractionLayer namespace, but you want to minimize *as much as possible* the length of the class name you have to type. What would you do?

Options:

A.

Import the MyGreatFramework namespace

B.

Import the MyGreatFramework\MyGreatDatabaseAbstractionLayer namespace

C.

Alias MyGreatFramework\MyGreatDatabaseAbstractionLayer\MyDBConnection to a shorter name

D.

Alias MyGreatFramework\MyGreatDatabaseAbstractionLayer to a shorter name

Buy Now
Questions 22

What is the output of the following code?

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

Options:

A.

33 monkeys sit on 11 trees.

B.

51 monkeys sit on 9 trees.

C.

monkeys sit on trees.

D.

0x33 monkeys sit on 011 trees.

Buy Now
Questions 23

Which of the following is NOT a valid function declaration?

Options:

A.

function x ($x1 = array())

B.

function x (A $x1)

C.

function x (A $x1 = null)

D.

function x ($x1 = $x2)

Buy Now
Questions 24

Which of the following statements is NOT true?

Options:

A.

Class constants are public

B.

Class constants are being inherited

C.

Class constants can omit initialization (default to NULL)

D.

Class constants can be initialized by const

Buy Now
Questions 25

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() . ',';

}

Options:

A.

An error

B.

1,1,1,1,1,1,1,1,1,1,

C.

1,1,2,3,5,8,13,21,34,55,

D.

Nothing

Buy Now
Questions 26

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

Options:

Buy Now
Questions 27

What is the output of the following code?

class Foo Implements ArrayAccess {

function offsetExists($k) { return true;}

function offsetGet($k) {return 'a';}

function offsetSet($k, $v) {}

function offsetUnset($k) {}

}

$x = new Foo();

echo array_key_exists('foo', $x)?'true':'false';

Options:

A.

true

B.

false

Buy Now
Questions 28

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

Options:

A.

""

B.

"/wireless"

C.

"wireless"

D.

"/conf.d/wireless"

E.

"/etc"

Buy Now
Questions 29

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

Options:

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

Buy Now
Questions 30

What is the output of the following code?

function increment ($val)

{

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

}

$_GET['m'] = 1;

echo $_GET['m'];

Options:

Buy Now
Questions 31

What is the output of the following code?

function increment ($val)

{

$val = $val + 1;

}

$val = 1;

increment ($val);

echo $val;

Options:

Buy Now
Questions 32

What will be the output value of the following code?

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

while (list(,$v) = each($array));

var_dump(current($array));

Options:

A.

bool(false)

B.

int(3)

C.

int(1)

D.

NULL

E.

Array

Buy Now
Questions 33

Which of the following is NOT true about PHP traits? (Choose 2)

Options:

A.

Multiple traits can be used by a single class.

B.

A trait can implement an interface.

C.

A trait can declare a private variable.

D.

Traits are able to be auto-loaded.

E.

Traits automatically resolve conflicts based on definition order.

Buy Now
Exam Code: 200-550
Exam Name: Zend Certified PHP Engineer
Last Update: May 1, 2024
Questions: 223
$64  $159.99
$48  $119.99
$40  $99.99
buy now 200-550