Php

What does this code output?

`echo 76 <=> '76 trombones';` **_Both sides of the "spaceship" are equal, so the answer is 0. PHP will convert '76 trombones' to 76 in this context, as the string starts with '76'. Try it!_** #

1.

1

2.

-1

3.

a parser error

4.

0

Q 1 / 83

Php

Which is the most secure way to avoid storing a password in clear text in database?

#

1.

`$encrypted = shal($password);`

2.

`$encrypted = crypt($password, $salt);`

3.

`$encrypted = md5($password);`

4.

`$encrypted = password_hash($password, PASSWORD_DEFAULT);`

Q 2 / 83

Php

What does this script do?

php $email = filter_input(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL); if ($email === false) { $emailErr = "Please re-enter valid email"; } #

1.

It makes sure the email address is a good and functioning address

2.

It makes an email safe to input into a database

3.

It assigns an email to a variable and then removes all illegal characters from the $email variable

4.

It verifies that an email address is well formed.

Q 3 / 83

Php

In the following script, which line(s) will cause an error(s)?

1 <?php 2 $count = 0; 3 $_xval = 5; 4 $_yval = 1.0; 5 $some_string = "Hello there!"; 6 $some_string = "How are you?"; 7 $will i work = 6; 8 $3blindmice = 3; 9 ?> #

1.

Line 6 will cause an error because you can't reassign a new value to a variable that has already been set.

2.

Line 7 and 8 will cause an error. Line 7 has whitespace in $will i work and should be $will_i_work. Line 8 cannot start with a number befcause it is a variable.

3.

Line 5 will cause an error because some_string should be someString.

4.

Line 3 and 4 will cause an error because a variable cannot start with an underscore(_).

Q 4 / 83

Php

In a conditional statement, you want to execute the code only if both value are true. Which comparison operator should you use?

#

1.

||

2.

&

3.

<=>

4.

&&

Q 5 / 83

Php

All variables in PHP start with which symbol?

#

1.

&

2.

%

3.

_

4.

$

Q 6 / 83

Php

What is a key difference between GET and POST?

#

1.

GET is used with the HTTP protocol. POST is used with HTTPS.

2.

GET displays the submitted data as part of the URL. During POST, this information is not shown, as it's encoded in the request body.

3.

GET is intended for changing the server state and it carries more data than POST.

4.

GET is more secure than POST and should be used for sensitive information.

Q 7 / 83

Php

The ** operator is useful for sorting operations. It compares two values and returns an integer less than, equal to, or greater than 0 depending on whether the value on the ** is less than, equal to, or greater than the other.

#

1.

greater-than; right

2.

spaceship; left

3.

equality; right

4.

comparison; left

Q 8 / 83

Php

Which are valid PHP error handling keywords?

#

1.

try, throw, catch, callable

2.

try, yield, catch, finally

3.

yield, throw, catch, finally

4.

try, throw, catch, finally

Q 9 / 83

Php

Which value equates to true?

#

1.

0

2.

NULL

3.

''

4.

-1

Q 10 / 83

Php

What is missing from this code, which is supposed to create a test cookies?

php 1 $string_name = "testcookie"; 2 $string_value = "This is a test cookie"; 3 $expiry_info = info()+259200; 4 $string_domain = "localhost.localdomain"; #

1.

The `$_REQUEST` is missing.

2.

The `$_COOKIES` array is missing.

3.

The cookie session is missing.

4.

The call to `setcookie()` is missing.

Q 11 / 83

Php

What is the value of $total in this calculation?

`$total = 2 + 5 * 20 - 6 / 3` #

1.

44

2.

138

3.

126

4.

100

Q 12 / 83

Php

What is the purpose of adding a lowercase "u" as a modifier after the final delimiter in a Perl-compatible regular expression?

#

1.

It makes the dot metacharacter match anything, including newline characters.

2.

It makes the pattern match uppercase letters.

3.

