Student Test Questions: 3rd Quarter


  1. Question: What goes in the parentheses after a function?

    Answer: The parameters of the function.

  2. Question: A boolean has two values. What are they?

    Answer: True/False

  3. Question: What does a conditional statement do?

    Answer: A conditional statement poses tests, and performs actions depending on the results of the tests.

  4. Question: How would the script look to write a loop that goes from 0 to 100 by 5's?

    Answer: for(i=0;i<101;i+5) { document.write("<p>"+i+"</p>") }

  5. Question: How many slots are in the Array: new Array(10,20,30,40,50)?

    Answer: Five slots

  6. Question: What is one way to assign a value to a slot in an Array?

    Answer: NameofArray[0]=5    NameofArray[1]=10

  7. Question:Name 3 things that can be stored in an array

    Answer:Strings of numbers, letters (ascii), boolean values. Names of images, names of HTML documents are examples of letters.

  8. Question:What is the index of the first value in an array?

    Answer:Zero

  9. Question:True or False: Java and Javascript are, for all intensive purposes, the same thing.

    Answer:False. They are two very different programming languages.

  10. Question:Why is the use of functions useful in Javascript programming

    Answer:It simplifies the code making it eaiser to read and understand. Somtimes it can reduce the number of lines of code the programmer has to write. It also makes code eaiser to debug.

  11. Question:Why are some variables used in a function not valid outside of that function?

    Answer:They are local variables whose scope and duration have expired.

  12. Question:Name 3 things that Browser plug-ins provide the Web page author?

    Answer: sounds, video, and animation.

  13. Question:What kind of loop is used in our JavaScript book and what is it named after?

    Answer: the "for" loop, named after the command that begins the loop.

  14. Question:What is it called when you want to take some information and give it to a function to be processed?

    Answer: "passing" the information.

  15. Question:How does one hide javascript from old browsers?

    Answer:With the line "<!-- Hide script from old browsers" .

  16. Question:What marks immediately after a function name denote the function and are a necessary part of it?

    Answer: A set of parentheses

  17. Question:A string is usually enclosed with what marks?

    Answer: quotation marks

  18. Question: In Java what is a method a description of?

    Answer: A method is the actions that an object does.

  19. Question: In javascript what is a string?

    Answer: A string is text in the java code that is interpreted literally. It is a sequence of ASCII characters.

  20. Question: What are comparison statements?

    Answer: Values that are true or false; x>y.

  21. Question: What is a function good for?

    Answer: It is a simpler and easier way of compacting certain parts of java code.

  22. Question: What is the duration?

    Answer: Duration is the time when a variable exists in memory.

  23. Question:What are some advantages of using JavaScript?

    Answer:JavaScript allows your site to be more interactive with the user. You can make sure info. is valid, do calculations, give feedback, test for plug-ins, and much more.

  24. Question:What does it mean to say that JavaScript is an "object-oriented" language?

    Answer:This means that in Web browsers, JavaScript works with objects (windows, buttons, forms, etc.). These objects have certain properties, which modify them, and their objects can have sub-objects. The objects and sub-objects can do things, which are called methods. When you put all these elements together you make a language that describes a process.

  25. Question:List any three value types.

    Answer: number, function, object, boolean, null, string

  26. Question: What are "operators?"

    Answer:They are the symbols used to work with variables. They use plus and minus signs, asterisks, percentages, and back-slashes to define different actions.

  27. Question:Write the necessary script of a function.

  28. Answer:

    function  name_of_function(paramenter_list) 
    {
        code goes here
    } 

  29. Question: What is the notation for sending a message in Javascript?

    Answer: object. sub-object.method(parameters);

  30. Question: What is a method?

    Answer: An action an object is able to do.

  31. Question: What is another name for a conditional statement?

    Answer: A boolean statement.

  32. Question: What is a local variable?

    Answer: Function parameters and any variables defined (using var) in a function body.

  33. Question: Write the mathmatical expression A>B>C as a boolean expression.

    Answer: (A>B)&&(B>C)

  34. Question: When performing a loop, "i" starts out with what value?

    Answer: i can start at whatever you want it to start at. In the "for" loop we set (i=x; .. ; .. ). Here, x can be any number.

  35. Question: how is the # of values in an array specified?

    Answer: array_name.length

  36. Question: where do functions go in the html document?

    Answer: in the header or the body

  37. Question:How do you comment out a section of your script?

    Answer: Mark the beginning of the section with /* and end it with */

  38. Question:Why do we use functions?

    Answer:Because they compact our code and make it easier to repeat the same action multiple times.

  39. Question:If you have a function that you want to place at the end of the message "Today is..." what is the proper notation? Note, the function must have a return value.

    Answer:("Today is" + functionName( ))

  40. Question:What is the notation for the beginning tag for Javascript?

    Answer:<script language=javascript type="text/javascript">

  41. Question:Can you have more than one Javascript on a single web page?

    Answer:Yes, all you need to do is end one with a </script> and begin a new one below it.

  42. Question:If the word "cat" were a Javascript string, in what position would the letter "t" be?

    Answer:The second, because it would start with the 0th, then the 1st, then the 2nd.

  43. Question:What will Math.random() give you?

    Answer:A random number between 0 and 1

  44. Question: Define duration

    Answer:The time when a variable exists in memory.

  45. Question: Write the following in JavaScript form. It is not true that A and B are both zero.

    Answer: !(A==0 and B==0)

  46. Question: What is a function?

    Answer: A function is a set of javascript statements that performs a task.

  47. Question:How many times can you call a function?

    Answer: Functions can be called as many times as needed during the running of the script.

  48. Question: T or F; Javascript must be placed in the head section.

    Answer: False--Javascript can be placed in the head or the body section.

  49. Question:What are "boolean variables"?

    Answer:Variables that contain the value true or false

  50. Question:What is another name for "conditional statements"?

    Answer:boolean statements

  51. Question:What are member variables?

    Answer:They are the "data" - the information that objects know.

  52. Question:Define nested loops.

    Answer:Nested loops are loops within existing loops.

  53. Question:What is scope?

    Answer:A region of code where a variable is recognized.

  54. Question:What do return values do?

    Answer:Once an object has performed an action, it sends information back to the object that sent the message.

  55. Question:How do events relate to event handlers?

    Answer:Event handlers are Java Script commands that are triggered by events.

  56. Question:What command identifies that you are using javascript in your script?

    Answer:<script language=javascript type="text/javascript">

  57. Question:T or F: Loops can be used to calculate the sum of a long list of numbers.

    Answer: True

  58. Question:T or F: Loops can only be used to calculate the sum of a list of consecutive numbers.

    Answer:False

  59. Question:T or F: If you have an infinite loop, your page will not load at all.

    Answer:False

  60. Question:T or F: Once an array is created you can set the value of individual elements using assignment statements.

    Answer:True

  61. Question: What type of statement uses a single equals sign?

    Answer: Assignment statement

  62. Question: What type of statement uses a double equals sign?

    Answer: Comparison statement

  63. Question: True of False: Javascript does not allow the creation of empty arrays.

    Answer: False.

  64. Question: The first slot in an Array's index is what number?

    Answer: Zero.

  65. Question:How do you comment out a section of your script?

    Answer: You put a slash and an asterisk before the text and an asterisk and a slash at the end.

  66. Question: When using an alert window, what does Netscape include automatically?

    Answer: Text telling the user that the box was put up by a JavaScript command.

  67. Question: What are two kinds of conditional statements?

    Answer: If-then and while.

  68. Question: What is the first thing you have to define in a script?

    Answer: The language the script is in.

  69. Question: What three sections do a conditional have?

    Answer: If. Then. Else. The Else section is optional.