Winter Special 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

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

Options:

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

Buy Now
Questions 5

What is cached by an opcode cache?

Options:

A.

Compiled PHP code

B.

Native PHP extensions

C.

Data sent to the client

D.

Data received from the database

Buy Now
Questions 6

Which of the following items in the $_SERVER superglobal are important for authenticating the client when using HTTP Basic authentication? (Choose 2)

Options:

A.

PHP_AUTH_TYPE

B.

PHP_AUTH_PASSWORD

C.

PHP_AUTH_DIGEST

D.

PHP_AUTH_PW

E.

PHP_AUTH_USER

Buy Now
Questions 7

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

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

Options:

A.

accept

B.

ok

C.

true

D.

on

Buy Now
Questions 8

What will an opcode cache ALWAYS automatically improve?

Options:

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

Buy Now
Questions 9

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

Options:

A.

An XML declaration

B.

A root element

C.

A specified encoding

D.

A reference to either a DTD or an XML schema definition

Buy Now
Questions 10

Given the following DateTime objects, what can you use to compare the two dates and indicate that $date2 is the later of the two dates?

$date1 = new DateTime('2014-02-03');

$date2 = new DateTime('2014-03-02');

Options:

A.

$date2 > $date1

B.

$date2 < $date1

C.

$date1->diff($date2) < 0

D.

$date1->diff($date2) > 0

Buy Now
Questions 11

What will be the result of the following operation?

$a = array_merge([1,2,3] + [4=>1,5,6]);

echo $a[2];

Options:

A.

4

B.

3

C.

2

D.

false

E.

Parse error

Buy Now
Questions 12

Which of the following statements is NOT correct?

Options:

A.

Only methods can have type hints

B.

Typehints can be optional

C.

Typehints can be references

Buy Now
Questions 13

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

Options:

A.

2XX

B.

3XX

C.

4XX

D.

5XX

Buy Now
Questions 14

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 15

What is the output of the following code?

function increment (&$val)

{

return $val + 1;

}

$a = 1;

echo increment ($a);

echo increment ($a);

Options:

Buy Now
Questions 16

Which options do you have in PHP to set the expiry date of a session?

Options:

A.

Set the session.duration directive in php.ini

B.

Set session cookie expiry date locally via session_set_cookie_params()

C.

Set session expiry date locally via session_cache_expire()

D.

None of the above

Buy Now
Questions 17

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

Options:

A.

root, dir, file

B.

dirname, filename, fileextension

C.

dirname, basename, extension

D.

path, file

Buy Now
Questions 18

What will the following function call print?

printf('%010.6f', 22);

Options:

A.

22

B.

22.00

C.

022.000000

D.

22.000000

Buy Now
Questions 19

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
Questions 20

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 21

Given a JSON-encoded string, which code sample correctly indicates how to decode the string to native PHP values?

Options:

A.

$json = new Json($jsonValue); $value = $json->decode();

B.

$value = Json::decode($jsonValue);

C.

$value = json_decode($jsonValue);

D.

$value = Json::fromJson($jsonValue);

Buy Now
Questions 22

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 23

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

Options:

A.

4

B.

5

C.

8

D.

None of the above

Buy Now
Questions 24

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 25

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

Options:

Buy Now
Questions 26

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 27

An unbuffered database query will: (Choose 2)

Options:

A.

Return the first data faster

B.

Return all data faster

C.

Free connection faster for others scripts to use

D.

Use less memory

Buy Now
Questions 28

Which php.ini setting is usually required to use an opcode cache?

Options:

A.

extension

B.

zend_extension

C.

optimizer

D.

dl

Buy Now
Questions 29

What is the name of the header used to require HTTP authentication?

Options:

A.

Authorization-Required

B.

WWW-Authenticate

C.

HTTP-Authenticate

D.

Authentication-Required

E.

HTTP-Auth

Buy Now
Questions 30

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

Options:

A.

getElementById()

B.

getElementsByTagName()

C.

getElementsByTagNameNS()

D.

getElementByName()

E.

findTag()

Buy Now
Questions 31

What is the output of the following code?

