Learning Tree Class 489
JavaScript for Web Development
Thursday Morning Review Questions

Let us see how much you have learned during the past two days by going over these review questions.

  1. How do I declare an array object named myArray containing 10 elements?
    1. Array = Array(10);
    2. myArray = new Array'10';
    3. myArray = new Array(10);
    4. None of the above.

  2. Do arrays start with an index of zero or one?
    1. Yes.
    2. No.
    3. 1
    4. 0

    This is very important to remember for a few reasons. Any object within the DOM that is not named or given an "id" can be accessed "hollywood style" in order of appearance on the document. For instance if I wanted to accessthe data typed in by the user in the first element of a form that was the first on a page I could get at it by document.form[0].element[0].value

  3. When using the open() method of the window object, is the features argument required?
    1. Yes.
    2. No.
    3. Sometimes.
    4. None of the above.

    It is not required but does give you more control over size etc. of the new window you are opening.

  4. What object is passed to the function doTxt using the keyword “this”
    <input type=”text” name=”user” onChange=”doTxt(this)>?
    1. document.
    2. elements.
    3. form.
    4. None of the above.

  5. What object is passed to the function fullChk using the keyword “this”
    <form onSubmit=”fullChk(this)>?
    1. document.
    2. elements.
    3. form.
    4. None of the above.

  6. What event handler is used to trap form submission?
    1. onAction
    2. onClick
    3. onSubmit
    4. None of the above

  7. What method is used to force the cursor to a form element field?
    1. onBlur()
    2. blur()
    3. onfocus()
    4. focus()
    5. none of the above

  8. What is the syntax to retrieve the contents of the form elements myText?
    <form name=”myForm”>
    <input type=”text” name=”myText” />
    1. document.forms[“myForm”].elements[“0”].value
    2. document.forms[0].elements[0].value
    3. document.forms[“myForm”].elements[“myText”].value
    4. None of the above

  9. What event handlers are used for the rollover graphics?
    1. onMouseOver and onMouseOut
    2. onFocus and onBlur
    3. onload and onclose
    4. Any of the above

  10. What is the syntax to open a new browser window called newWin with the contents of help.html and a width of 400 and a height of 200?
    1. newWin=open('help.html','help',"x=400,y=200");
    2. open("help.html","help","width=400,height=200");
    3. newWin = open("help.html","help","width=400,height=200");
    4. Any of the above
    5. None of the above

  11. What object provides browser specific information (appName, appVersion)?
    1. Window object
    2. Navigator object
    3. Document object
    4. Form object
    5. Any of the above

  12. What is the purpose of the setTimeout() event handler?
    1. Used to keep track of NFL game breaks[WELCOME]'
    2. set an expiry time for a condition”
    3. Schedules code for future execution
    4. All of the above

  13. What is the code to refer to an external file containing function definition(s)?
    1. <JavaScript src="myCode.js"></script>
    2. <language="JavaScript" src="myCode.js" />
    3. <script ="JavaScript" url="myCode.js"></script>
    4. <script language="JavaScript" src="myCode.js"></script>

  14. What property is used to resolve the size of an array?
    1. ending property
    2. size property
    3. index propertyl
    4. length property

  15. Is JavaScript code case sensitive?
    1. Yes
    2. No
    3. Sometimes
    4. None of the above

  16. Why should we use program comments?
    1. Because My Boss/Client Says so
    2. Nothing better to do
    3. To create informative annotations to your code
    4. None of the above

  17. What GPP syntax is used to change the <img src=”duck.jpg” name=”bird”> to a swan.jpg?
    1. window.images["bird"].src = "swan.jpg"
    2. browser.images["bird"].src = "swan.jpg"
    3. document.images["bird"].src = "swan.jpg"
    4. None of the above.

  18. What are the three common properties of the elements[] object?
    1. Manny, Mo and Jack
    2. name, value, type
    3. length,size and version
    4. Any of the above

This was just for FUN !