COMPLETION

	1.	To provide JavaScript for an HTML document, you use a script element in the head section of the document that either includes embedded JavaScript or refers to a/an _____ External______________ JavaScript file.

	2.	An identifier in JavaScript cannot contain _Reserved____or ______key______ words.

	3.	When you “comment out” JavaScript code, the code is  ________ignored__________________ when the page is tested.

	4.	In the code that follows, window is a/an ___object_________________________.
window.prompt("Enter your name");

	5.	In the code that follows, prompt is a/an ____method________________________.
window.prompt("Enter your name");

	6.	To display string or numeric data in a dialog box, you use the JavaScript ____alert______________ method.

	7.	If you want to store a true or false value in a variable, you use the _____boolean_____________ data type.

	8.	If an arithmetic expression isn’t evaluated the way you want it to be due to the order of precedence, you can override that order by using _____parentheses_______________.

	9.	To declare a variable, you code the keyword _____var________________ followed by the name of the variable.

	10.	In a simple statement, you use the ____=_________________ operator.

	11.	You use the ___\n__________ escape sequence to start a new line in a string variable.

	12.	In a web browser, the ____window________________ object is the object that’s always available to JavaScript so you don’t have to code its name when you call one of its methods.

	13.	If possible, the parseInt method converts the string that’s passed to it to a/an __________number___________________.

	

	15.	The condition for a while loop is tested ____before______________ the statements in the loop are executed.

MULTIPLE CHOICE

	5.	When the statement that follows is executed, a message is displayed if the value in userEntry
if (!isNaN(userEntry) || userEntry <= 0 ) {
    alert ("Message");
}
a.	isn’t a number or the value in userEntry is less than or equal to zero	
b.	isn’t a number and the value in userEntry is less than or equal to zero	
c.	is a number or the value in userEntry is less than or equal to zero	
d.	is a number and the value in userEntry is less than or equal to zero	

	6.	After the if statement that follows is executed, what will the value of discountAmount be?
var discountAmount;
var orderTotal = 200;
if (orderTotal > 200) {
    discountAmount = orderTotal * .3;
} else if (orderTotal > 100) {
    discountAmount = orderTotal * .2;
} else {
    discountAmount = orderTotal * .1;
}
a.	0.0	c.	40.0	
b.	20.0	d.	60.0	

	7.	If totalMonths has a string value of “13”, what does the if statement that follows display? 
var years = parseInt ( totalMonths / 12 );
var months = totalMonths % 12;
if ( years == 0 ) {
    alert ( months + " months.");
} else if ( months == 0 ) {
    alert ( years + " years");
} else {
    alert ( years + " years, and " + months + " months.";
}
a.	1 years, and 1 months	
b.	1 year, and 1 month	
c.	1 years	
d.	1 year	

	8.	How many times will the while loop that follows be executed?
var months = 5;
var i = 1;
while (i < months) {
   futureValue = futureValue * (1 + monthlyInterestRate);
   i = i+1;
}
a.	0	c.	5	
b.	4	d.	6