You are on page 1of 3

Name: 1. Which control type(s) allow(s) only one item in a group to be checked> a. b. c. d. 2.

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.

Which operator can be used on strings and numbers? a. b. c. d. + * /

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()

8. A variable declared (using var) in function A


is accessible in a. b. c. d. 9. No part of the code A only C, E and A B, C , D, E and A

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

Which describes the order in which the functions execute? a. E, C, E

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

11. The alert(N) statement will display a. b. c. d. e. 4 2 10 1 0

10. Use the following HTML and JavaScript code


to answer question I-V: <SCRIPT LANGUAGE=JavaScript> var K=0;

12. The alert(K) statement will display a. b. 4 2 10 1 No value

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.

13. The alert(J) statement will display a. b. c. d. e. 4 2 10 1 No value

14. The alert(I) statement will display a. b. c. d. e. 4 2 10 1 No value

15. Write the line on how to access the value of an element named 21 in a form named f1? document ._____.____. ______

The alert (Total) statement will display a. b. c. d. e. 4 10 2 0 3

16. How do you reset the value of an elemnt


named forms in a form named pass2? document. _____._____.______ 17. This function determines whether a value is an illegal number. This function returns true if the value is not a number,and false if not.

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.

<html><head> <script type="text/javascript"> function outputtext(){ var x = document.form.text.____1_____; alert(___2___); }

You might also like