Wednesday Morning Review Questions

Let us see how much you have learned yesterday by going over these review questions.

  1. Which Language is more sophisticated JavaScript or Java?
    1. They both have the same level of sophistication.
    2. JavaScript.
    3. JScript is actually more sophisticated than either.
    4. Java.
    5. None of the above.

  2. Is JavaScript ISO compliant?
    1. Yes.
    2. No.
    3. ISO Does not apply to JavaScript.
    4. On a Fast Track Process.

  3. Can JavaScript access the local file system?
    1. Yes.
    2. No.
    3. Sometimes.
    4. None of the above.

  4. Can JavaScript Make Network Connections?
    1. Yes.
    2. No.
    3. Sometimes.
    4. None of the above.

  5. Can JavaScript draw graphics?
    1. Yes.
    2. No.
    3. Sometimes.
    4. None of the above.

  6. <script>………..</script>
    If the language attribute is not defined, what version of JavaScript is the default?
    1. Whatever the default version of JavaScript is for that particular browser.
    2. 1.5
    3. 1.2
    4. 1.1
    5. None of the above

  7. Which logical HTML tag denotes strong emphasis?
    1. <ADDRESS>
    2. <EM>
    3. <I>
    4. <STRONG>
    5. <VAR>

  8. What is the code for a single line JavaScript comment?
    1. /* This is a single line JavaScript comment*/
    2. /* This is a single line JavaScript comment
    3. // This is a single line JavaScript comment
    4. None of the above

  9. What is the code for a JavaScript comment block?
    1. /* This is a JavaScript comment block*/
    2. /* This is a JavaScript comment block
    3. // This is a JavaScript comment block //
    4. None of the above

  10. What tag can be used to display a message on a browser that does not support JavaScript?
    1. <nojavascript>...<nojavascript>
    2. <js="off">...</Js>
    3. <noscript> your browser sucks. get one that supports JavaScript</noscript>
    4. Any of the above
    5. None of the above

    The <noscript> tag is sort of a mute point since all of the mainstream browsers support JavaScript. In the 'old' days it was standard practice to place a non-scripted version of the web page in between the <noscript> tags. If a user has turned Scripting off in their browser preferences then the tag has relevance for notification and a non scripted display.

  11. If more than one JavaScript statement appears on the same line what punctuation mark is used to terminate/separate each statement?
    1. comma
    2. semicolon
    3. colon
    4. period
    5. ampersand

  12. What punctuation mark(s) are used to define a sequence of string characters, such as WELCOME?
    1. Surround WELCOME with brackets [WELCOME]
    2. Surround WELCOME with single quotes 'WELCOME'
    3. Surround WELCOME with double quotes“WELCOME”
    4. Surround WELCOME with either single or double quotes 'WELCOME' or “WELCOME”

  13. What are the syntax rules for specifying identifiers??
    1. Letters, underscores, dollar signs
    2. First char may not be a number
    3. Upper or lower letters are allowed
    4. all of the above

  14. Within a function, how do you differentiate between a local and global variable?
    1. Keep it in the curly brackets
    2. use single quotes
    3. Within a function use the key word global
    4. Within a function, using the keyword var makes the variable local

    This is especially important when trying to access a variable. If you want to set a variable that has a recognized value outside the confines of your function then leave the var keyword out of the syntax. If its availability is better restricted to the function then use the var keyword.

  15. Where should function definitions be placed in the HTML code and why?
    1. Always place your code outside the <html> tags, the browser likes that
    2. <body> functions need to be close to what you want effected
    3. <head> Browsers parses this code first,before the <body>
    4. None of the above.

    Functions are best placed in the head and/or referred to in an external file. JavaScript commands will appear in the body as well as the head.

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

    Placing your common JavaScript code in an external file is always a good idea.

  17. Using the for loop, what is the code to perform a single statement 25 times?
    1. for (init; test; increment)
      for (i=0;i<25;i++)
    2. for (init; test; increment)
      for (i=0;i>25;i++)
    3. for (init; test; increment)
      for (i=0;i<25;i+)
    4. None of the above

  18. What is the purpose of the break and continue statements?
    1. Stop and start JavaScript
    2. Manage function variables
    3. Manipulate flow of control within a loop
    4. None of the above

  19. String values can be captured using which operation ?
    1. alert.
    2. confirm.
    3. prompt
    4. None of the above.

    That is a very cool way to capture user input from a dialoge box.

  20. How do I declare and initialize an identifier named greeting with the value WELCOME?
    1. greeting :“WELCOME”
    2. greeting = “WELCOME”;
    3. greeting=WELCOME
    4. Any of the above

This was just for FUN !