Javascript Sample Test Quiz
1. What is Javascript?
Programming language Application language Scripting language None2. Which HTML element is used to put Javascript code?
<scripting> <script> <javascript> <js>3. What extension is used for Javascript code file?
.js .jsc .javas .javascript4. What is the correct syntax for refering external Javascript code file?
<script href="external.js"> <script name="external.js"> <script src="external.js"> <script ref="external.js">5. How to popup a message in Javascript?
msgbox("my message"); msg("my message"); message("my message"); alert("my message");6. How to create a function in Javascript?
function test() function=test() function:test() function::test()7. How to call a function named "test" in Javascript?
function test() call test() test() call function test()8. How to comment/comment code in Javascript?
//my comment 'my comment <--my comment--> /my comment/9. How to declare a variable in Javascript?
myvar; var myvar; v myvar; variable myvar;10. Which attribute changed to make elements invisible?
invisibility invisible visible visibility11. Which statement is true about Javascript?
Javascript is case sensitive Javascript statements can be grouped together in blocks javascript is compiler based None12. What is the event that fires when the form elements loses the focus?
Onloose Onblur Onclick onfocus13. Which attribute is used to hold the Javascript version information?
VERSION VER LANGUAGE SCRIPT14. Which of the below is used in Javascript to insert special characters?
@ * % &15. Which of the following is not a valid Javascript variable name?
_varname 2varname varname None16. Which language define the behavior of a web page?
Javascript HTML CSS XML17. How to write for loop in Javascript?
for(i=0; i<=10; ++i) for i=10 then iterate for each (i<=10) None18. Which of the following is correct way to write "Hello World" on the web page?
print("Hello World") System.print("Hello World") out.print("Hello World") document.write("Hello World")19. How to get the id of a form element?
getId getElementById getElementId None20. How to create a date object in Javascript?
var d = new toDate(); var d = new getDate(); var d = new Date(); var d = Date();
No comments:
Post a Comment