PHP W3 Quiz
All variables in PHP start with which symbol?
$
How do you get information from a form that is submitted using the "get" method? - Request.QueryString - $_GET[]; - Request.Form;
$_GET[];
Which superglobal variable holds information about headers, paths, and script locations? - $_SESSION - $GLOBALS - $_SERVER - $_GET
$_SERVER
How do you create an array in PHP? - $cars = array("Volvo", "BMW", "Toyota"); - $cars = array["Volvo", "BMW", "Toyota"]; - $cars = "Volvo", "BMW", "Toyota";
$cars = array("Volvo", "BMW", "Toyota");
What is the correct way to add 1 to the $count variable? - count++; - ++count - $count =+ 1 - $count++;
$count++;
Which one of these variables has an illegal name? - $myVar - $my-Var - $my_Var
$my-Var
How do you write "Hello World" in PHP
echo "Hello World";
What is a correct way to add a comment in PHP? - <comment>..</comment> - *\..*\ - <!--..--> - /*..*/
/*...*/
What is the correct way to end a PHP statement? - </php> - new line - ; - .
;
What is the correct way to include the file "time.inc" ? - <!-- include file ="time.inc" --> - <?php include file="time.inc";?> - <?php include "time.inc"; ?>
<?php include "time.inc"; ?>
PHP server scripts are surrounded by delimiters, which? - <script>..</script> - <?php>..</?> - <&>..</&> - <?php..?>
<?php...?>
Which operator is used to check if two values are equal and of same data type? - == - === - != - =
===
(T/F) In PHP, the only way to output text is with echo.
False
(T/F) Include files must have the file extension ".inc"
False
(T/F) When using the POST method, variables are displayed in the URL:
False
What does PHP stand for? - Private Home Page - PHP: Hypertext Preprocessor - Personal Hypertext Processor
PHP: Hypertext Preprocessor
The PHP syntax is most similar to: - VBScript - JavaScript - Perl and C
Perl and C
(T/F) PHP allows you to send emails directly from a script
True
(T/F) PHP can be run on Microsoft Windows IIS(Internet Information Server):
True
(T/F) The die() and exit() functions do the exact same thing.
True
(T/F) The if statement is used to execute some code only if a specified condition is true
True
(T/F)In PHP you can use both single quotes ( ' ' ) and double quotes ( " " ) for strings:
True
What is the correct way to open the file "time.txt" as readable? - fopen("time.txt","r+"); - open("time.txt","read"); - fopen("time.txt","r");
fopen("time.txt","r");
What is the correct way to create a function in PHP? - function myFunction() - create myFunction() - new_function myFunction()
function myFunction()
How do you create a cookie in PHP? - createcookie - makecookie() - setcookie()
setcookie()