Both the pattern and subject string are treated as UTF-8.

4.

It inverts the greediness of the quantifiers in the pattern so they are not greedy by default.

Q 13 / 83

Php

Which code snippet uses the correct syntax for creating an instance of the Pet class?

#

1.

`$dog = new Pet;`

2.

all of these answers

3.

`$horse = (new Pet);`

4.

`$cat = new Pet();`

Q 14 / 83

Php

What is the best way to explain what this script does?

php 1 if (!$_SESSION['myusername']) 2 { 3 header('locaton: /login.php'); 4 exit; 5 } #

1.

This script times out the session for myusername.

2.

Cookies are starting to be stored as a result of this script.

3.

This script validates the username and password.

4.

This script is on a page that requires the user to be logged in. It checks to see if the user has a valid session.

Q 15 / 83

Php

Which is the correct format for adding a comment to a PHP script?

#

1.

all of these answers

2.

#This is a comment

3.

`/* This is a comment */`

4.

// This is a comment

Q 16 / 83

Php

PHP supports multiple types of loops. If you wanted to loop through a block of code if and as long a specified condition is true, which type of loop would you use?

#

1.

for

2.

do-while

3.

while

4.

foreach

Q 17 / 83

Php

The `ignore_user_abort( )` function sets whether a client disconnect should abort a script execution. In what scenario would you, as a web developer, use this function?

#

1.

You would use it to stop a user from clicking the back button if they decide not to view as a result of a click.

2.

You would use this function if you have some important processing to do and you do not want to stop it, even if your users click Cancel.

3.

You would use this function if you wanted to abort the script for all logged-in users, not just the one who disconnected.

4.

You would use this function if you want a PHP script to run forever.

Q 18 / 83

Php

The PHP function array_reduce() takes a callback function that accepts a value carried over each iteration and the current item in the array, and reduces an array to a single value. Which code sample will sum and output the values in the provided array?

php 1 <?php 2 echo array_reduce([1, 2, 5, 10, 11], function ($item, $carry) { 3 $carry = $carry + $item; 4 }); 5?> php 1 <?php 2 echo array_reduce([1, 2, 5, 10, 11], function ($carry, $item) { 3 return $carry = $item + $item; 4 }); 5?> php 1 <?php 2 array_reduce([11 2, 5, 10, 11], function ($item, $carry) { 3 echo $carry + $item; 4 }); 5?> php 1 <?php 2 echo array_reduce([1, 2, 5, 10, 11], function ($carry, $item) { 3 return $carry += $item; 4 }); 5?> #

1.

php 1 <?php 2 echo array_reduce([1, 2, 5, 10, 11], function ($item, $carry) { 3 $carry = $carry + $item; 4 }); 5?>

2.

php 1 <?php 2 echo array_reduce([1, 2, 5, 10, 11], function ($carry, $item) { 3 return $carry = $item + $item; 4 }); 5?>

3.

php 1 <?php 2 array_reduce([11 2, 5, 10, 11], function ($item, $carry) { 3 echo $carry + $item; 4 }); 5?>

4.

php 1 <?php 2 echo array_reduce([1, 2, 5, 10, 11], function ($carry, $item) { 3 return $carry += $item; 4 }); 5?>

Q 19 / 83

Php

Which PHP script uses a constructor to display the string "Winter is almost over!"?

php 1 class MyClass { 2 public function _construct() 3 { 4 echo 'Winter is almost over!'."n"; 5 } 6 } 7 $userclass = new MyClass; php 1 class MyClass { 2 public function _construct() 3 { 4 echo 'Winter is almost over!.."n"; 5 } 6 } 7 $userclass = new MyClass; php 1 class MyClass { 2 public function _construct() 3 { 4 echo 'Winter is almost over!.."n"; 5 } 6 } 7 $userclass = new MyClass; php 1 class MyClass { 2 public function _construct() 3 { 4 echo 'Winter is almost over!'."n"; 5 } 6 } 7 $userclass = MyClass; #

