Professional Documents
Culture Documents
More than one of the following Input type=checkbox Input type=radio Input type=text 7.
d.
Questions 7-9 are based upon the following JavaScript: <SCRIPT LANGUAGE=JavaScript> //area A designates code within the SCRIPT tags, but outside all functions function B(){ } function C(){ } function D(){ } function E(){ } B(); D(); } E(); C(); E(); </SCRIPT> A variable declared (using var) in function B and only in function B is accessible in a. b. c. d. e. Bonly B and F Band E B, E, and A All other parts of the code
How would you access the element at index 5 in the array A? a. b. c. d. A [5] A[6] A[4] A
3.
4.
Which is a valid comment in JavaScript? a. b. c. d. More than one of the following //comment /*comment*/ comment
5.
Which function ormethod converts a number of string? a. b. c. d. convert() parsestring() str() toString()
6.
How many alert boxes will the following loop produce? for(var Index=0;Index<=2 ; + +Index) alert(Index); a. b. c. 0 1 2
b. c. d. e.
E, B, D, C, E, B, D B, C, D, E E, C, E, B, C,D, E, B, D E, B,D,C,E,B,D,B,C,D,E,B,D
function Start() { var N=2, Total=0; Total=addUp(N); alert(Total); alert(N); alert(K); alert(J); alert(I); } function addUp(J) { var I=0; var Sum=0; K=2*J; For (I=1; I<=K; I++) Sum=Sum+I; return Sum; } Start(); </SCRIPT>
c. d. e.
15. Write the line on how to access the value of an element named 21 in a form named f1? document ._____.____. ______
18. Write a code that creates a textbox that accepts a password with a maximum of 8 characters. 19. What method of a string object you can use to find which character is at a given position in a string? 20. Write the line on how to set the focus to a textbox called myfruit in form named myform. 21. Use this function to answer the following questions 21-22.
function Power(x,u) { var Product=1 for (z=1;z<=y;z++) Product=Product*x; return Product; 21. The base of the Power function is
function ______3______{ var x = document.form.text.____4____ _; document.form.text.select(); } </script></head> <body> <form name="____5_____"> <input type="text" name="text"> <input type="____6___" value="____7_____" onclick="_____8_____"> <input type="____9____" value="____10_____" onclick="selecttext()"> </form></body></html>
Answer Key for Test 2 1. 2. 3. 4. 5. 6. 7. 8. 9. 10.
calculated in function Power is a. 1 b. x c. y d. z e. None of the above 22. The exponent in function Power is a. x b. y c.z d. Power e. none of the above
Test 2.