JavaScript MCQ Quiz Hub

JAVASCRIPT MCQ

Choose a topic to test your knowledge and improve your JavaScript skills

1. Which of the following is correct about JavaScript?




2. Which of the following is the correct syntax to print a page using JavaScript?




3. Which of the following type of variable is visible only within a function where it is defined?




4. Which built-in method returns the calling string value converted to upper case?




5. Which of the following function of Number object returns the number's value?




6. Which of the following function of String object returns the index within the calling String object of the first occurrence of the specified value?




7. Which of the following function of String object creates an HTML anchor that is used as a hypertext target?




8. Which of the following function of String object causes a string to be displayed as struck-out text, as if it were in a strike tag?




9. Which of the following is true about variable naming conventions in JavaScript?




10. Which of the following is the correct syntax to redirect a url using JavaScript?




11. Which of the following function of String object returns a number indicating the Unicode value of the character at the given index?




12. Which of the following function of String object executes the search for a match between a regular expression and a specified string?




13. Which of the following function of String object returns the calling string value converted to upper case while respecting the current locale?




14. Which of the following is a valid type of function javascript supports?




15. How can you get the type of arguments passed to a function?




16. Which of the following function of Array object removes the first element from an array and returns that element?




17. ....................... is a built - in JavaScript function which can be used to execute another function after a given time interval.




18. Java Script entities start with ___________and end with _____________.




19. Which of the following is a server-side Java Script object?




20. Javascript is _________ language.




21. JavaScript is ______ Side Scripting Language.




22. Cost for Using JavaScript in your HTML is _________ .




23. JavaScript Code is written inside file having extension __________.




24. Why JavaScript is called as Lightweight Programming Language ?




25. Local Browser used for validations on the Web Pages uses __________.




26. State the correct place of JS Code inside HTML -




27. Which of the following Attribute is used to include External JS code inside your HTML Document ?




28. Which attribute is used to specifies that the script is executed when the page has finished parsing (only for external scripts) ?




29. ______ attribute is used to specify the character encoding used in an external script file.




30. The async attribute can be set in the following ways -




31. We use _______ style comment to prevent showing Java Script as Content in the old browsers.




32. What will be the Output of the below Code ? <html> <body> <script type="text/javascript"> <!-- document.print("Hello"); //--> </script> </body> </html>




33. Which was the first browser to support JavaScript ?




34. JavaScript is invented by ________.




35. JavaScript was invented at _______ Lab .




36. JavaScript was originally developed under the name _______.




37. In March 1996, _______________ was released, featuring support for JavaScript.




38. Microsoft Developed a compatible dialect of JavaScript called _____________.




39. Executable single line of Script is called as _________________.




40. JavaScript Statements are executed by ________ .




41. 43. Java Statement terminated by ______________ .




42. JavaScript code contain sequence of ___________.




43. Which of the following statement is used to declare variable in JavaScript ?




44. ____________ is used to assign value to the variable.




45. What will be printed inside webpage ? var message="Hello JS"; document.write(Message);




46. Multiple JS statements are written inside pair of ________ to form a statement block.




47. Below Code contain one executive Statement. Guess the Output of the Code. <script type="text/javascript"> { document.Write("<h1>This is a heading</h1>"); } </script>




48. Group of JavaScript Statements is called as _________




49. Single Line Comment in JavaScript Starts with _________ Symbol.




50. Which of the following is considered as End of Single line comment ?




51. Comments in JS are ignored by ____________.




52. Comment Statement is _________________ type of statement.




53. JS Comment can be used for following purposes -




54. Which of the statement will be neglected by Browser ?




55. Person XYZ wrote his name and date of code creation at the start , What kind of comment he has written ?




56. Which of the following is not a compound assignment operator ?




57. If a string cannot be converted to a number __________ will be returned.




58. If the values on either side of '+' operator are numerical values then ___________.




59. What will be printed ? <html> <head> <title>A Simple Page</title> <script language="JavaScript"> <!-- var A = "Compile ", B = "Error"; C = A + B; alert(C); // --> </script> </head> <body></body> </html>




60. What will be the value of Variable 'output' ? var str = "Str"; var num = 10; var output = str + num;




61. During addition of two numbers , suppose one of the number is NaN then output of the following code will be ?




62. +Infinity in JS gets added with +Infinity then output of the code will be




63. -Infinity in JS gets added with -Infinity then output of the code will be




64. Variable can hold ________ value at a time.




65. Integer Variable is declared using following syntax in JavaScript.




66. We can declare ___________ at a time. Select most appropriate option.




67. We can declare all type of variables in JavaScript with the keyword __________




68. We can declare all type of variables in JavaScript with the keyword _____________.




69. var num; Above Statement is called as __________ Statement.




70. Variable name contain following type of characters - 1. Alphabet 2. Digits 3. Underscore 4. Special Characters Select the correct option.




71. Spaces,Punctuation marks are called as __________ Symbols in JavaScript.




72. Which JavaScript variable cannot be used as First character but can be use after first character ?




73. Multiple Declarations of variables are separated by ___________ symbol.




74. var var1 = "Pritesh"; Above variable can store value of type -




75. var var1 = "Pritesh"; Above variable can store value of type -