Javascript Quiz

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/49

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

50 Terms

1
New cards

1.Inside which HTML element do we put the JavaScript?

a)

b)

c)

c)

2
New cards

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

3
New cards

3. Where is the correct place to insert a JavaScript?

a) Both the section and the section are correct

b) The section

c) The section

a) Both the section and the section are correct

4
New cards

4. What is the correct syntax for referring to an external script called "xxx.js"?

a)

a)

5
New cards

5. An external JavaScript must contain the

a) False

6
New cards

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

7
New cards

7. How do you create a function?

a) function:myFunction()

b) function=myFunction()

c) function myFunction()

d) myFunction():function

c) function myFunction()

8
New cards

8. How do you call a function named "myFunction"?

a) call myFunction()

b) myFunction()

c) call function myFunction

d) Call.myFunction()

b) myFunction()

9
New cards

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)

10
New cards

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)

11
New cards

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

12
New cards

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

13
New cards

13. How can you add a comment in a JavaScript?

a) //This is a comment

b) 'This is a comment

c)

d) #This is a comment

a) //This is a comment

14
New cards

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)

c) //This comment has

more than one line//

d) ##This comment has

##more than one line

a) /*This comment has

more than one line*/

15
New cards

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

16
New cards

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)

17
New cards

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)

18
New cards

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

19
New cards

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"

20
New cards

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

21
New cards

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.

22
New cards

22. What are the basic ways to provide hints for search engines?

a) Put keywords in the

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
New cards

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.

24
New cards

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
New cards

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.

26
New cards

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
New cards

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

28
New cards

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

29
New cards

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

30
New cards

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.

31
New cards

31. In JavaScript, the symbols + - * and / are:

a) operators.

b) expressions.

c) comparison operators.

d) None of the above.

a) operators.

32
New cards

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.

33
New cards

33. In JavaScript, which of the following is a logical operator?

a) |

b) &&

c) %

d) /

b) &&

34
New cards

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

35
New cards

35. Alert(message), close() and reset() are JavaScript:

a) Objects

b) Methods

c) Properties

d) commands

b) Methods

36
New cards

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

37
New cards

37. In JavaScript, which of the following is NOT an assignment operator?

a) +=

b) ||

c) *=

d) =

b) ||

38
New cards

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]

39
New cards

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

40
New cards

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.

41
New cards

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
New cards

42. Which of the following is a valid style definition format

a) ...

b)

c) Both A and B.

d) None of the above.

c) Both A and B.

43
New cards

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

44
New cards

44. Which HTML tag is used to define an embedded style sheet?

a)

b)

45
New cards

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.

46
New cards

46. In an HTML form, the correct syntax for creating an input box named "Phone" that is 15 characters in length is:

a)

b)

c)

d) none of the above.

c)

47
New cards

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.

48
New cards

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.

49
New cards

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}

50
New cards

50. Which HTML attribute is used to define inline styles?

a) style

b) font

c) class

d) styles

a) style