PHP_Chapter04_ReviewQuestions

True/False
Indicate whether the statement is true or false.

____	1.	Autoglobal array elements are referred to with an index number.

____	2.	You must use the global keyword to reference a global variable within the scope of a function.

____	3.	When using the variable name as an index for the $GLOBALS array, you omit the leading dollar sign from the name.

____	4.	The method attribute defines how the form data is submitted to the server.

____	5.	The value of the method attribute will be either post or get.

____	6.	When the form data is submitted using the get method, the form data is appended to the URL specified in the form’s method attribute.

____	7.	When a form’s submit button is pressed, each field on the form is sent to the Web server as a name/value pair.

____	8.	When the post method is used to submit a form, the name portion of the name/value pair becomes the value assigned to the array element.

____	9.	When using the get method to submit form data, the form data is separated from the URL by a colon. (:).

____	10.	The get method restricts the number of characters that can be appended to a URL to 255.

____	11.	PHP includes a feature called magic quotes, which automatically adds a backslash (\) to any single quote, double quote, or NULL character in submitted form data.

____	12.	By default, magic_quotes_gpc is the only magic quote directive enabled in the php.ini configuration file.

____	13.	The alternate method to escape strings is the stripslashes() function.

____	14.	The blank() function can be used to determine if a value was entered in a form.

____	15.	The best way to ensure valid form data is to build the Web form with controls that only allow the user to enter acceptable responses

____	16.	The round() function can be used to ensure that numbers have the appropriate number of digits after the decimal point, if any.

____	17.	Regular expression functions are some of the best tools for verifying string data meets the strict formatting required for email addresses.

____	18.	A good programming practice is to stop processing a form when an error is found and display the error to the user.

____	19.	A sticky form is redisplayed with the values that the user entered the last time the form was submitted.

____	20.	With complex escaping from XHTML, you close one PHP block, insert some XHTML elements, and then open another PHP block to continue the script.

____	21.	In PHP, an e-mail message is sent using the email() function.

____	22.	The subject argument of the mail function must be plain text without XHTML tags or character entities.

____	23.	From, Cc, Bcc and Date headers are examples of additional headers.

____	24.	The mail() function returns a value of TRUE if the message was sent successfully and FALSE if it was not.

____	25.	In an all-in-one form, when the user clicks the submit button, the script submits the form to a separate processing script.

____	26.	The issent() function can be used to determine if the $Submit variable has been set (if the Submit button has been pressed).

____	27.	The unset() function is used to uninitialize a variable after it has been set.

____	28.	The post method is ideal for embedding options in a hyperlink.

____	29.	When using text hyperlinks to navigate within a Web page template, the values that specify which dynamic content to show must be appended to the filename in the “href” attribute of the anchor tag.

____	30.	You cannot use buttons to target content to a dynamic section of a Web page template.

Multiple Choice
Identify the choice that best completes the statement or answers the question.

____	31.	 Autoglobals or superglobals are predefined ____.
a.	variables	c.	arrays	
b.	constants	d.	functions	

____	32.	Autoglobals are associative arrays whose elements are referred to with a(n) ____ key instead of an index number.
a.	numeric	c.	symbolic	
b.	alphanumeric	d.	alphabetic	

____	33.	The $_ENV autoglobal contains ____ variables that programs use to interact with the system.
a.	system	c.	program	
b.	environmental	d.	script	

____	34.	The ____ function displays the elements of the $_ENV array and their values.
a.	env_info()	c.	phpinfo()	
b.	systeminfo()	d.	php_info()	

____	35.	You can use ____ autoglobal array to refer to the global version of a variable from inside a function.
a.	$GLOBALS	c.	$_GLOBALS	
b.	$_GLOBAL	d.	$GLOBAL	

____	36.	The value of the ____ attribute identifies the program on the Web server that will process the form data when the form is submitted.
a.	action	c.	name	
b.	method	d.	id	

____	37.	When you click a form’s submit button, each field on the form is sent to the Web server as a ____ pair.
a.	true/false	c.	variable/value	
b.	name/value	d.	yes/no	

____	38.	When you use the ____ method to submit form data to the processing script, the form data is appended to the URL specified by the action attribute.
a.	get	c.	request	
b.	post	d.	submit	

____	39.	The PHP feature that automatically adds a backslash to any single quote, double quote, or NULL character contained in form data that a user submits to a PHP script is ____.
a.	base quotes	c.	magic quotes	
b.	special quotes	d.	special quotes	

