Programming | JavaScript, Ajax » JavaScript test review

Datasheet

Year, pagecount:2009, 4 page(s)

Language:English

Downloads:24

Uploaded:June 15, 2013

Size:38 KB

Institution:
-

Comments:

Attachment:-

Download in PDF:Please log in!



Comments

No comments yet. You can be the first!


Content extract

JavaScript Test 1 Review Covers the following from the text “JavaScript A Beginner’s Guide” Module 1 Module 2 Module 3 Module 4 Module 5 Module 6 Class Presentations posted on the class website www.okladevnet Module 7 You are allowed to bring only ½ sheet of 8 x 10 with notes on only one side, or an 8 x 6 note card. These will be turned in with your exam. True/False Indicate whether the sentence or statement is true or false. 1. You only need two things to use JavaScript: 1) a text editor to write the JavaScript commands, and 2) a Web browser to run the commands and display the results. 2. An Operator is a short symbol in JavaScript that performs some sort of calculation, comparison or assignment on one or more operands. 3. The script element can only be used with the JavaScript programming language 4. JavaScript ignores most occurrences of extra white space 5. In JavaScript, placing line breaks within a quoted text string is allowed 6.

Once created, variable values cannot change as the program runs 7. A function name can contain spaces 8. A variable defined in one script element is accessible to code within another script element 9. Most objects have specific events associated with them 10. The + operator is a binary operator 11. The decrement operator is a binary operator 12. To convert a text string to a number, you can apply an arithmetic operator (other than the + operator) to the text string. 13. The || operator is a comparison operator 14. For loops can be nested 15. The condition in a While loop depends on the value of a counter variable 16. In an IfElse structure, the same sets of commands are run no matter if the conditional expression is true or false 17. IfElse statements can be nested 17a. JavaScript is a more powerful computing language than Java 17b. An operator which works with a single operand is a Unary Operator 17c. An

operator which works with two operands is called a Binary Operator Modified True/False Indicate whether the sentence or statement is true or false. If false, change the identified word or phrase to make the sentence or statement true. 18. Scripts are entered into an HTML or XHTML file using the tag 19. Whenever you use a plus symbol ( + ) to combine a numeric and a text string variable, the result is always a(n) numeric value. 20. Variables with local scope are accessible to all code in a page (including any code within a function) 21. It is a common practice for JavaScript programmers to create libraries of functions located in external files, which are easily accessible to pages in the entire Web site. 22. To debug a logical error, you can monitor the changing values of your variables using a(n) alert dialog box 23.

The percent symbol can be used in a command to combine several text strings into a single text string 24. Variables not declared within functions are often referred to as local variables 25. The onclick event handler is called when the user has pressed down the mouse button 26. The < operator is a(n) arithmetic operator 27. The && operator returns true if the expression is false and false if the expression is true 28. If you wanted to round a number to one decimal place, you would multiply the value by 10, round it, and then divide that integer by 100. 29. In the While loop, a command block is run as long as a specific condition is met 30. In an If statement, the command block is run only if the conditional expression returns the value false

31. A(n) conditional statement is a set of commands that it is executed repeatedly until a stopping condition has been met. 32. In general, For loops are used whenever you have a counter variable 33. The Do/While loop is only used in those situations where you are always sure that the program loop should run at least once. 34. The Do/While tests the condition to continue the loop right before the latest command block is run Completion Complete each sentence or statement. 35. Programming on the Web comes in two types: server-side programming and programming. 36. In a(n) language, the program code must be submitted to a compiler that manipulates it, translating the code into a more basic language that machines can understand. 37. The element is used to specify alternative content for browsers that

do not support scripts or that have their support for client-side scripts disabled. 38. A(n) value is any number, such as 13, 225, or -314159 39. A(n) language such as JavaScript relieves the programmer from the task of assigning a data type to a variable. 40. A function is identified by a(n) 41. A variable’s scope can be either local or 42. A variable with a(n) scope can be used only within a particular function 43. For a function to return a value, it must include a(n) statement 44. The above figure shows a link to an external script file named 45. is the process of searching code to locate a source of trouble 46. The above figure shows a(n) dialog box 47. The event handler is called when the user has reset the Web form 48. The event procedure is

called when the user has clicked the mouse button 49. A(n) operator is an operator that tests whether a certain condition is true or not 50. A(n) operator is an operator that compares the value of one expression to another 51. The collection of commands that is run each time through a loop is collectively known as a(n) . 52. Each time through a For loop, the value of the variable is increased or decreased by a set amount. 53. What is the value of the following calculations Z=3, X=2, Y=4 X *(X +2), X Y + Z, X X + 2, X (Y + Z) 54. Write the code to create an Alert box 55. What would be displayed from the following code? <script type="text/javascript"> for (i = 4; i <= 9; ++i) { document.write("The number is " + i); document.write("<br />"); } </script> 56. What will be displayed from the following code? <script

type="text/javascript"> var thePresident; thePresident="Jefferson"; switch (thePresident) { case "Washington": document.write("<b>First President</b>"); break; case "Obama": document.write("<b>Current President</b>"); break; case "Filmore": document.write("<b>Filmore who?</b>"); break; default: document.write("<b>Sorry, he is not in our list</b>"); } </script> 57. What will happen when the button is clicked? <html> <head> <script type="text/javascript"> function show alert() { alert("I am an alert box!"); } </script> </head> <body> <input type="button" onclick="show alert()" value="Show alert box" /> </body> </html>