Você está na página 1de 15

Variable names may begin with numbers?

Variable names may contain symbols?

Variable names may begin with underscores?

Variable names are case-sensitive?

Data will display in the URL if GET is used?

Data shown in the URL if POST is used?

Arrays may contain arrays?

You are not required to initialize a variable when you first declare it.

What value is assigned to the $ReturnValue variable in the statement $ReturnValue = 100 != 200;?

What value is assigned to the $ReturnValue variable in the statement $ReturnValue = !$x;, assuming
that $x has a value of TRUE?

Decision-making structures cannot be nested.

For statement can only be used with arrays.

String comparison operators and most string comparison functions compare individual characters
according to their ASCII value.

What character must all variables begin with? $

what tag begins a php script?

what tag ends a php script?

What function returns a string's length? strlen()

What function splits each character in a string into an array element? explode()

An if statement can be used to implement a ________________ structure.


(a) selection

(b) sequence

(c) case

(d) logical

What output would be produced by the code below?

$names = array('Ron Burgundy', 'Brick Tamland', 'Champ Kind',

'Veronica Corningstne', 'Brian Fantana');

echo $names[1];

(a) Ron Burgundy

(b) Brick Tamland

(c) Champ Kind

(d) Veronica Corningstone

What does $message contain after the following code executes?

$rate = 0.1;

