MSc-IT Study Material
June 2010 Edition

Computer Science Department, University of Cape Town

Review Questions

Review Question 1

What is the main advantage of JavaScript?

You can find the answer to this question at the end of the unit.

Review Question 2

What is the JavaScript term for the parts of an object's state, and what is the term for a function that is a part of an object?

You can find the answer to this question at the end of the unit.

Review Question 3

Write down in your own words what happens when an interactive HTML/JavaScript document is loaded by a browser from a Web server.

You can find the answer to this question at the end of the unit.

Review Question 4

What object does the method alert belong to? What does the method do in that object?

You can find the answer to this question at the end of the unit.

Review Question 5

Explain what an argument is and give an example of one.

You can find the answer to this question at the end of the unit.

Review Question 6

Write a statement in JavaScript that displays a dialogue box with the greeting 'Form ready for your application. Please proceed.'

You can find the answer to this question at the end of the unit.

Review Question 7

What is the purpose of a variable? How do you declare a variable in one script in a document for it to be used by another?

You can find the answer to this question at the end of the unit.

Review Question 8

Write the JavaScript code that will produce the following prompt:

You can find the answer to this question at the end of the unit.

Review Question 9

The date Fri Jan 4 11:38:00 UTC 1991 is 662989080980 milliseconds after midnight, 1 January 1970. How would you create a Date object referred to by variable theDate, which represented the date Fri Jan 4 11:38:00 1991 in universal time.

You can find the answer to this question at the end of the unit.

Review Question 10

To which object does the method close() belong in the following line of JavaScript?

close()

You can find the answer to this question at the end of the unit.

Review Question 11

The window object includes a method resize that takes two arguments which specify the width and height of the window in pixels. Read the following script and write down what it does. (Do not try to work out what happens in 'odd' situations, like when a negative number is given.)

    var squareSize
    = window.prompt("In what size square would you like this?", "300")
    window.resizeTo(squareSize,squareSize)

You can find the answer to this question at the end of the unit.