PHP_Chapter02_ReviewQuestions

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

____	1.	A function definition contains the lines of code that make up a function.

____	2.	Functions are placed within parentheses that follow a parameter name.

____	3.	A function must contain a parameter.

____	4.	Function arguments are the statements that do the actual work of the function and must be contained within the function braces.

____	5.	A function executes automatically.

____	6.	Like variables, function names are case sensitive.

____	7.	A return statement is a statement that returns a value to the statement that called the function.

____	8.	A function must return a value.

____	9.	Variable scope refers to the location that a declared variable can be used.

____	10.	If you attempt to use a local variable outside the function in which it is declared, you receive an error message.

____	11.	The formal parameters within the parentheses of a function declaration are global variables.

____	12.	Global variables are automatically available to all parts of your program, including functions.

____	13.	In PHP, you must declare a global variable with the global keyword inside a function definition for the variable to be available within the scope of that function.

____	14.	Using parentheses to enclose the conditional expression of an if statement is optional.

____	15.	If a command block is missing either the opening or closing brace, an error occurs.

____	16.	The else clause can only be used with an if statement.

____	17.	When one decision-making statement is contained within another decision-making statement, they are referred to as multiple decision-making structures.

____	18.	The switch statement controls program flow by executing a specific set of statements, depending on the value of an expression.

____	19.	The default label contains statements that execute when the value returned by the switch statement expression does not match any case label.

____	20.	To ensure that the while statement will eventually end, you must include code within the body of the while statement that changes the value of the conditional expression.

____	21.	You can use the terminate statement to halt a looping statement and restart the loop with a new iteration.

____	22.	The do...while statement executes a statement or statements once, then repeats the execution as long as a given conditional expression evaluates to TRUE.

____	23.	The statements in a do...while statement always execute repeatedly before the conditional expression evaluates the count variable.

____	24.	The for statement performs essentially the same function as the while statement.

____	25.	One of the primary differences between the while statement and the for statement is that in addition to a conditional expression, the for statement can also include code that initializes a counter and changes its value with each iteration.

____	26.	The for...while statement is used to iterate or loop through the elements in an array.

____	27.	You will not receive an error if you attempt to use a foreach statement with any variable types other than arrays.

____	28.	The primary use of the include and require statements is to reuse content on multiple web pages by allowing you to insert the content of an external file, called an include file, in your PHP scripts.

____	29.	The include statement and the require statement perform the same function and can be used interchangeably.

____	30.	Include statements support only absolute path notation.

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

____	31.	When you use a variable in a PHP program, you must be aware of the variable’s ____.
a.	placement	c.	function	
b.	scope	d.	statement	

____	32.	A variable’s scope can be either global or ____.
a.	local	c.	universal	
b.	undeclared	d.	declared	

____	33.	What will be returned if you use a local variable outside the function in which it is declared?
a.	value	c.	function	
b.	error message	d.	nothing	

____	34.	The parameters within the parentheses of a function declaration are what kind of variables?
a.	local	c.	unknown	
b.	global	d.	declared	

____	35.	With many programming languages, global variables are automatically available to all parts of your program, including ____.
a.	statements	c.	functions	
b.	definitions	d.	declarations	

____	36.	When you declare a global variable with the global keyword, you do not need to assign the variable a(n) ____.  
a.	value	c.	function	
b.	definition	d.	name	

____	37.	A command block is a group of statements within a set of opening and closing ____.
a.	brackets	c.	parentheses	
b.	braces	d.	quotation marks	

____	38.	When one decision-making statement is contained within another decision-making statement it is referred to as a ____ decision-making structure.
a.	enclosed	c.	nested	
b.	contained	d.	layered	

____	39.	Which of the following terms is not associated with the switch statement?
a.	switch title	c.	executable statements	
b.	case label	d.	break keyword	

____	40.	A(n) ____ statement is a control structure that repeatedly executes a statement or series of statements while a specific condition is TRUE or until a specific condition becomes TRUE.
a.	repeat	c.	loop	
b.	replicate	d.	circular	

____	41.	A ____ is a variable that increments or decrements with each iteration of a loop statement
a.	counter	c.	iterator	
b.	incrementer/decrementer	d.	repetitor	

____	42.	If you do not include code that changes the value used the by the condition expression, your program will be caught in a ____ loop.
a.	continuous	c.	constant	
b.	continuing	d.	infinite	

____	43.	A ____ statement is used to iterate or loop through the elements in an array.
a.	for	c.	foreach	
b.	while	d.	if...else	

____	44.	The ____ statement halts the processing of the web page and displays an error if an include file cannot be found.
a.	include	c.	Insert-contents	
b.	insert	d.	require	

____	45.	The ____ file is typically saved with a prefix of inc_.
a.	insert	c.	nested	
b.	include	d.	increment	

PHP_Chapter02_ReviewQuestions
Answer Section

TRUE/FALSE

	1.	REF:	75

	2.	REF:	75

	3.	REF:	76

	4.	REF:	76

	5.	REF:	77

	6.	REF:	78

	7.	REF:	78

	8.	REF:	78

	9.	REF:	82

	10.	REF:	82

	11.	REF:	82

	12.	REF:	82

	13.	REF:	82-83

	14.	REF:	84

	15.	REF:	84

	16.	REF:	88

	17.	REF:	89

	18.	REF:	92

	19.	REF:	93

	20.	REF:	99

	21.	REF:	99

	22.	REF:	100

	23.	REF:	101

	24.	REF:	103

	25.	REF:	103

	26.	REF:	105

	27.	REF:	106

	28.	REF:	109-110

	29.	REF:	110

	30.	REF:	111

MULTIPLE CHOICE

	31.	REF:	82

	32.	REF:	82

	33.	REF:	82

	34.	REF:	82

	35.	REF:	82

	36.	REF:	83

	37.	REF:	84

	38.	REF:	89

	39.	REF:	92

	40.	REF:	96

	41.	REF:	96

	42.	REF:	99

	43.	REF:	105

	44.	REF:	110

	45.	REF:	110