Question: 1.) With switch blocks if you don't include a break statement then execution continues within in the switch block until the next break statement or

1.)

With switch blocks if you don't include a break statement then execution continues within in the switch block until the next break statement or the end of the block.

True

False

2.)

With a switch statement the structure is set up to compare the variable value or expression in the parentheses of switch(expr) to a case label. If there is a match the code for that case is executed.

True

False

3.)

If an if-statement or loop header has several statements associated with it you must enclose those statements in curly braces.

True

False

4.)

In a switch statement if none of the case labels match the tested variable or expression then the else clause is executed.

True

False

5.)

Assuming you don't use xor how do you test whether one and only one of two variables is zero?

if ($x == 0 and $y != 0 or $y == 0 and $x != 0)

if ($x = 0 or $y = 0)

if ($x == 0 or $y == 0)

if ($x == 0 and $y != 0 and $y == 0 and $x != 0)

6.)

What value of $temp short circuits the $temp <= 100 test in this expression? if ($temp >= 32 and $temp <= 100)

$temp = 0

$temp = 32

$temp = 100

$temp = 75

7.)

Which city is echoed?

$answer = 4; switch($answer) { case 1: echo ""Detroit""; break; case 3: echo ""Chicago""; break; case 5: echo ""Nashville""; break; default: echo ""New York""; }

New York

Chicago

Detroit

Nashville

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!