| |
| 1) Inside which HTML element do we put the JavaScript? |
| a) <scripting> |
| b) <javascript> |
| c) <script> - correct answer |
| d) <js> |
|
| 2) What is the correct JavaScript syntax to write "Hello World"? |
| a) response.write("Hello World") |
| b) document.write("Hello World") - correct answer |
| c) ("Hello World") |
| d) echo("Hello World") |
|
| 3) How do you call a function named "myFunction"? |
| a) call function myFunction |
| b) myFunction() - correct answer |
| c) call myFunction() |
|
| 4) 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 then |
| c) if (i==5) - correct answer |
| d) if i=5 |
|
| 5) 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 (i != 5) - correct answer |
| c) if =! 5 then |
| d) if <> 5 |
|
| 6) How many different kind of loops are there in JavaScript? |
| a) Two. The "for" loop and the "while" loop - correct answer |
| b)Four. The "for" loop, the "while" loop, the "do...while" loop, and the "loop...until" loop |
| c) One. The "for" loop |
|
| 7) How does a "for" loop start? |
| a) for (i = 0; i <= 5) |
| b)for (i = 0; i <= 5; i++) - correct answer |
| c) for i = 1 to 5 |
| d) for (i <= 5; i++) |
|
| 8) What is the correct way to write a JavaScript array? |
| a) var txt = new Array(1:"tim",2:"shaq",3:"kobe") |
| b) var txt = new Array="tim","shaq","kobe" |
| c) var txt = new Array("tim","shaq","kobe") - correct answer |
|
| 9) How do you round the number 8.25, to the nearest whole number? |
| a) Math.rnd(8.25) |
| b) Math.round(8.25) - correct answer |
| c) round(8.25) |
| d) rnd(8.25) |
|
| 10) How do you find the largest number of 6 and 8? |
| a) Math.max(6,8) - correct answer |
| b) top(6,8) |
| c) ceil(6,8) |
| d) Math.ceil(6,8) |
|
| 11) What is the correct JavaScript syntax for opening a new window called "window5" ? |
| a) new("http://www.ex-designz.net","window5") |
| b)window.open("http://www.ex-designz.net","window5") - correct answer |
| c) open.newwindow("http://www.ex-designz.net","window5") |
| d) new.window("http://www.ex-designz.net","window5") |
|
| 12) How do you put a message in the browser's status bar? |
| a) window.status = "put your message here" - correct answer |
| b) statusbar = "put your message here" |
| c) status("put your message here") |
| d) window.status("put your message here") |
|
| 13) How do you find the client's browser name? |
| a) browser.name |
| b) navigator.appName - correct answer |
| c) client.navName |
|
| 14) You define an array using |
| a) var myarray = new Array(); - correct answer |
| b) var myarray = array new; |
| c) var new Array() = myarray; |
| d) var new array = myarray; |
|
| 15) Onclick is equivalent to which two events in sequence |
| a) onmouseover and onmousedown |
| b) onmousedown and onmouseout |
| c) onmousedown and onmouseup - correct answer |
| d) onmouseup and onmouseout |
|
| 16) Whicj best describe void? |
| a) A method |
| b) A function |
| c) An operator - correct answer |
| d) A statement |
|
| 17) Which property would you use to redirect visitor to another page? |
| a) window.location.href - correct answer |
| b) document.href |
| c) java.redirect.url |
| d) link.redirect.href |
|
| 18) Which of the following JavaScript statements use arrays? |
| a) setTimeout("a["+i+"]",1000) - correct answer |
| b) k = a & i |
| c) k = a(i) |
Hi;
ReplyDeleteThanks a lot for your cordial co operation for JavaScript questions with answers...
May i request you to post 40 No's Questions with answers for 2012 and 2011 which was held in oDesk...
That will be very helpful for us to sit for the upcoming exam in oDesk regarding Javascript
Awaiting for your prompt feedback
Thanks Again
BR//
Rumi