Advanced PHP Quiz

Bonus Question: David's father had three sons: Snap, Crackle, and ?

David

Pop

Gurgle

Peter

Hop


1. Which PHP functions are used to open and close a MYSQL connection?

mysql_open() & mysql_close()

mysql_open() & mysql_disconnect()

mysql_connect() & mysql_close()

mysql_connect() & mysql_disconnect()


2. What data is stored in the $_SERVER['REMOTE_ADDR'] superglobal?

The Server's IP Address

The Visitor's IP Address

The Visitor's Mailing Address

The Visitor's MAC Address


3. Which function will read an opened file one line at a time?

fread()

fgets()

feof()

filesize()


4. The (fill in the blank) must be specified in the header() function before any other output is sent to the browser.

Image-type

Content-type

Header-type


5. Which function will return query results as an enumerated array?

mysql_fetch_array()

mysql_fetch_assoc()

mysql_fetch_lengths()

mysql_fetch_object()

mysql_fetch_row()


6. Why is the use of mysql_real_escape_string() so important?

It Protects Against SQL Injection Attacks

It Escapes Special Characters

It Reduces The Possibility of Malicious Code Being Executed

It Makes User Input Data Harmless When Added Into a Query

All of These Options Are Correct


7. Which image function is used to assign colors?

imagegif()

imagefilltoborder()

imagecreatetruecolor()

imagecreate()

imagecolorallocate()


8. What is the difference between the $_GET[] and $_POST[] superglobals?

$_GET[] Sends Form Data Via the URL and $_POST[] Sends Form Data Behind-the-Scenes

$_POST[] Sends Form Data Via the URL and $_GET[] Sends Form Data Behind-the-Scenes


9. Should checkbox names be unique, or should radio button names be unique?

Checkbox Names Should Be Unique to Each Checkbox (Radio Button Names Should Be Identical)

Radio Button Names Should Be Unique to Each Radio Button (Checkbox Names Should Be Identical)


10. Which function will return the number of rows affected by a query, regardless of the type of query?

mysql_affected_rows()

mysql_num_rows()


Bonus Question: What has one head, one foot and four legs?

A Giraffe

A Centipede

A Bed

A Pumpkin

A Clock


11. The imagecreate() function is used to draw a border around an image.

True

False


12. Which function will return a URL to you in segments?

get_headers()

urldecode()

get_meta_tags()

parse_url()

urlencode()


13. When opening a file with the fopen() function, which option will open a file for writing only, and place the pointer at the end of the file?

r+

w

w+

c

a


14. What is the limit of form data that can be transferred via $_GET[] and $_POST[], respectively?

25 Characters & 2MB

50 Characters & 4MB

100 Characters & 8MB

200 Characters & 16MB

100 Characters & 4MB


15. What is stored in the visitor's browser, can be edited by the visitor and can last years?

Sessions

Segments

Cookies

Cupcakes