if ( ! is_numeric($rate) ) {

$message = 'Rate is not a number.';

} else if ($rate < 0) {

$message = 'Rate cannot be less than zero.';

} else if ($rate > 0.2) {


$message = 'Rate cannot be greater than 20%.';

} else {

$message = 'Rate is valid.';

(a) Rate is not a number.

(b) Rate cannot be less than zero.

(c) Rate cannot be greater than 20%.

(d) Rate is valid.

How many radio buttons from the following code can be selected at any given time?

<input type="radio" name="address" value="Home">Home Address

<input type="radio" name="delivery" value="FedEx">Federal Express

<input type="radio" name="delivery" value="UPS">UPS

(a) 0

(b) 1

(c) 2

(d) 3

Which PHP function returns an array with the elements of two or more arrays in one array?

(a) array_merge

(b) array_slice
(c) array_splice

(d) array_fill_both

In order to group multiple radio buttons so that only one of the radio buttons can be selected at a time,
which attribute of the input element must have the same value for all radio buttons in the group?

(a) checked

(b) value

(c) name

(d) id

Suppose an associative array is added to a regular array by these statements:

$cart = array();

$item = array();

$item['itemCode'] = 123;

$item['itemName'] = "Visual Basic 2010";

$item['itemCost'] = 52.5;

$item['itemQuantity'] = 5;

$cart[] = $item;

To refer to the "itemCost" element in the associative array that's within the regular array, you would use
this code:

(a) $cart[0]['itemCost']

(b) $cart['itemCost'][0]
(c) $cart[$item['itemCost']]

(d) $item[$cart['itemCost']]

A switch statement in PHP start by evaluating a switch ________________.

(a) case

(b) expression

(c) return statement

(d) break

Which PHP function can be used to determine if a checkbox is checked?

(a) is_checked

(b) boolean

(c) isset

(d) value

What does $message contain after the following code executes?

$statusCode = "403";

switch ( $statusCode ) {

case "200":

$message = "OK";

break;

case "403":
$message = "Forbidden";

break;

case "404":

$message = "Not Found";

break;

default:

$message = "Unknown Status";

break;

(a) OK

(b) Forbidden

(c) Not Found

(d) Unknown Status

What output would be produced by the code below?

$names = array('Ron Burgundy', 'Brick Tamland', 'Champ Kind',

'Veronica Corningstne', 'Brian Fantana');

echo $names[5];

(a) Ron Burgundy

(b) Veronica Corning stone

(c) Brian Fantana

(d) none of these


Which of the following is the correct syntax for using a conditional operator?

(a) (conditional_expression) ? value_if_true : value_if_false

(b) (conditional_expression) : value_if_true ? value_if_false

(c) (conditional_expression) ? value_if_false : value_if_true

(d) (conditional_expression) : value_if_false ? value_if_true

What is stored in $message by the code that follows?

$message = "The file is in \"C:\\My Documents\"";

(a) The file is in C:\My Documents

(b) The file is in "C:\My Documents"

(c) The file is in C:\\My Documents\

(d) The file is in "C:\\My Documents\"

What will the value of the $totals_string variable be after the following code is executed?

$totals = array(141.95, 212.95, 411, 10.95);

$totals[2] = 312.95;

$totals_string = "";

for ($i = 0; $i < count($totals); $i++) {

$totals_string .= $totals[$i] . "|";

}
(a) 141.95|312.95|411|10.95|

(b) 141.95|212.95|312.95|10.95|

(c) 141.95|212.95|411|312.95|

(d) 10.95|

Which HTML element is used to create a drop-down list?

(a) select

(b) list

(c) drop-down

(d) input

Which attribute of a form element determines how the data is passed to a file?

(a) action

(b) method

(c) submit

(d) default

Suppose an array of country codes and country names is created with a statement like this:

$country_codes = array('DEU' => 'Germany', 'JPN' => 'Japan',

'ARG' => 'Argentina', 'USA' => 'United States');


If you want to use echo statements to display a table of all of the codes and names, you could code
those statements within a loop that starts like this:

(a) foreach ($country_codes as $name[code]) {

(b) foreach ($country_codes as $code => $name) {

(c) for ($country_codes as $name[code]) {

(d) for ($country_codes as $code => $name) {

Suppose that $name contains a last name followed by a comma and a space, followed by a first name.
Then, you can store the first and last names in variables with code like this:

(a) $name = implode(', ', $name);

$last_name = $name[0];

$first_name = $name[1];

(b) $name = implode(', ', $name);

$last_name = $name[1];

$first_name = $name[0];

(c) $name = explode(', ', $name);

$last_name = $name[0];

$first_name = $name[1];
(d) $name = explode(', ', $name);

$last_name = $name[1];

$first_name = $name[0];

Which PHP function returns the number of elements in an array?

(a) count

(b) length

(c) max_index

(d) num_elements

Which of the following can be used in a conditional expression?

(a) equality operators

(b) relational operators

(c) logical operators

(d) all of these

An array that uses strings as indexes in PHP is known as a(n) ________________ array.

(a) non-numeric

(b) associative

(c) illegal

(d) imaginary
A hidden field

(a) appears on the form but its data is hidden

(b) has data that is obscured by bullets or asterisks

(c) doesn't appear on the form but its data is sent to the server

(d) appears on the form with its data grayed out

What does $message contain after the following code executes?

$age = 19;

$score = 750;

if ( $age >= 21 && $score >= 700 ) {

$message = 'Loan approved';

} else if ( $age >= 21 && $score >= 650 ) {

$message = 'Cosigner needed.';

} else if ( $age >= 18 && $score >= 680 ) {

$message = 'Two cosigners needed.';

} else {

$message = 'Loan denied.';

(a) Loan approved.

(b) Cosigner needed.

(c) Two cosigners needed.

(d) Load denied.


Which of the following is a relational operator in PHP?

(a) <

(b) <=

(c) >

(d) all of these

Which HTML element is used to create items in a drop-down list?

(a) list

(b) item

(c) option

(d) value

Which type of input element should be used on a form when the user can select only one of the
options?

(a) checkbox

(b) radio

(c) text

(d) submit

Which PHP function returns the number of characters in the string?

(a) len
(b) strlen

(c) countchars

(d) substr

Assume that the second radio button in the code below has been selected by the user. When you get
the value of that radio button, what will the value be?

<input type="radio" name="delivery" value="USPS">USPS

<input type="radio" name="delivery" value="FedEx">Federal Express

<input type="radio" name="delivery" value="UPS">UPS

(a) FedEx

(b) Federal Express

(c) fedex

(d) federal express

Given the code that follows,

$employees = array();

$employee["name"] = "John Smith";

$employee["age"] = 29;

which of these statements assigns "John Smith is 29" to $message?

(a) $message = $employee[0] . " is " . $employee[1];


(b) $message = $employee[1] . " is " . $employee[2];

(c) $message = $employee["name"] . " is " . $employee["age"];

(d) $message = $employees[0]["name"] . " is " . $employees[0]["age"];

While loops and for loops are often referred to as ________________ structures.

(a) selection

(b) sequence

(c) iteration

(d) ill-advised

What does $message contain after the following code executes?

$message = "L: ";

for ($i = 0; $i < 10; $i++ ) {

$message .= $i . ", ";

if ($i == 7) break;

(a) L: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,

(b) L: 0, 1, 2, 3, 4, 5, 6, 7,

(c) L: 1, 3, 5, 7, 9,

(d) L: 1, 3, 5, 7
Which type of loop will always execute its code at least once?

(a) while

(b) do-while

(c) for

(d) for-in

Which type of statement ends or jumps out of a loop?

(a) break

(b) continue

(c) for

(d) next

Which type of statement ends the current iteration of a loop?

(a) break

(b) continue

(c) switch

(d) conditional

Você também pode gostar