____	40.	The ____ function is used to reverse the changes made by magic quotes or the addslashes() function.
a.	removeslashes()	c.	deleteslashes()	
b.	stripslashes()	d.	addslashes()	

____	41.	The ____ function can be used to determine if a variable contains values.
a.	empty()	c.	is_null()	
b.	blank()	d.	null	

____	42.	The ____ function can be used to ensure that a number has the appropriate number of decimal places.
a.	round()	c.	round_dec()	
b.	set_decimal()	d.	decimal_round()	

____	43.	A  form that contains the values that a user previously entered in the form is called a ____ form.
a.	pre-populated	c.	redisplayed	
b.	free form	d.	sticky	

____	44.	In PHP, a(n) e-mail message is sent using the ____ function.
a.	email()	c.	mail()	
b.	e-mail()	d.	message()	

____	45.	Which of the following is NOT a required argument of the mail() function?
a.	recipient(s)	c.	from	
b.	subject	d.	message	

____	46.	The two simplest forms of the ____ are the plain e-mail address and the recipient’s name followed by the e-mail address in angle brackets.
a.	Address Form	c.	Address Specifier	
b.	Internet Message Format	d.	Message Format	

____	47.	The additional_headers argument needs to be formatted to conform to the syntax of headers in the ____ documentation.
a.	Internet Message Format	c.	Internet Mail Format	
b.	Internet Email Format	d.	Email Message Format	

____	48.	A ____ form contains one page that displays the Web form and one page that process the form data.
a.	two-part	c.	double	
b.	binary	d.	dual	

____	49.	A Web page ____ is a single Web page that is divided into sections
a.	form	c.	guide	
b.	template	d.	fill-in form	

____	50.	PHP scripts that are included in a Web template often begin with a prefix of ____.
a.	tem	c.	pre	
b.	dyn	d.	inc	

____	51.	If the content of a Web page template section does not change unless the include file is modified, it is called a ____ section.
a.	static	c.	include	
b.	dynamic	d.	constant	

____	52.	The script in the dynamic data section of the Web page template will check the value of the ____ array to determine which page to display, assuming the name being passed is ‘page’.
a.	$_GET['page']	c.	$_PAGE['page']	
b.	$_POST['page']	d.	$SUBMIT['page']	

____	53.	When using form image buttons, each button requires a unique ____ for the name attribute..
a.	title	c.	value	
b.	name	d.	id	

____	54.	The ____ autoglobal can be used to access the result from form data sent with both the get and post methods.
a.	$_FILES	c.	$_REQUEST	
b.	$_FORMS	d.	$_SUBMIT	

____	55.	There are security risks using the $_REQUEST autoglobal because it includes the contents of the ____ autoglobal as well as the $_GET and $_POST autoglobals.
a.	$_COOKIES	c.	$_FILES	
b.	$_ENV	d.	$_COOKIE	

PHP_Chapter04_ReviewQuestions
Answer Section

TRUE/FALSE

	1.	REF:	189

	2.	REF:	190

	3.	REF:	191

	4.	REF:	192

	5.	REF:	192

	6.	REF:	192

	7.	REF:	192

	8.	REF:	192

	9.	REF:	192

	10.	REF:	193

	11.	REF:	196

	12.	REF:	196

	13.	REF:	197

	14.	REF:	199

	15.	REF:	199

	16.	REF:	200

	17.	REF:	200

	18.	REF:	201

	19.	REF:	203

	20.	REF:	204

	21.	REF:	206

	22.	REF:	206

	23.	REF:	206

	24.	REF:	207

	25.	REF:	209

	26.	REF:	209

	27.	REF:	209

	28.	REF:	212

	29.	REF:	214

	30.	REF:	214

MULTIPLE CHOICE

	31.	REF:	189

	32.	REF:	189

	33.	REF:	189

	34.	REF:	190

	35.	REF:	190

	36.	REF:	192

	37.	REF:	192

	38.	REF:	192

	39.	REF:	196

	40.	REF:	197

	41.	REF:	199

	42.	REF:	200

	43.	REF:	203

	44.	REF:	206

	45.	REF:	206

	46.	REF:	206

	47.	REF:	206

	48.	REF:	209

	49.	REF:	212

	50.	REF:	213

	51.	REF:	213

	52.	REF:	214

	53.	REF:	214

	54.	REF:	214

	55.	REF:	214