What is the value of $m after this runs? $x = 0; $m = $x++; 0 1 2 2 points QUEST
ID: 3887756 • Letter: W
Question
What is the value of $m after this runs?
$x = 0;
$m = $x++;
0
1
2
2 points
QUESTION 2
true || false = false
True
False
2 points
QUESTION 3
What's the output of this code segment?
$cost = 102;
if ($cost > 0 and $cost < 100)
echo "too much";
if ($cost <= 0 or $cost >= 100)
echo "OK";
too much
OK
too much OK
OK too much
2 points
QUESTION 4
What is the output for y?
$y = 0;
for($i=0; $i < 8; $i += 2)
$y += $i;
echo($y);
10
12
20
9
2 points
QUESTION 5
What does this code do?
$pi = 3.14;
$m = strval($pi);
assigns $m the Boolean value true
assigns $m the value 3"
assigns $m the Boolean value false
assigns $m value "3.14"
2 points
QUESTION 6
A compound data type is a data type that _____.
none of the above
can hold more than one value
can only be used in a function
can be used anywhere in the program except a function
2 points
QUESTION 7
The value property of an HTML text box is whatever the user types in that text box.
True
False
2 points
QUESTION 8
&& is evaluated before ||.
True
False
2 points
QUESTION 9
Which of the following expressions evaluates as true for $n less than 0 or more than 100 (exclusive)?
if ($n > 100 or $n < 0)
if ($n <= 100 or $n >= 0)
if ($n < 100 and $n > 0)
if ($n < 100 and $n > 0)
2 points
QUESTION 10
"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 points
QUESTION 11
What should you say about this code?
$sum = 0;
for($d = 0; $d < 4; $d = $d + 0.5)
$sum += 1;
sum = 9
sum = 5
it is not a good idea to use
sum = 4
2 points
QUESTION 12
What does this code do?
$x = 4;
echo is_float($x);
"sends ""integer"" to the user's browser"
sends the Boolean value true to the user's browser
"sends ""float"" to the user's browser"
sends the Boolean value false to the user's browser
2 points
QUESTION 13
The first character after the dollar sign in a variable name must be _____ or _____. Choose 2 answers.
an underscore
another dollar sign
a letter of the alphabet
2 points
QUESTION 14
"if used in an assignment, $m++ adds 1 to $m then returns the result."
True
False
2 points
QUESTION 15
"How many times will the following code echo "PHP"?
$count = 2;
while($count < 10) {
echo "PHP ";
$count += 1;
}
10
11
9
8
2 points
QUESTION 16
"If two conditions are ANDed together, and the first condition is false, the second condition is not even tested."
True
False
2 points
QUESTION 17
"In the following, because there is only a single line associated with the if-statement, you don't need to enclose the echo statement in curly braces, but it is considered to be a good thing to do anyway. if($x != 0) echo ""Not a zero."";"
True
False
2 points
QUESTION 18
"How many times will the following code echo "Welcome to PHP"?
$count = 0;
while ($count < 10)
echo "Welcome to PHP";
an infinite number of times
9
11
8
2 points
QUESTION 19
Both the print and the echo command send http to the users browser.
True
False
2 points
QUESTION 20
What does this code do?
define("tax", .06);
"normally it defines a constant, but only if the variable name begins with a $"
it defines a named constant called tax
it initialized the variable 'tax'
it allows the use of .06 in a program
2 points
QUESTION 21
What is the value of $m after this runs?
$x = 0;
$m = ++$x;
1
2
0
2 points
QUESTION 22
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
2 points
QUESTION 23
What does this code do?
$x = 6 / 2.0;
echo gettype($x);
"sends ""3"" to the user's browser"
"sends ""integer"" to the user's browser"
"sends ""boolean"" to the user's browser"
none of the other answers are true
2 points
QUESTION 24
Assume an HTML form is submitted to your page. What is the significance of the word $_POST in this code?
$name = $_POST["full_name"];
$_POST must be the the name attribute of the HTML form element that was submitted to the PHP page.
$_POST is used when the method of the HTML form that was submitted as given as post.
"$_POST is just a place holder, and its actual name can be anything."
none of the above.
2 points
QUESTION 25
Which of the following are logical operators? Choose all that apply.
||
&&
!
xor
2 points
QUESTION 26
"What is the output of this code?
$a = 51;
if ($a <= 14)
echo "apples";
else if ($a > 14 and $a <= 20)
echo "oranges";
else if ($a > 20 or $a < 30)
echo "grapes";
else if ($a >= 30 and $a <= 50)
echo "peaches";
else
echo "bananas";
grapes
apples
peaches
oranges
2 points
QUESTION 27
What is the output of the following code?
$x = 10;
while ($x < 5)
$x = $x + 1;
echo $x
16
0
14
10
2 points
QUESTION 28
The _____ attribute of a HTML form determines whether the GET or the POST request is used.
action
size
method
name
2 points
QUESTION 29
Which of the following is equivalent to 44 >= $r >= 12?
if ($r >= 12 or $r <= 44)
if ($r <= 44 and $r <= 12)
if ($r <= 44 and $r >= 12)
if ($r >= 12 or $r >= 44)
2 points
QUESTION 30
How many times is the echo statement executed?
for($i=0; $i < 3; $i++)
for($j=0; $j < 4; $j++)
echo "PHP ";
100
10
7
12
2 points
QUESTION 31
Assume $r= 6 and $s= 0. Which of the following evaluate to true? Choose all correct answers.
$r || $s == 1
not $r || $s == 1
$r && $s == 0
2 points
QUESTION 32
What is the output for $y?
$y = 0;
for($i=1; $i < 7; $i++)
$y += $i;
echo $y;
10
15
21
11
2 points
QUESTION 33
"What does this code do?
$x = 8;
$z= settype($x, "float");
assigns $z the Boolean value false
assigns $z the value 8
assigns $z the value 8.0
assigns $z the Boolean value true
2 points
QUESTION 34
"if used in an assignment, ++$m adds 1 to $m then returns the result."
True
False
2 points
QUESTION 35
What will be displayed when the following code is executed?
$number = 6;
while ($number > 0) {
$number -= 3;
echo "$number ";
}
6 3
3 0 -3
6 3 0
3 0
2 points
QUESTION 36
"In a page containing both PHP and HTML, the PHP code does not need to be distinguished from HTML code."
True
False
2 points
QUESTION 37
Any arithmetic operations written in parenthesis will happen before multiplication
True
False
2 points
QUESTION 38
What is the output?
$answer = 2;
switch($answer) {
case 1:
echo "4.50";
break;
case 2:
echo "7.00";
break;
case 3:
echo "9.25";
break;
default:
echo "3.10";
}
3.10
7.00
4.5
7
2 points
QUESTION 39
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
2 points
QUESTION 40
____ is an advantage of loosely-typed languages.
errors involving data types are easy to track down.
they allow variables to be used anywhere in the program except a function.
it makes things more flexible.
2 points
QUESTION 41
Assume a HTML form is submitted to your page. What is the significance of the word full_name in this code?
$name = $_POST["full_name"];
full_name should start with a dollar sign.
full_name must be the the name attribute of the HTML form element that was submitted to the PHP page.
"full_name is just a place holder, and its actual name can be anything."
full_name is a reserved word and cannot be used as a variable name.
2 points
QUESTION 42
"If two conditions are ORed together, and the first condition is false, the second condition is not even tested."
True
False
2 points
QUESTION 43
The _____ attribute gives the path to the page on the web server that will process form data submitted by the user.
name
size
action
method
2 points
QUESTION 44
"If two conditions are ORed together, the result is false even if only one of the conditions are false."
True
False
2 points
QUESTION 45
What is the output for y?
$y = 20;
for($i=10; $i < 5; $i -= 3)
$y += $i;
echo($y);
10
0
20
5
2 points
QUESTION 46
Variable names are _____.
case sensitive
case insensitive
2 points
QUESTION 47
What is the output?
$n1 = 3;
$n2 = 2;
$n3 = 10;
if ($n1 > $n2 && $n1 > $n3)
echo $n1;
elseif ($n2 > $n1 && $n2 > $n3)
echo $n2;
elseif ($n3 > $n1 && $n3 > $n2)
echo $n3;
3
10
0
2
2 points
QUESTION 48
The following loop displays ______.
for($i=1; $i < 8; $i++)
echo $i+1;
24681012
12345678
1234567
2345678
2 points
QUESTION 49
What does this code do?
$x = 6;
$m = (string) $x;
it sends the Boolean value false to the user's browser
it sends the Boolean value true to the user's browser
this will cause an error
it assigns $m the value "6"
2 points
QUESTION 50
3 + (4 * 5) = ?
0
1
2
Explanation / Answer
1) 2
2)false
3)ok too much
4) 20
5) assign $m the value 3
6) none
7)true
8) true
9) if($n>100 or $n<0)
f10) false
11) sum=9
12) sends integer to the users browser
13 an underscore
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.