Instructions: Complete only the answers you did not get correct on the
exam. Hand this in on class on Wednesday, November 15. For each
corrected answer, you will get half credit.
You are welcome to use any resources you wish, including the instructor.
Be warned, though, I will be out of town for most of the week. You may
consult your classmates, but you may not copy answers verbatim.
Question 1
Fill in the Blank
(4 points)
Question:
____________ is a JavaScript command telling the browser that what follows within the parenthesis is to be written to the document
Question 2
Multiple Answer
(4 points)
Question:
Choose the three correct answers of the following that are specifically objects of the Document Object Model (DOM)
window
navigator
Math
document
Date
Question 3
Multiple Answer
(3 points)
Question:
Choose the correct three of following that CAN be performed with JavaScript.
Save an image to an external file
Save a cookie to a file
Display an alert to the user
Validate a form
Delete files from the user's hard drive
Question 4
True / False
(3 points)
Question:
It is best to write as many functions as possible in the HEAD section of the HTML document.
True
False
Question 5
Multiple Answer
(4 points)
Question:
Select the three ILLEGAL JavaScript variable names
data 1
data1
data@1
data_1
1data
Question 6
Fill in the Blank
(3 points)
Question:
Write a complete line to display an alert box with the message "Hello World"
Question 7
Matching
(4 points)
Question:
Match the following operators, one answer per operator.
Match
Question Items
1. +
2. ==
3. --
4. %
Answer Items
A. increment
B. decrement
C. string concatenation
D. percent
E. modulo
F. assignment
G. equality
Question 8
Fill in the Blank
(4 points)
Question:
To keep a browser from performing a script as soon as it is loaded you need to write the script as a
Question 9
Fill in the Blank
(3 points)
Question:
Write a one-line script to round the number 5.5 and assign it to a variable called total. Use the Math built in object.
Question 10
Multiple Choice
(3 points)
Question:
Which tag can have the onLoad event?
HREF
BODY
FORM
INPUT TYPE
Question 11
Fill in the Blank
(4 points)
Question:
Given the following loop, what is the last number that would be printed out to the browser?
for (int i = 0; i < 48; i++) {
document.write(i);
}
What is the correct way to create a new window in JavaScript?
DispWin = new window('http://www.uc.edu','NewWin','toolbar=no;status=no;width=300;height=500');
DispWin = window.open('http://www.uc.edu','NewWin','toolbar=no;status=no;width=300height=500')
DispWin = window.open('http://www.uc.edu','NewWin','toolbar=no,status=no,width=300,height=500');
DispWin = new window('http://www.uc.edu','NewWin','toolbar=no','status=no','width=300','height=500')
Question 14
Multiple Answer
(3 points)
Question:
Choose the two VALID HTML tags.
INPUT TYPE = RADIOBUTTON
INPUT TYPE = TEXT
INPUT TYPE = SUBMIT
INPUT TYPE = SELECTION
Question 15
Fill in the Blank
(3 points)
Question:
What property of the navigator object holds the name of the browser?
Question 16
Multiple Choice
(4 points)
Question:
In the FORM HTML tag, what parameter holds the URL to which the form data will be sent?
NAME
METHOD
ACTION
URL
Question 17
True / False
(3 points)
Question:
If you submit a form using that form's submit() method, the form's onSubmit event will occur.
True
False
Question 18
Multiple Choice
(4 points)
Question:
What is the proper way to change the text in a text field in a form? Assume the form's name is entryForm and the text field's name is firstName
document.entryForm.firstName = "Spiff"
document.entryForm.firstName.text = "Spiff"
document.entryForm.firstName.value = "Spiff"
You cannot change the text in a textfield.
Question 19
Fill in the Blank
(4 points)
Question:
Which loop requires three parameters, separated by semicolons? Hint: this type of loop is generally used when you know in advance how many times it will execute.
Question 20
True / False
(3 points)
Question:
You can use < and > with a switch statement
True
False
Question 21
Fill in the Blank
(3 points)
Question:
Write a one line JavaScript statement to get the minutes from a Date object instance called today. Assign the minutes to a variable caled minutes.
Question 22
Multiple Choice
(3 points)
Question:
Since JavaScript isn't HTML, you will need to let the browser know in advance when you enter JavaScript to an HTML page. The browser will use the _____ and _____ tags to tell where JavaScript starts and ends. (except for events)
HEAD and /HEAD
FORM and /FORM
SCRIPT and /SCRIPT
JAVASCRIPT and /JAVASCRIPT
Question 23
Fill in the Blank
(3 points)
Question:
A ________ variable is declared in a function, and only has scope in that function
Question 24
Fill in the Blank
(3 points)
Question:
How do you start a one-line comment in JavaScript?
Question 25
Fill in the Blank
(3 points)
Question:
What String method returns the character at a certain position in that String?
Question 26
Fill in the Blank
(3 points)
Question:
What JavaScript object cannot be used with the new keyword?
Question 27
True / False
(3 points)
Question:
If you put the break statement in a loop, the loop will start again at the next iteration.
True
False
Question 28
Fill in the Blank
(3 points)
Question:
If you attempt a math computation and JavaScript is unable to return a valid number, what does it return?
Question 29
Multiple Choice
(3 points)
Question:
Vinni presented material in class about IIS. What is IIS?
Internet Information Society
Web server software
A JavaScript development tool
An e-mail protocol
Question 30
Fill in the Blank
(3 points)
Question:
What Math object method will return the next-highest integer for a given number?