INTRODUCTION TO PHP AND MySQL – PHP QUIZ

Q 1

1. / What does PHP stand for?
/ PHP: Hypertext Preprocessor
/ Personal Home Page
/ Private Home Page
/ Personal Hypertext Processor

Q 2

2. / PHP server scripts are surrounded by delimiters, which?
/ <?php…?>
/ <script>...</script>
/ <?php>...</?>
/ >...</>

Q 3

3. / How do you write "Hello World" in PHP
/ "Hello World";
/ Document.Write("Hello World");
/ echo "Hello World";

Q 4

4. / All variables in PHP start with which symbol?
/ $
/ !

Q 5

5. / What is the correct way to end a PHP statement?
/ New line
/ ;
/ .
/ </php>

Q 6

6. / The PHP syntax is most similar to:
/ VBScript
/ JavaScript
/ Perl and C

Q 7

7. / How do you get information from a form that is submitted using the "get" method?
/ Request.QueryString;
/ Request.Form;
/ $_GET[];

Q 8

8. / When using the POST method, variables are displayed in the URL:
/ True
/ False

Q 9

9. / In PHP you can use both single quotes ( ' ' ) and double quotes ( " " ) for strings:
/ True
/ False

Q 10

10. / Include files must have the file extension ".inc"
/ True
/ False

Q 11

11. / What is the correct way to include the file "time.inc" ?
/ <% include file="time.inc" %>
/ <?php include_file("time.inc"); ?>
/ <?php require("time.inc"); ?>
/ <!--include file="time.inc"-->

Q 12

12. / What is the correct way to create a function in PHP?
/ new_function myFunction()
/ create myFunction()
/ function myFunction()

Q 13

13. / What is the correct way to open the file "time.txt" as readable?
/ open("time.txt");
/ fopen("time.txt","r+");
/ fopen("time.txt","r");
/ open("time.txt","read");

Q 14

14. / PHP allows you to send emails directly from a script
/ True
/ False

Q 15

15. / What is the correct way to connect to a MySQL database?
/ dbopen("localhost");
/ connect_mysql("localhost");
/ mysql_open("localhost");
/ mysql_connect("localhost");

Q 16

16. / What is the correct way to add 1 to the $count variable?
/ $count++;
/ $count =+1
/ count++;
/ ++count

Q 17

17. / What is a correct way to add a comment in PHP?
/ *\..\*
/ <!--…-->
/ /*…*/
/ <comment>…</comment>

Q 18

18. / PHP can be run on Microsoft Windows IIS(Internet Information Server):
/ False
/ True

Q 19

19. / In PHP, the die() and exit() functions do the exact same thing.
/ True
/ False

Q 20

20. / Which one of these variables has an illegal name?
/ $my_Var
/ $my-Var
/ $myVar

A - Introduction to PHP and MySQL - PHP Quiz.doc

Page 5 of 5 Version 1