Name: _____________________________
Section: ________
FIT100 Miniquiz #5 2/9/2005 with answers
Closed Book, Closed Notes
Scoring: 1 pt. per question

1. First study this html file.  Then answer the question.
<html>
<head>
<script language="Javascript">
function sayHello( ) {
document.write("Hello");
}
</script>
</head>
<body>
<br>
<script language="Javascript">
sayHello( );
document.write("Goodbye");
sayHello( );
</script>
</body>
</html>

When the browswer loads and displays this page, what will you get?

A.
HelloGoodbyeHello

B.
HelloHelloGoodbyeHello
C.
Goodbye
D.
sayHelloGoodbyesayHello
E.
HellosayHelloGoodbyesayHello

2. When these lines of Javascript execute, what will be displayed?
var num1 = 2;
var num3 = 10;
var result = num1 + num3;
document.write(result);
A.  210 
B.  2 + 10
C.  12
D.  1 + 3
E.   4
F.  num1 + num3
G. num1num3

3.  Assuming that this fragment of Javascript executes, what will be displayed in the alert box?
var a = 1;
if (a >= 1) {
     alert("x");
} else {
     alert("y");
}
A. x            
B. y
C. xy

4. Assuming that this fragment of Javascript executes, what will be displayed in the alert box?
var count = 1;
if (count <= 1) {
     count = count + 2;
}
if (count > 1) {
     count = count + 1;
} else {
     count = count -1;
}
alert (count);
A. 0              
B. 1
C. 2
D. 3
E. 4