Friday, July 24, 2009

JavaScript Question

JavaScript Objective Type Questions
Previous Next

11. How many different kind of loops are there in JavaScript?
a) Two. The "for" loop and the "while" loop
b) Four. The "for" loop, the "while" loop, the "do...while" loop, and the "loop...until" loop
c) One. The "for" loop

12. How does a "for" loop start?
a) for (i = 0; i <= 5) b) for i = 1 to 5 c) for (i = 0; i <= 5; d) for (i <= 5; i++) 13. How can you add a comment in a JavaScript? a) //This is a comment b)
c) 'This is a comment

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)

15. What is the correct way to write a JavaScript array?
a) var txt = new Array("tim","kim","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(1:"tim",2:"kim",3:"jim")

16. How do you round the number 7.25, to the nearest whole number?
a) Math.round(7.25)
b) round(7.25)
c) rnd(7.25)
d) Math.rnd(7.25)

17. How do you find the largest number of 2 and 4?
a) Math.max(2,4)
b) ceil(2,4)
c) top(2,4)
d) Math.ceil(2,4)

18. What is the correct JavaScript syntax for opening a new window called "window2" ?

a) new("http://xplorenotes.blogspot.com")
b) new.window("http://xplorenotes.blogspot.com")
c) window.open("http://xplorenotes.blogspot.com")
d) open.new("http://xplorenotes.blogspot.com")


19. How do you put a message in the browser's status bar?
a) window.status("put your message here")
b) window.status = "put your message here"
c) status("put your message here")
d) statusbar = "put your message here"

20. How do you find the client's browser name?
a) client.navName
b) browser.name
c) navigator.appName


Previous Next

3 comments: