Rebecca Walton
Quiz by , created more than 1 year ago

Sanchez, L. (2017). Web Programming with HTML, CSS, Bootstrap, JavaScript, JQuery, PHP, and MySQL . CreateSpace Independent Publishing Platform.

37
0
0
Rebecca Walton
Created by Rebecca Walton almost 5 years ago
Close

Chapter 6: PHP

Question 1 of 16

1

All PHP statements should be surrounded by which delimiters?

Select one of the following:

  • <php> and </php>

  • <script> and ></script>

  • <script><php> and </php></script>

  • <?php and ?>

Explanation

Question 2 of 16

1

A PHP statement is terminated with which symbol?

Select one of the following:

  • <end>

  • .

  • ;

  • ?

Explanation

Question 3 of 16

1

All variables in PHP start with which symbol?

Select one of the following:

  • ?

  • .

  • var

  • $

Explanation

Question 4 of 16

1

In PHP, $content = "<p>Hello World</p>". Write a PHP statement that displays the content on the browser screen.

Select one of the following:

  • display($content);

  • echo$content;

  • echo "Hello World";

  • echo content;

Explanation

Question 5 of 16

1

In PHP, you can use either single quotes ('This is a string') or double quote ("This is a string") for strings.

Select one of the following:

  • true

  • false

Explanation

Question 6 of 16

1

In PHP, which of the following is the correct way to comment a single line?

Select one of the following:

  • <!--This is a line of comment-->

  • <comment>This is a line of comment</comment>

  • <?php This is a line comment?>

  • //This is a line of comment

Explanation

Question 7 of 16

1

In PHP, which of the following is NOT a correct variable name?

Select one of the following:

  • $3val

  • $val3

  • $val_3

  • $val_of_3

Explanation

Question 8 of 16

1

In PHP, how do you add 1 to a variable called $i?

Select one of the following:

  • i++

  • i=+1;

  • ++$i;

  • ++i;

Explanation

Question 9 of 16

1

How does PHP receive the information from an HTML form that is submitted using he "post" method? Suppose in HTML there's a text box <input type="text"name="userinput">

Select one of the following:

  • $_POST["userInput"];

  • $_GET["userInput"];

  • $_USERINPUT();

  • $_GET(userInput);

Explanation

Question 10 of 16

1

When using the get method to submit an HTML form to a PHP file, the variables are displayed in the URL

Select one of the following:

  • true

  • false

Explanation

Question 11 of 16

1

Which of the following is a correct way to create and array in PHP?

Select one of the following:

  • $grades = array (78, 87, 95, 53);

  • $grades = (56, 78, 89, 90);

  • $grades = array ([56], [67], [78], [89]);

  • $grades = {56, 67, 78, 89};

Explanation

Question 12 of 16

1

Write a PHP statement to include a file called "footer.inc"

Select one of the following:

  • <!--include file = "footer.inc"-->

  • <?php include file = "footer.inc";?>

  • <?php include "footer.inc";?>

  • <?php include: "footer.inc;?>

Explanation

Question 13 of 16

1

In PHP, how do you retrieve the content from a file called feedback.txt and store the content in an array call $fileContent?

Select one of the following:

  • $fileContent = "feedback.txt";

  • $fileContent = php_read("feedback.txt");

  • $fileContent = file("feedback.txt");

  • $fileContent = file_read("feedback.txt");

Explanation

Question 14 of 16

1

In PHP file upload in regards to security, which of the following is a true statement?

Select one of the following:

  • Do not allow file uploads

  • It is safe as long as you don't allow .exe file upload

  • It is safe as long as the file size is small

  • It is safe as long as only an account holder can upload a file

Explanation

Question 15 of 16

1

In PHP what will $i+=2 do?

Select one of the following:

  • a typo

  • the value in the variable $i is increased by 2

  • the vriable $i now equals to 2

  • the value in the variable i is increased by 2

Explanation

Question 16 of 16

1

In PHP a session is used so that the server can remember the browser

Select one of the following:

  • true

  • false

Explanation