class Number {

private $v;

private static $sv = 10;

public function __construct($v) { $this->v = $v; }

public function mul() {

return static function ($x) {

return isset($this) ? $this->v*$x : self::$sv*$x;

};

}

}

$one = new Number(1);

$two = new Number(2);

$double = $two->mul();

$x = Closure::bind($double, null, 'Number');

echo $x(5);

Options:

A.

5

B.

10

C.

50

D.

Fatal error

Buy Now
Questions 32

What can prevent PHP from being able to open a file on the hard drive (Choose 2)?

Options:

A.

File system permissions

B.

File is outside of open_basedir

C.

File is inside the /tmp directory.

D.

PHP is running in CGI mode.

Buy Now
Questions 33

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

Options:

A.

Graphics

B.

Point1

C.

Point2

D.

Point3

E.

None, the code is invalid

Buy Now
Questions 34

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

Options:

A.

$_GET['ALL']

B.

$_SERVER['QUERY']

C.

$_SERVER['QUERY_STRING']

D.

$_ENV['QUERY']

E.

$QUERY_STRING

Buy Now
Questions 35

Transactions should be used to: (Choose 2)

Options:

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

Buy Now
Questions 36

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 37

What is the output of the following code?

$a = 'a'; $b = 'b';

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

Options:

A.

abc

B.

cd

C.

0d

Buy Now
Questions 38

Transactions are used to...

Options:

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

Buy Now
Questions 39

From your PHP application, how can you send the same header twice, but with different values?

Options:

A.

Set the second argument of the header() function to false

B.

PHP does that automatically

C.

You may only send a particular type of header once

D.

Use the header_add() function

Buy Now
Questions 40

Which of the following does NOT help to protect against session hijacking and fixation attacks?

Options:

A.

Use SSL and set the $secure cookie parameter to true .

B.

Set the session.use_only_cookies php.ini parameter to 1 .

C.

Set the session.cookie_lifetime php.ini parameter to 0 .

D.

Protect against XSS vulnerabilities in the application.

E.

Rotate the session id on successful login and logout using session_regenerate_id()

Buy Now
Questions 41

What is the output of the following code?

$first = "second";

$second = "first";

echo $$$first;

Options:

A.

"first"

B.

"second"

C.

an empty string

D.

an error

Buy Now
Questions 42

How many elements does the $matches array contain after the following function call is performed?

preg_match('/^(\d{1,2}([a-z]+))(?:\s*)\S+ (?=201[0-9])/', '21st March 2014', $matches);

Options:

A.

1

B.

2

C.

3

D.

4

Buy Now
Questions 43

Which of the following is correct? (Choose 2)

Options:

A.

A class can extend more than one class.

B.

A class can implement more than one class.

C.

A class can extend more than one interface.

D.

A class can implement more than one interface.

E.

An interface can extend more than one interface.

F.

An interface can implement more than one interface.

Buy Now
Questions 44

What is the return value of the following code: substr_compare("foobar", "bar", 3);

Options:

A.

-1

B.

1

C.

TRUE

D.

0

E.

FALSE

Buy Now
Questions 45

When a query that is supposed to affect rows is executed as part of a transaction, and reports no affected rows, it could mean that: (Choose 2)

Options:

A.

The transaction failed

B.

The transaction affected no lines

C.

The transaction was rolled back

D.

The transaction was committed without error

Buy Now
Questions 46

What is the method used to execute XPath queries in the SimpleXML extension?

Options:

A.

xpathQuery()

B.

xpath()

C.

simpleXMLXpath()

D.

query()

E.

evaluate()

Buy Now
Questions 47

What is the output of the following code?

class a

{

public $val;

}

function renderVal (a $a)

{

if ($a) {

echo $a->val;

}

}

renderVal (null);

Options:

A.

A syntax error in the function declaration line

B.

An error, because null is not an instance of 'a'

C.

Nothing, because a null value is being passed to renderVal()

D.

NULL

Buy Now
Questions 48

What is the preferred method for preventing SQL injection?

Options:

A.

Always using prepared statements for all SQL queries.

B.

Always using the available database-specific escaping functionality on all variables prior to building the SQL query.

C.

Using addslashes() to escape variables to be used in a query.

D.

Using htmlspecialchars() and the available database-specific escaping functionality to escape variables to be used in a query.

