Circle the word TRUE or the word FALSE. If neither is circled, both are circled, or it impossible to tell which is circled, your answer is considered wrong.
count++; is equivalent to count = count + 1;
function keyword is used to
define a function.
Circle the letter of the best choice.
PrintGreeting();how many arguments does the function have?
[a.] 1
[b.] 0
[c.] 2
[d.] none of the above
[a.] tells the browser how to use the function.
[b.] gives information about the function to the person reading the code.
[c.] is necessary for the program to run.
[d.] all of the above.
var a = 3, b = 17 ;
a = b % a ;
b = ++a + 5 ;
alert("a = " + a + ", b = " + b);
[a.] a = 3, b = 8
[b.] a = 2, b = 7
[c.] a = 3, b = 7
[d.] a = 2, b = 8
[e.] None of the above.
test = 1 ;
if (test = 2) {
alert("Beam down the landing party.\n") ;
} else if (test == 1) {
alert("Jim, he's dead.\n") ;
} else if (test == 0) {
alert("Scotty, four to beam up.\n") ;
}
[a.] Beam down the landing party.
[b.] Jim, he's dead.
[c.] Scotty, four to beam up.
[d.] No output is produced
[a.] alert (x.toFixed(1));
[b.] alert (toFixed(x) = 1);
[c.] alert (x.toFixed(x));
[d.] alert (toFixed(1));
[a.] z = y + (x + 1);
[b.] z = ++x + y;
[c.] z = y + x++;
[d.] none of the above
[a.] total = total - x--;
[b.] total -= --x;
[c.] total -= (x - 1);
[d.] none of the above
[a.] total = total + x--;
[b.] total += --x;
[c.] total += (x - 1);
[d.] none of the above
[a.] high = 24 and low = 4
[b.] high = 24 and low = 8
[c.] high = 19 and low = 4
[d.] high = 19 and low = 8
[a.] 0
[b.] 10
[c.] 9
[d.] 1
[a.] \n
[b.] /n
[c.] enter
[d.] <br />
[a.] a = 14 and b = 2
[b.] a = 16 and b = 2
[c.] a = 14 and b = 4
[d.] a = 16 and b = 4
SumTwo that returns the sum of
two numbers, where the numbers, num1 and num2 are passed to it.
Smallest
that takes three arguments, x, y
and z and returns the smallest of the three
arguments. You can assume x, y
and z are numbers.
Average that takes three number
parameters n1, n2, and n3 and returns the value of the
average of the three.
PrintBox that will print a
rectangle made up of any character passed to it. Here is the prototype:
function PrintBox (rows, columns, ch)This call to PrintBox,
PrintBox(3, 10, "$");
$$$$$$$$$$
$$$$$$$$$$
$$$$$$$$$$
| GPA range | Student Rating |
|---|---|
| 3.50 - 4.0 | Dean's list |
| 2.0 - 3.49 | Satisfactory |
| 1.0 - 1.99 | Probation |
| 0.0 - 0.99 | Suspended |
Determine the output generated by the following code segments, assuming the surrounding program code (whatever it is) compiles correctly.
alert ("JavaScript\nis\nfun.");
var a = 2, b = 3;
b *= a;
a += b++;
alert (a + " " + b);
var a = 5, b = 4;
b += a;
a -= ++b;
document.write (a + " " + b);
var n = 1234;
while (n > 0)
{
document.write(n + "<br />");
n /= 10;
n = Math.floor(n);
}
var m;
for (m = 1; m <= 5; m++)
{
switch (m)
{
case 1:
document.write ("one");
break;
case 2:
document.write ("two");
break;
case 3:
document.write ("three");
break;
default:
document.write ("Default case");
}
document.write ("<br />");
}
<head>
<script type="text/javascript">
<!--
function X (m)
{
document.write("In function X: " + m + "<br />");
return (m + 2);
}
//-->
</script>
</head>
<body>
<script type="text/javascript">
<!--
var r;
r = X(5);
document.write("After the call to function X: " + r);
//-->
</script>