Java Test #1
February 19, 1998

I have not violated the Honor Code in completing this test.

Signed: ___________________________________________

READ THESE NOTES
Sign the pledge and initial each sheet. SHOW ALL YOUR WORK Do as many questions as you are able.
DO NOT spend an excessive amount of time on any one question since all questions count the same.
You may OMIT any ONE question. You MUST indicate which question is to be omitted by circling its number and writing the word OMIT next to it.

1. What program may be used to copy files between computers on the Internet? ____________

2. FONT and Heading (Hn) tags may both be used to control the size of text. Name two attributes that the FONT tag can control that the H tags cannot.


3. What must precede and what must follow the text of a comment in an HTML file?
A) Precede ___________
B) Follow _____________

4. What HTML device is the most flexible for formatting text and images on a page?______
  1. Form
  2. Table
  3. Text box
  4. Anchor
  5. Marquee
5. Give the extensions of the two types of image files that may be placed in HTML documents.
A)
B)

6. What tag is the ALT tag used with and what is an important purpose of the ALT tag?



7. Give the HTML code to place a form with a text box and button on a page.







8. Give an example of
A.) A single line JavaScript comment

B.) A multiline JavaScript comment

9. Fill in the blanks with the correct answers.
The attributes of an object are called ___________________
Functions/procedures which an object may perform on itself are called ___________________
Actions which may happen to an object are called _________________

10. Besides objects, the two major JavaScript datatypes are


11. x = 5; y=2; x += y++
After the above three instructions are executed x = ______ and y = ________.

12. After the following loop is executed Sum = ________
Sum = 0
for (k = 3; k > 0; k = k - 1){
Sum = Sum + k * k
}

13. Translate the following pseudocode into syntacticaly correct JavaScript.
IF X < Y THEN X = X + 1 ELSE X = X - 1 ENDIF





14. Write a JavaScript function which accepts a number as an argument, and returns the square of the number plus one.





15. Consider the following variable names 1. Count, 2. count, 3. COUNT, 4. cOUNT, 5. Cou_nt.
    Which one of the following statements is true? _____
  1. All name the same variable
  2. Only the first 4 name the same variable
  3. Only the first 3 name the same variable
  4. All name different variables.
16. Give a JavaScript declaration for an array called Months.


17. Where in an HTML document is the most appropriate place to locate a JavaScript function? ___
  1. Near the end of the document
  2. In the BODY tag
  3. Between the HEAD and /HEAD tags
  4. Between the BODY and /BODY tags
  5. Immediately before each call to the function
18. Which one of the following is true about CGI programs/scripts? _______
  1. CGI programs execute on the server; normally in a privileged mode.
  2. CGI programs normally execute on the client.
  3. CGI programs may be written in JavaScript.
  4. CGI programs are restricted from accessing data on the server.
19. The following JavaScript statement will write the GMT date and time the current document was last modified.
document.write(document.lastModified + " GMT")
Give complete HTML code to embed this statement in an HTML document.





20. Match the following:
A. alert _____ Used to exit a loop immediately.
B. continue _____ Creates an instance of an object
C. new_____ A function which displays a box which delivers a message to the user.
D. this _____ Forces the next iteration of a loop.
E. break _____ Refers to the current object.