Javascript Quiz
28. In HTML, the _____ property/attribute identifies the CGI script that will process a form. a) Value b) Action c) Enctype d) hidden
b) Action
8. How do you call a function named "myFunction"? a) call myFunction() b) myFunction() c) call function myFunction d) Call.myFunction()
b) myFunction()
37. In JavaScript, which of the following is NOT an assignment operator? a) += b) || c) *= d) =
b) ||
11. How many looping statements are there in JavaScript? a) 2. The "for" loop, and the "while" loop b) 4. The "for" loop, the "while" loop, the "do...while" loop, and the "loop...until" loop c) 3. The "for" loop, the "while" loop, and the "do...while" loop d) The "for" loop
c) 3. The "for" loop, the "while" loop, and the "do...while" loop
34. When you want to use JavaScript to manipulate the browser window, the browser window's JavaScript object name is: a) Frame b) Document c) Window d) browser_window
c) Window
16. How do you round the number 7.25, to the nearest whole number? a) Math.rnd(7.25) b) round(7.25) c) rnd(7.25) d) Math.round(7.25)
d) Math.round(7.25)
45. The introduction of CGI scripts changed the way that the Web was used because: a) of the ability to maintain customer databases. b) customers acquired the ability to locate and purchase merchandise online. c) it allows computer users to access a company's customer support database. d) all of the above.
d) all of the above.
31. In JavaScript, the symbols + - * and / are: a) operators. b) expressions. c) comparison operators. d) None of the above.
a) operators.
32. In JavaScript, the expression x!=y returns false if: a) the variables are equal. b) x is less than y. c) the variables are not equal. d) None of the above.
a) the variables are equal.
7. How do you create a function? a) function:myFunction() b) function=myFunction() c) function myFunction() d) myFunction():function
c) function myFunction()
30. The majority of a typical Web document will be found in: a) the head tag. b) the title tag. c) the body tag. d) a comment tag.
c) the body tag.
19. How do you put a message in the browser's status bar? a) statusbar = "put your message here" b) window.status("put your message here") c) window.status = "put your message here" d) status("put your message here")
c) window.status = "put your message here"
13. How can you add a comment in a JavaScript? a) //This is a comment b) 'This is a comment c) <!--This is a comment--> d) #This is a comment
a) //This is a comment
33. In JavaScript, which of the following is a logical operator? a) | b) && c) % d) /
b) &&
17. How do you find the largest number of 2 and 4? a) Math.ceil(2,4) b) Math.max(2,4) c) ceil(2,4) d) top(2,4)
b) Math.max(2,4)
50. Which HTML attribute is used to define inline styles? a) style b) font c) class d) styles
a) style
48. In HTML, you use a button on a form to: a) run a program. b) submit a form to a server. c) reset a form to its original state. d) all of the above.
d) all of the above.
14. What is the correct JavaScript syntax to insert a comment that has more than one line? a) /*This comment has more than one line*/ b) <!--This comment has more than one line--> c) //This comment has more than one line// d) ##This comment has ##more than one line
a) /*This comment has more than one line*/
3. Where is the correct place to insert a JavaScript? a) Both the <head> section and the <body> section are correct b) The <body> section c) The <head> section
a) Both the <head> section and the <body> section are correct
5. An external JavaScript must contain the <script> tag a) False b) True
a) False
49. Which is the correct CSS syntax? a) body {color: black} b) {body;color:black} c) body:color=black d) {body:color=black(body}
a) body {color: black}
38. In JavaScript, what would be the proper form of address in the object hierarchy for the second element in a form called "info"? a) document.info.elements[1] b) document.info.elements[2] c) document.forms.info.elements[2] d) info.elements[2]
a) document.info.elements[1]
29. In JavaScript, the following loop will execute ________ times. for (x=1; x<11; x++) a) 9 b) 10 c) 11 d) cannot tell from this portion of the Script
b) 10
44. Which HTML tag is used to define an embedded style sheet? a) <script> b) <style> c) <css> d) <stylesheet>
b) <style>
36. When you want to use JavaScript to manipulate the currently displayed Web page, the Web page's JavaScript object name is: a) Frame b) Document c) Window d) browser_window
b) Document
35. Alert(message), close() and reset() are JavaScript: a) Objects b) Methods c) Properties d) commands
b) Methods
20. How do you find the client's browser name? a) client.navName b) navigator.appName c) browser.name d) Browser.value
b) navigator.appName
47. In a form, if you want users to select only one option out of many, use: a) check boxes. b) radio buttons. c) text boxes. d) either a or b.
b) radio buttons.
46. In an HTML form, the correct syntax for creating an input box named "Phone" that is 15 characters in length is: a) <input type="text" name= "Phone 15"> b) <input type="text" size= "15"> c) <input type="text" name= "phone" size= "15"> d) none of the above.
c) <input type="text" name= "phone" size= "15">
1.Inside which HTML element do we put the JavaScript? a) <javascript> b) <js> c) <script> d) <scripting>
c) <script>
24. What should you keep in mind when you use links in a Web page? a) Never put two links immediately adjacent to one another. b) Keep the link content as concise as possible. c) Both A and B. d) Need not worry too much about links in general.
c) Both A and B.
25. What should you keep in mind when you use images in a Web page a) Keep the image simple. b) Isolate large graphics. c) Both A and B. d) Need not worry about putting in images in general.
c) Both A and B.
41. To define a style sheet, you need to a) specify each property and its corresponding value. b) associate property-value pairs to dedicated HTML tag(s). c) Both A and B. d) None of the above.
c) Both A and B.
42. Which of the following is a valid style definition format a) <SPAN STYLE="property-value pair(s)">... </SPAN> b) <STYLE>... </STYLE> c) Both A and B. d) None of the above.
c) Both A and B.
39. A named element in a JavaScript program that is used to store and retrieve data is a _____. a) Method b) assignment operator c) Variable d) string
c) Variable
2. What is the correct JavaScript syntax to write "Hello World"? a) response.write("Hello World") b) "Hello World" c) document.write("Hello World") d) ("Hello World")
c) document.write("Hello World")
22. What are the basic ways to provide hints for search engines? a) Put keywords in the <TITLE> tag of the Web page. b) Put keywords in the first few lines of the Web page. c) Put keywords as many times as possible in the Web page. d) All of the above for every major search engines.
d) All of the above for every major search engines.
23. The Web security issues are involved in a) Server. b) CGI script. c) Client. d) All of the above.
d) All of the above.
43. For defining a spacing property in a style sheet, which of the following is not true a) margin-top: 50px b) text-indent: 10px c) padding-right: 100px d) position white-space: normal
d) position white-space: normal
15. What is the correct way to write a JavaScript array? a) var txt = new Array(1:"tim",2:"kim",3:"jim") b) var txt = new Array="tim","kim","jim" c) var txt = new Array:1=("tim")2=("kim")3=("jim") d) var txt = new Array("tim","kim","jim")
d) var txt = new Array("tim","kim","jim")
18. What is the correct JavaScript syntax for opening a new window called "window2" ? a) open.new("http://www.w3schools.com","window2") b) new("http://www.w3schools.com","window2") c) new.window("http://www.w3schools.com","window2") d) window.open("http://www.w3schools.com","window2")
d) window.open("http://www.w3schools.com","window2")
4. What is the correct syntax for referring to an external script called "xxx.js"? a) <script src="xxx.js"> b) <script name="xxx.js"> c) <script href="xxx.js"> d) <script value="xxx.js">
a) <script src="xxx.js">
40. Which of the following is not true a) CSS is tightly integrated with the HTML structure. b) CSS is part of dynamic HTML. c) CSS stand for cascading style sheet. d) CSS is for design control of the Web page appearance.
a) CSS is tightly integrated with the HTML structure.
6. How do you write "Hello World" in an alert box? a) alert("Hello World") b) msgBox("Hello World") c) alertBox="Hello World" d) alertBox("Hello World")
a) alert("Hello World")
10. How do you write a conditional statement for executing some statements only if "i" is NOT equal to 5? a) if (i != 5) b) if =! 5 then c) if (i <> 5) d) if <>5
a) if (i != 5)
26. In an HTML form, if you require users to input a number that has a maximum of ten digits, like a telephone number, you can use the _____ property/attribute to make sure that no more than ten digits are accepted in the field. a) Length b) Maxlength c) Value d) None of the above.
b) Maxlength
27. In HTML, use the _____ property/attribute to set a default value that displays in an input box when the form is initially displayed. a) Default b) Value c) Form d) None of the above.
b) Value
12. How does a "for" loop start? a) for (i = 0; i <= 5) b) for (i = 0; i <= 5; i++) c) for i = 1 to 5 d) for (i <= 5; i++)
b) for (i = 0; i <= 5; i++)
9. How do you write a conditional statement for executing some statements only if "i" is equal to 5? a) if i==5 then b) if (i==5) c) if i=5 then d) if i=5
b) if (i==5)
21. What are the basic ways that people can become aware of your Web site? a) URL is told by somebody. b) The link is followed from another Web site. c) Your site is listed in a search engine. d) All of the above.
d) All of the above.