Buy Now
Questions 49

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

Options:

A.

parse_url()

B.

url_parse()

C.

get_url_parts()

D.

geturlparts()

Buy Now
Questions 50

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;

}

Options:

A.

one

B.

two

C.

three

D.

four

Buy Now
Questions 51

Which of the following statements about SOAP is NOT true?

Options:

A.

SOAP is also a request-/response-based protocol.

B.

SOAP can be transported using SMTP, HTTP and other protocols.

C.

SOAP requires developers to use WSDL.

D.

SOAP traffic via HTTP can be encrypted and compressed just like other HTTP requests.

Buy Now
Questions 52

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 53

Given the following code, what will the output be:

trait MyTrait {

private $abc = 1;

public function increment() {

$this->abc++;

}

public function getValue() {

return $this->abc;

}

}

class MyClass {

use MyTrait;

public function incrementBy2() {

$this->increment();

$this->abc++;

}

}

$c = new MyClass;

$c->incrementBy2();

var_dump($c->getValue());

Options:

A.

Fatal error: Access to private variable MyTrait::$abc from context MyClass

B.

Notice: Undefined property MyClass::$abc

C.

int(2)

D.

int(3)

E.

NULL

Buy Now
Questions 54

What is the output of the following code?

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

Options:

A.

1

B.

3

C.

5

D.

20

E.

7

Buy Now
Questions 55

The constructs for(), foreach(), and each() can all be used to iterate an object if the object...

Options:

A.

implements ArrayAccess

B.

implements Iterator

C.

implements Iterator and ArrayAccess

D.

None of the above

Buy Now
Questions 56

How many elements does the array $matches from the following code contain?

$str = "The cat sat on the roof of their house.";

$matches = preg_split("/(the)/i", $str, -1, PREG_SPLIT_DELIM_CAPTURE);

Options:

A.

2

B.

3

C.

4

D.

7

E.

9

Buy Now
Questions 57

Please provide the value of the $code variable in the following statement to set an HTTP status code that signifies that the requested resource was not found.

http_response_code($code);

Options:

Buy Now
Questions 58

What will the following code print out?

$str = '✔ one of the following';

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

Options:

A.

Check one of the following

B.

one of the following

C.

✔ one of the following

Buy Now
Questions 59

When a class is defined as final it:

Options:

A.

Can no longer be extended by other classes.

B.

Means methods in the class are not over-loadable.

C.

Cannot be defined as such, final is only applicable to object methods.

D.

Cannot be instantiated.

Buy Now
Questions 60

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 61

An HTML form contains this form element:

The user clicks on the image to submit the form. How can you now access the relative coordinates of the mouse click?

Options:

A.

$_FILES['myImage']['x'] and $_FILES['myImage']['y']

B.

$_POST['myImage']['x'] and $_POST['myImage']['y']

C.

$_POST['myImage.x'] and $_POST['myImage.y']

D.

$_POST['myImage_x'] and $_POST['myImage_y']

Buy Now
Questions 62

What is the length of a string returned by: md5(rand(), TRUE);

Options:

A.

Depends on the value returned by rand() function

B.

32

C.

24

D.

16

E.

64

Buy Now
Questions 63

Which line of code can be used to replace the INSERT comment in order to output "hello"?

class C {

public $ello = 'ello';

public $c;

public $m;

function __construct($y) {

$this->c = static function($f) {

// INSERT LINE OF CODE HERE

};

$this->m = function() {

return "h";

};

}

}

$x = new C("h");

$f = $x->c;

echo $f($x->m);

Options:

A.

return $this->m() . "ello";

B.

return $f() . "ello";

C.

return "h". $this->ello;

D.

return $y . "ello";

Buy Now
Questions 64

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 65

Which of the following is true about stream contexts? (Choose 2)

Options:

A.

A context can modify or enhance the behavior of a stream

B.

A context indicates what session the stream is part of

C.

A context is a set of parameters and stream wrapper specific options

D.

Contexts are created with new Stream_Context();

Buy Now
Questions 66

Which of the following filtering techniques prevents all cross-site scripting (XSS) vulnerabilities?

Options:

A.

Strip all occurrences of the string