1.

php 1 class MyClass { 2 public function _construct() 3 { 4 echo 'Winter is almost over!'."n"; 5 } 6 } 7 $userclass = new MyClass;

2.

php 1 class MyClass { 2 public function _construct() 3 { 4 echo 'Winter is almost over!.."n"; 5 } 6 } 7 $userclass = new MyClass;

3.

php 1 class MyClass { 2 public function _construct() 3 { 4 echo 'Winter is almost over!.."n"; 5 } 6 } 7 $userclass = new MyClass;

4.

php 1 class MyClass { 2 public function _construct() 3 { 4 echo 'Winter is almost over!'."n"; 5 } 6 } 7 $userclass = MyClass;

Q 20 / 83

Php

How might you troubleshoot a "call to undefined function" error?

#

1.

Make sure you have imported the file containing the function.

2.

Make sure you have spelled the function name correctly.

3.

all of these answers

4.

Make sure the function declaration is at an earlier point in the code than the function call.

Q 21 / 83

Php

Which line could you NOT use to comment out "Space: the final frontier"?

#

1.

`/* Space: the final frontier */`

2.

`*/ Space: the final frontier /*`

3.

`#Space: the final frontier`

4.

`// Space: the final frontier`

Q 22 / 83

Php

What displays in a browser when the following code is written? `<?php echo "How much are the bananas?"?>`

#

1.

The browser would display nothing due to a syntax error.

2.

The browser would display an error, since there are no parentheses around the string.

3.

The browser would display `How much are the bananas?`

4.

The browser would display an error, since there is no semicolon at the end of the echo command.

Q 23 / 83

Php

Which operator would you use to find the remainder after division?

#

1.

/

2.

%

3.

//

4.

DIV

Q 24 / 83

Php

What is the significance of the three dots in this function signature?

php function process(...$vals) { // do some processing } #

1.

It makes the function variadic, allowing it to accept as an argument an array containing an arbitrary number of values.

2.

It makes the function variadic, allowing it to accept an arbitrary number of arguments that are converted into an array inside the function.

3.

It temporarily disables the function while debugging other parts of the script.

4.

It's a placeholder like a TO DO reminder that automatically triggers a notice when you run a script before completing the function definition.

Q 25 / 83

Php

Assuming the `Horse` class exists, which is a valid example of inheritance in PHP?

#

1.

`class Pegasus extends Horse {}`

2.

`class Alicorn imports Pegasus, Unicorn {}`

3.

`class Unicorn implements Horse {}`

4.

`class Horse inherits Unicorn {}`

Q 26 / 83

Php

Both triple === and double == can be used to ** variables in php. If you want to hear that string "33" and the number 33 are equal, you would use ** . If you want to check if an array contains a particular string value at a particular index, you would use _

#

1.

compare; doubles; triples

2.

compare; triples; doubles

3.

assign; triples; doubles

4.

assign; doubles; triples

Q 27 / 83

Php

Your php page is unexpectedly rendering as totally blank. Which step will shed light on the problem?

#

1.

Add this code to the top of your script: `ini_set('display_errors',1);`

2.

check the server error logged

3.

all of these answers

4.

make sure you are not missing any semicolons

Q 28 / 83

Php

Which is the way to create an array of "seasons"?

seasons=array( 1=>'spring', 2=>'summer', 3=>'autumn', 4=>'winter', ); #

1.

seasons=array( 1=>'spring', 2=>'summer', 3=>'autumn', 4=>'winter', );

Q 29 / 83

Php

Both `self` and `this` are keywords that can be used to refer to member variables of an enclosing class. The difference is that `$this->member` should be used for ** members and `self::$member` should be used for ** members.

#

1.

private, public

2.

object,primitive

3.

non-static,static

4.

concrete,abstract

Q 30 / 83

Php

What will this code print?

php $mathe=array('archi','euler','pythagoras'); array_push($mathe,'hypatia'); array_push($mathe,'fibonacci'); array_pop($mathe); echo array_pop($mathe); echo sizeof($mathe); #

1.

euler3

2.

hypatia5

3.

hypatia3

4.

fibonacci4

Q 31 / 83

Php

You are using the following code to find a users band, but it is returning false. Which step(s) would solve the problem?

`isset ($_GET['fav_band'])` #

1.

check if `fav_band` is included in the query string at the top of your browser

2.

all of the answers

3.

view the source of form and make sure there is an input field with the name 'fav_band'

4.

print everything that has been transmitted in the request: `print_r($_REQUEST);`

Q 32 / 83

Php

Which code would you use to print all the elements in an array called `$cupcakes`?

#

1.

all of the answers

2.

`print_r($cupcakes);`

3.

`var_dump($cupcakes);`

4.

`foreach($cupcakes as &$cupcake) echo $cupcake;`

Q 33 / 83

Php

What is the cause of 'Cannot modify header information - headers already sent'?

#

1.

You are trying to modify a private value

2.

Semicolon missing

3.

Using a key on an array that does not exists

4.

Some html is being sent before a `header()` command that you are using for a redirect

Q 34 / 83

Php

Which php control structure is used inside a loop to skip the rest of the current loops code and go back to the start of the loop for the next iteration

#

1.

`else`

2.

`break`

3.

`return`

4.

`continue`

Q 35 / 83

Php

The php not operator is !. Given the snippet, is there an out put and what is it?

#

1.

there is an output '2 is an even number

2.

output '21 is an odd number'

3.

no output. Syntax error do to missing semicolon at the end

4.

no output due to % in $num%2!=0

Q 36 / 83

Php

You want to list the modules available in your PHP installation. What command should you run?

#

1.

`php -h`

2.

`php info`

3.

`php -v`

4.

`php -m`

Q 37 / 83

Php

For the HTML form below, what is the correct functioning script that checks the input "mail" to be sure it is filled before proceeding?

php if (!empty($_POST["mail"])) { echo "Yes, mail is set"; } else { echo "No, mail is not set"; } (correct) #

Q 38 / 83

Php

What is the value of `$result` in this calculation?

`$result = 25 % 6;` #

1.

4.167

2.

1.5

3.

4

4.

1

Q 39 / 83

Php

What is the job of the controller as a component in MVC?

#

1.

The controller handles data passed to it by the view, and also passes data to the view. It interprets data sent by the view and disperses that data to the approrpiate models awaiting results to pass back to the view.

2.

The controller is a mechanism that allows you to create reusable code in languages such as PHP, where multiple inheritance is not supported.

3.

The controller presents content through the user interface, after communicating directly with the database.

4.

The controller handles specific tasks related to a specific area of functionality, handles business logic related to the results, and communicates directly with the database.

Q 40 / 83

Php

Why does this code trigger an error?

`$string = 'Shylock in a Shakespeare's "Merchant of Venice" demands his pound of flesh.';` #

1.

Strings should always be wrapped in double quotes; and double quotes inside a string should be escaped by backslashes.

2.

All single and double quotes inside a string need to be escaped by backslashes to prevent a parse error.

3.

The opening and closing single quotes should be replaced by double quotes; and the apostrophe should be escaped by a backslash.

4.

The apostrophe needs to be escaped by a backslash to prevent it from being treated as the closing quote.

Q 41 / 83

Php

A PDO object called `$db` has been set up to use for database operations, including user authentication. All user-related properties are set. The script line `public function __construct(&$db)` shows a constructor that initializes all user-related properties to _ if no user has logged in. These parameters will be properly set by the login functions when a user logs in.

#

1.

NULL

2.

TRUE

3.

FALSE

4.

0

Q 42 / 83

Php

Assuming that `$first_name` and `$family_name` are valid strings, which statement is invalid?

#

1.

`echo $first_name. ' '. $family_name;`

2.

`print $first_name, ' ', $family_name;`

3.

`print $first_name. ' '. $family_name;`

4.

`echo $first_name, ' ', $family_name;`

Q 43 / 83

Php

Which code snippet demonstrates encapsulation?

php class Cow extends Animal { private $milk; } php class Cow { public $milk; } $daisy = new Cow(); $daisy->milk = "creamy"; php class Cow { public $milk; function getMilk() {` return $this->milk; } } php class Cow { private $milk; public function getMilk() { return $this->milk; } } #

1.

php class Cow extends Animal { private $milk; }

2.

php class Cow { public $milk; } $daisy = new Cow(); $daisy->milk = "creamy";

3.

php class Cow { public $milk; function getMilk() {` return $this->milk; } }

4.

php class Cow { private $milk; public function getMilk() { return $this->milk; } }

Q 44 / 83

Php

The following XML document is in books.xml. Which code will output "Historical"?

xml <books> <book> <title>A Tale of Two Cities</title> <author>Charles Dickens</author> <categories> <category>Classics</category> <category>Historical</category> </categories> </book> <book> <title>Then There Were None</title> <author>Agatha Christies</author> <categories> <category>Mystery</category> </categories> </book> </books> php $books = simplexml_load_string('books.xml'); echo $books->book[0]->categories->category[1]; php $books = simplexml_load_file('books.xml'); echo $books->book[0]->categories->category[1]; php $books = SimpleXMLElement('books.xml'); echo $books->book[0]->categories->category[1]; php $books = SimpleXML('books.xml'); echo $books->book[0]->categories->category[1]; #

1.

php $books = simplexml_load_string('books.xml'); echo $books->book[0]->categories->category[1];

2.

php $books = simplexml_load_file('books.xml'); echo $books->book[0]->categories->category[1];

3.

php $books = SimpleXMLElement('books.xml'); echo $books->book[0]->categories->category[1];

4.

php $books = SimpleXML('books.xml'); echo $books->book[0]->categories->category[1];

Q 45 / 83

Php

When it comes to the value of a variable, what is the difference between NULL and empty?

#

1.

NULL is a blank value; empty is the lack of a value.

2.

A NULL value has an allocated address in memory; empty does not.

3.

NULL referes to the lack of a value for an integer; empty refers to the lack of a value for a string.

4.

NULL is the lack of a value; empty is a blank value.

Q 46 / 83

Php

What would be a good name for this function?

php function doStuff($haystack, $needle) { $length = strlen($needle) if (substr($haystack, 0, $length) == $needle) return true; else return false; } #

1.

`equals`

2.

`endsWith`

3.

`startsWith`

4.

`contains`

Q 47 / 83

Php

If you want to pass a formfield to another page when a button is clicked, you should use the ** . If you want to store information across multiple pages, you should use the ** ?

#

1.

request; response

2.

response; request

3.

session; request

4.

request; session

Q 48 / 83

Php

You are using the following code to decide if a button is clicked, but it is never returning true. Which step is most likely to shed light on the problem?

php isset($_POST['submit']) #

1.

Make sure the input field displaying the button is named 'submit'

2.

Make sure you are not missing any semicolons

3.

Print everything in the session `print_r($_SESSION);`

4.

Look in the query string at the top of your browser to see if submit is assigned a value

Q 49 / 83

Php

Why should you follow a PSR standard?

#

1.

because coding standards often vary between developers and companies

2.

because coding standards are monitored for compliance across developers and companies

3.

because there are mandatory coding standards among developers and companies

4.

if using certain platforms, because the PSR's apply to those platforms only

Q 50 / 83

Php

What are getters and setters?

1.

Getters and setters ensure that if a data member is declared private, then it can be accessed only within the same function, not by an outside class

2.

Getters and setters are utility functions within PHP that allow loading from, and saving to, a database

3.

Getters and setters encapsulate the fields of a class by making them acccessible only through its private methods, and keep the values themselves public

4.

Getters and setters are methods used to declare or obtain the values of variables, usually private ones

Q 51 / 83

Php

What are the recommended settings in the PHP configuration file, php.ini, for a testing environment?

php report_errors = E_ALL display_errors = On php error_reporting = E_ALL display_errors = On php error_reporting = E_ALL & ~E_NOTICE display_errors = Off php error_reporting = E_ALL & ~E_NOTICE display_errors = On

1.

php report_errors = E_ALL display_errors = On

2.

php error_reporting = E_ALL display_errors = On

3.

php error_reporting = E_ALL & ~E_NOTICE display_errors = Off

4.

php error_reporting = E_ALL & ~E_NOTICE display_errors = On

Q 52 / 83

Php

Which PHP variable name is invalid?

1.

`$Double`

2.

`$double`

3.

`$_2times`

4.

`$2times`

Q 53 / 83

Php

Which command will extract the domain suffix ("com") from the string `$string = "https://cat-bounce.com";`?

1.

`sub($string, -3)`

2.

`substr($string, -3)`

3.

`substr($string, 3)`

4.

`$string.substr(-3)`

Q 54 / 83

Php

Where is PHP code executed?

1.

in the client's browser

2.

in the virtual machine

3.

in the memory of the computer viewing the webpage

4.

on a web server

Q 55 / 83

Php

Which is not a valid magic constant?

#

1.

`__RESOURCE__`

2.

`__FUNCTION__`

3.

`__CLASS__`

4.

`__TRAIT__`

Q 56 / 83

Php

What below script will print?

php if( 1 == true){ echo "1"; } if( 1 === true){ echo "2"; } if("php" == true){ echo "3"; } if("php" === false){ echo "4"; } #

1.

134

2.

13

3.

1

4.

123

Q 57 / 83

Php

undefined

php $secret_word = 'if i ate spinach'; setcookie('login', $_REQUEST['username']. ','. md5($_REQUEST['username'].$secret_word)); #

1.

when a user goes to pay for an item online

2.

when items are placed in a cart

3.

at first registration

4.

at every login, for security

Q 58 / 83

Php

undefined

php Cat Dog Dog $name = "Cat"; $name = "Dog"; echo $name . "<br/>"; echo $$name . "<br/>"; echo $Dog; $name = "Cat"; $$name = "Dog"; echo $name . "<br/>"; echo $$name . "<br/>"; echo $Dog; $name = "Cat"; $$name = "Dog"; echo $name . "<br/>"; echo $$name . "<br/>"; echo $Cat; $name = "Cat"; $$name = "Dog"; echo $name . "<br/>"; echo $name . "<br/>"; echo $Cat; #

1.

```php

2.

```php

3.

```php

4.

```php

Q 59 / 83

Php

undefined

#

1.

router

2.

controller

3.

model

4.

view

Q 60 / 83

Php

undefined

1 <?php 2 start_session(); 3 $music = $_SESSION['music']; 4 ?> 1 <?php 2 session_start(); 3 $music = $SESSION['music']; 4 ?> 1 <?php 2 start_session(); 3 $music =$session['music']; 4 ?> 1 <?php 2 session_start(); 3 $music = $_SESSION['music']; 4 ?> #

1.

```php

2.

```php

3.

```php

4.

```php

Q 61 / 83

Php

undefined

1 <?php 2 $dates = array('2018-02-01', '2017-02-02', '2015-02-03'); 3 echo "Latest Date: ". max($dates)."n"; 4 echo "Earliest Date: ". min($dates)."n"; 5 ?> 1 <?php 2 $dates = array('2018-02-01', '2017-02-02', '2015-02-03'); 3 echo "Latest Date: ". min($dates)."n"; 4 echo "Earliest Date: ". max($dates)."n"; 5 ?> 1 <?php 2 $dates = array('2018-02-01', '2017-02-02', '2015-02-03'); 3 echo "Latest Date: ". ($dates)."n"; 4 echo "Earliest Date: ". ($dates)."n"; 5 ?> 1 <?php 2 $dates = array('2018-02-01', '2017-02-02', '2015-02-03'); 3 echo "Latest Date: " max($dates)."n"; 4 echo "Earliest Date: " min($dates)."n"; 5 ?> #

1.

```php

2.

```php

3.

```php

4.

```php

Q 62 / 83

Php

undefined

php 1 $kilometers = 1; 2 for (;;) { 3 if ($kilometers > 5) break; 4 echo "$kilometers kilometers = ".$kilometers*0.62140. " miles. <br />"; 5 $kilometers++; 6 } 1 kilometers = 0.6214 miles. 2 kilometers = 1.2428 miles. 3 kilometers = 1.8642 miles. 4 kilometers = 2.4856 miles. 5 kilometers = 3.107 miles. 1 kilometers = 0.6214 miles. 2 kilometers = 1.2428 miles. 3 kilometers = 1.8642 miles 4 kilometers = 2.4856 miles. 5 kilometers = 3.107 miles. 6 kilometers = 3.7284 miles. 2 kilometers = 1.2428 miles. 3 kilometers = 1.8642 miles. 4 kilometers = 2.4856 miles. 5 kilometers = 3.107 miles. #

1.

```php

2.

```php

3.

```php

4.

FATAL ERROR syntax error, unexpected ')', expecting ';' on line number 2

Q 63 / 83

Php

undefined

#

1.

use myAppmyNamespace{ClassA, ClassB, ClassC};

2.

use myAppmyNamespaceClassA, ClassB, ClassC;

3.

use myAppmyNamespace[ClassA, ClassB, ClassC];

4.

use myAppmyNamespace(ClassA, ClassB, ClassC);

Q 64 / 83

Php

undefined

#

1.

string, integer, float, boolean, array, object, NULL, resource

2.

string, integer, boolean, array, object, NULL, resource

3.

string, integer, float, array, object, NULL, resource

4.

string, integer, float, boolean, array, object, NULL

Q 65 / 83

Php

undefined

#

1.

server-side scripting language

2.

compiled language

3.

machine language

4.

algorithmic language

Q 66 / 83

Php

undefined

1.

`$_SERVER`

2.

`$SERVER_VARIABLES`

3.

`$_ENV`

4.

`$GLOBALS`

Q 67 / 83

Php

undefined

`1 $capitals = ['UK' => 'London', 'France' => 'Paris'];` `2 echo "$capitals['france'] is the capital of France.";` **_Also, 'france' key must be capitalized!_**

1.

It displays: "Paris is the capital of France."

2.

It displays: " is the capital of France."

3.

It triggers a syntax error because the array keys on line 1 are in quotes.

4.

It triggers a syntax error because the array key on line 2 is in quotes.

Q 68 / 83

Php

undefined

1.

inheritance

2.

classes

3.

namespacing

4.

dependency injection

Q 69 / 83

Php

undefined

**_Both 2 and 4 are correct!_**

1.

`$HTTP_SERVER_VARS("REMOTE_IP")`

2.

`$_SESSION["REMOTE_ADDR"];`

3.

`$_SERVER["HTTP_X_FORWARDED_FOR"]`

4.

`getenv("REMOTE_ADDR")`

Q 70 / 83

Php

undefined

1.

Make sure the user has the proper permissions.

2.

Keep a count of upload file sizes and log them.

3.

Change the `upload_max_filesize` configuration parameter.

4.

Be sure to use chunked transfer encoding.

Q 71 / 83

Php

undefined

`1 $my_text = 'The quick grey [squirrel].';` `2 preg_match('#[(.*?)]#', $my_text, $match);` `3 print $match[1]."n";`

1.

squirrel

2.

The quick grey [squirrel].

3.

[squirrel]

4.

The quick grey squirrel.

Q 72 / 83

Php

undefined

`$fruits = ['apple', 'orange', 'pear', 'mango', 'papaya'];` `$i = 0;` `echo $fruits[$i+=3];`

1.

mango

2.

apple

3.

a parse error

4.

pear

Q 73 / 83

Php

undefined

1.

notices, warnings, fatal

2.

runtime, logical, compile

3.

semantic, logical, syntax

4.

warnings, syntax, compile

Q 74 / 83

Php

undefined

1.

`<!-- include file="gravy.php"; -->`

2.

`<?php include gravy.php; ?>`

3.

`<?php include "gravy.php"; ?>`

4.

`<?php include file="gravy.php"; ?>`

Q 75 / 83

Php

undefined

1.

`session_start()` and `filter_input()`

2.

`filter_var()` and `filter_input()`

3.

`preg_match()` and `strstr()`

Q 76 / 83

Php

undefined

1.

Doing so makes your code tightly coupled.

2.

The attribute may be accessed only by the class that defines the member.

3.

You will have no control over which values the attribute can take. Any external code will be able to change it without any constraint.

4.

You can then access the attribute only within the class itself, and by inheriting and parent classes.

Q 77 / 83

Php

undefined

1.

`$statement->bindValue(':name', '%' . $_GET['name'

2.

`$statement->bindValue('%' . $_GET['name'

3.

`$statement->bindParam(':name', '%' . $_GET['name'

4.

`$statement->bindParam('%' . $_GET['name'

Q 78 / 83

Php

undefined

`$array1 = ['country', 'capital', 'language'];` `$array2 = ['France', 'Paris', 'French'];`

1.

`$array3 = array_merge($array1, $array2);`

2.

`$array3 = array_union($array1, $array2);`

3.

`$array3 = array_keys($array1, $array2);`

4.

`$array3 = array_combine($array1, $array2);`

Q 79 / 83

Php

undefined

1.

`printf('#%2x%2x%2x', 255, 0, 0);`

2.

`printf('#%2X%2X%2X', $r, 0, 0);`

3.

`printf('#%x%x%x', 255, 0, 0);`

4.

`printf('#%02x%02x%02x', 255, 0, 0);`

Q 80 / 83

Php

undefined

`$twelfth_night = $xmas->add(new DateInterval('P12D'));` `echo $twelfth_night->format('l');` `echo date('d', $twelfth_night);` `echo strftime('%d', $twelfth_night);` `$twelfth_night = $xmas->add(strtotime('12 days'));` `echo $twelfth_night->format('D');` **_1 seems correct, but the question asks for "day", not day of the week. Twelfth Night is the "06" day of January, 2019._**

1.

`$xmas = new DateTime('Dec 25, 2018');`

2.

`$twelfth_night = strtotime('December 25, 2018 + 12 days');`

3.

`$twelfth_night = strtotime('December 25, 2018 + 12 days');`

4.

`$xmas = new DateTime('Dec 25, 2018');`

Q 81 / 83

Php

undefined

`while ($i < 10) {` `echo $i++ . '<br/>';` `}` `while ($i <= 10) {` ` echo $i++ . '<br/>';` `}` ` echo ++$i . '<br/>';` `}` `while ($i < 10) {` ` echo ++$i . '<br/>';` `}`

1.

`$i = 1;`

2.

`$i = 0;`

3.

`while ($i &lt;= 10) {`

4.

`$i = 0;`

Q 82 / 83

Php

undefined

1.

`break`, `continue`, `do-while`, `exception`, `for`, `foreach`, `if`, `switch`, `throw`, `while`

2.

`values`, `operators`, `expressions`, `keywords`, `comments`

3.

`for`, `foreach`, `if`, `else`, `else if`, `switch`, `tries`, `throws`, `while`

4.

`if-then-else`, `do-while`, `for-each`, `go-to`, `stop-when`

Q 83 / 83