PHP Quiz Results

Feb 16, 2023

PHP Quiz Results

Score: 16 of 25

64% Correct:


Question 1:

What does PHP stand for?

PHP: Hypertext Preprocessor    Your answer  

Private Home Page
Personal Hypertext Processor

Question 2:

PHP server scripts are surrounded by delimiters, which?

<?php…?>    Your answer  

<&>…</&>
<script>…</script>
<?php>…</?>

Question 3:

How do you write “Hello World” in PHP

echo “Hello World”;    Your answer  

“Hello World”;
Document.Write(“Hello World”);

Question 4:

All variables in PHP start with which symbol?

$    Your answer  

!
&

Question 5:

What is the correct way to end a PHP statement?

;    Your answer  

</php>
.
New line

Question 6:

The PHP syntax is most similar to:

JavaScript    Your answer  

Perl and C    Correct answer  
VBScript

Question 7:

How do you get information from a form that is submitted using the “get” method?

$_GET[];    Your answer  

Request.QueryString;
Request.Form;

Question 8:

When using the POST method, variables are displayed in the URL:

True    Your answer  

False    Correct answer  

Question 9:

In PHP you can use both single quotes ( ‘ ‘ ) and double quotes ( ” ” ) for strings:

False    Your answer  

True    Correct answer  

Question 10:

Include files must have the file extension “.inc”

True    Your answer  

False    Correct answer  

Question 11:

What is the correct way to include the file “time.inc” ?

<?php include “time.inc”; ?>    Your answer  

<?php include:”time.inc”; ?>
<!– include file=”time.inc” –>
<?php include file=”time.inc”; ?>

Question 12:

What is the correct way to create a function in PHP?

function myFunction()    Your answer  

create myFunction()
new_function myFunction()

Question 13:

What is the correct way to open the file “time.txt” as readable?

fopen(“time.txt”,”r+”);    Your answer  

fopen(“time.txt”,”r”);    Correct answer  
open(“time.txt”);
open(“time.txt”,”read”);

Question 14:

PHP allows you to send emails directly from a script

True    Your answer  

False

Question 15:

Which superglobal variable holds information about headers, paths, and script locations?

$GLOBALS    Your answer  

$_SESSION
$_SERVER    Correct answer  
$_GET

Question 16:

What is the correct way to add 1 to the $count variable?

$count++;    Your answer  

++count
$count =+1
count++;

Question 17:

What is a correct way to add a comment in PHP?

<!–…–>    Your answer  

/*…*/    Correct answer  
<comment>…</comment>
*\…\*

Question 18:

PHP can be run on Microsoft Windows IIS(Internet Information Server):

True    Your answer  

False

Question 19:

The die() and exit() functions do the exact same thing.

True    Your answer  

False

Question 20:

Which one of these variables has an illegal name?

$my-Var    Your answer  

$my_Var
$myVar

Question 21:

How do you create a cookie in PHP?

setcookie()    Your answer  

createcookie
makecookie()

Question 22:

In PHP, the only way to output text is with echo.

False    Your answer  

True

Question 23:

How do you create an array in PHP?

$cars = array[“Volvo”, “BMW”, “Toyota”];    Your answer  

$cars = “Volvo”, “BMW”, “Toyota”;
$cars = array(“Volvo”, “BMW”, “Toyota”);    Correct answer  

Question 24:

The if statement is used to execute some code only if a specified condition is true

True    Your answer  

False

Question 25:

Which operator is used to check if two values are equal and of same data type?

==    Your answer  

=
!=
===    Correct answer