PHP

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

What character is used to create a variable (placed before variable name) in PHP? Select one: a. @ b. # c. $ d. & e. !

$

Which of the following is NOT a valid variable name in PHP? a. $name5 b. $2tommorrow c. $firstName d. $First_Name

$2tommorrow

Which line of PHP code below correctly creates a variable that stores a string (and without a syntax error/mistake)? (chose best answer) a. name = "Stacey" b. $name = "Stacey"; c. name = Stacey; d. $name = "Stacey"

$name = "Stacey";

What output will this program produce when run on the server? for ($x = 1; $x < 3; $x++) echo "<p>$x</p>"; echo "<p>Next</p>";

1 2 Next

What output will this program produce when it runs? $value = 15.1234598; echo "<p>" . number_format($value,3) . "</p>";

15.123

How many lines of output on a web page will this PHP code produce? for ($x = 1; $x < 8; $x++){echo "<p>$x</p>";} Select one: a. 1 b. 9 c. 8 d. 6 e. 7

7

Which of the following statements is True? Select one: a. Curly braces are never used in an IF ELSEIF ELSE b. Curly braces are needed when there is ONE statement under an IF ELSEIF or ELSE c. Curly braces are needed when there are MANY statement under an IF ELSEIF or ELSE d. Curly braces are always needed to enclose statements under an IF ELSEIF or ELSE

Curly braces are needed when there are MANY statement under an IF ELSEIF or ELSE

What output will this program produce when it runs on the server? for ($x = 1; $x > 0; $x++) { print "<p>$x</p>"; }

It will cause an endless loop to run: 1, 2, 3, etc

Assume that an HTML text input field named "CustomerName" is being passed into a PHP using the GET method and the following was typed into the field: John Smith Given the following two lines of PHP code, what would be the output to the web page? $CustomerName= substr(filter_input(INPUT_GET, 'CustomerName', FILTER_SANITIZE_STRING),0,5); echo $CustomerName; Select one: a. Smith b. John S c. John Smith d. John

John

What output will this program produce when run on the server? for ($x = 1; $x > 2; $x++) echo "<p>$x</p>";

No output will display.

Which of the following statements is True? Select one: a. if you want to validate a PHP at the W3C, you can provide the web server address or upload the file b. You cannot validate at PHP file on the W3C web site c. if you want to validate a PHP at the W3C, you must do so by providing the web server address d. if you want to validate a PHP at the W3C, you can provide the web server address or upload the file, or copy the code into the text box on the W3C web site

if you want to validate a PHP at the W3C, you must do so by providing the web server address

Most lines/commands in PHP end (terminate) with which of the following characters? Select one: a. period b. colon c. comma d. semi-colon

semi-colon

Variable names in PHP are case-sensitive. Select one: True False

True

What will this PHP code produce as output when run on the server? $total = 99; if ($total > 60) echo "<p>Your grade is a D</p>";

Your grade is a D

What output will this PHP program produce when run the server? $total = 99; if ($total >= 90) echo "<p>Your grade is an A</p>";

Your grade is an A

What is the name of the PHP functionality / code that uses the period (.) symbol to join two (or more) things together? For example, echo a string and a date function on one line. Choose best answer. Select one: a. join b. nest c. concatenation d. append e. merge

concatenation

Which of the following PHP lines is valid? Select one: a. echo "<p>Hello /"John/"</p>"; b. echo "<p>Hello "John"</p>"; c. echo "<p>Hello \"John\"</p>"; d. echo "<p>Hello \"John\"</p>"

echo "<p>Hello \"John\"</p>";

Which of the following statements about PHP is NOT TRUE? a. PHP is a programming language. b. PHP is a client-side language c. PHP was created by Rasmus Lerdorf d. PHP is listed in the top 10 of the TIOBE Programming Index (most common languages)

PHP is a client-side language

What output will be produced when this program runs on the server? $total = 99; if ($total >= 70) echo "<p>Your grade is passing</p>"; else ($total > 70) echo "<p>Your grade is not passing</p>";

The program will cause a syntax error.

PHP is free to download and install on your own computer if you want. Select one: True False

True


Set pelajaran terkait

PSYCHOLOGY: Approaches- introspection

View Set

Pharm Chapter 3 Drug Action Across the Life Span

View Set

Radiographic Procedures III Final Review

View Set

Personal Finance Midterm Questions

View Set

Chapter 4: Harmony, Texture, Tonality, and Mode

View Set

The Evolution of Nursing/Lifespan Development

View Set

NUR 300 Sherpath : Electrolytes, Acids and bases, and fluid balance

View Set

Board of Certification questions

View Set