Title: php Chapter 4
Course: PHP/MySQL Course

Q: What error message do you get if you attempt to use a local variable outside the function in which it is declared?
- True (Correct.)
- False (Incorrect.)
A: True

Q: You must be aware of a variable's ____ when you use it in a PHP program.
- placement (Incorrect.)
- scope (Correct.)
- function (Incorrect.)
- statement (Incorrect.)
A: scope

Q: To declare a global variable within the scope of a function you have to use the ____ keyword.
- local (Incorrect.)
- global (Correct.)
- $_GET (Incorrect.)
- $FUNCTIONS (Incorrect.)
A: global

Q: What is the preferred method attribute value for submitting a form?
- POST (Correct.)
- GET (Incorrect.)
- RETURN (Incorrect.)
- SUBMIT (Incorrect.)
A: POST

Q: You must use what when referring to array elements?
- parentheses ( ) (Incorrect.)
- square brackets [ ] (Correct.)
- semi-colons ; ; (Incorrect.)
- colons :: (Incorrect.)
A: square brackets [ ]

Q: What number does the following code output?

$x = 10;
$y = 12;
if( $x + 4 > 10) {
echo $x - 1;
} else {
echo $y + 1;
}
A: 9

Q: What is the value of $x after this code:

$x = 1;
$y = 10;
while( $y > $x ) {
$x = $x + 1;
$y = $y - $x;
}
A: 4