JavaScript MCQ with Answers

  1. In which element we put javascript?
  2. The correct place to insert a JavaScript is ?
  3. Which of the following is the correct syntax for referring to an external script called "xxx.js"?
  4. How we write "Hello World" in an alert box?
  5. Which of the following is an IF statement in JavaScript?
  6. Which of the following is the correct statement of WHILE loop start?
  7. Which of the following is the correct statement for comment in a JavaScript?
  8. Is JavaScript is the same as Java?
  9. ____________operator is used to assign a value to a variable?
  10. JavaScript is case-sensitive. True or False?
  11. Which of the following event occurs when the user clicks on an HTML element?
  12. Javascript was designed for which of the following purposes
  13. Which of the following attribute is used to specify the character encoding used in an external script file?
  14. Executable single line of Script is called as _________________.

Take JavaScript MCQ Quiz & Online Test to Test Your Knowledge 

We have listed below the best JavaScript MCQ Questions, that check your basic knowledge of JavaScript. This JavaScript MCQ Test contains 25+ multiple-choice questions. You have to select the right answer to every question to check your final preparation. apart from this, You can also download below the JavaScript MCQ Pdf completely free.

Also, Read the Best JavaScript Interview Questions.

JavaScript MCQ

1. In which element we put javascript?

  • <javascript>
  • <scripting>
  • <script>
  • None of These
View Answer

2. The correct place to insert a JavaScript is ?

  • The <head> section
  • The < body> section
  • Both 1 & 2
  • none of these
View Answer

3. Which of the following is the correct syntax for referring to an external script called "xxx.js"?

  • <script src="xxx.js">
  • <script src="xxx.js">
  • <script name="xxx.js">
  • None of These
View Answer

4. How we write "Hello World" in an alert box?

  • alertBox("Hello World");
  • msgBox("Hello World");
  • msg("Hello World");
  • alert("Hello World");
View Answer

5. Which of the following is an IF statement in JavaScript?

  • if i = 5
  • if i = 5 then
  • if (i == 5)
  • All of these
View Answer
Download Free : JavaScript MCQ PDF

6. Which of the following is the correct statement of WHILE loop start?

  • while (i <= 10)
  • while (i <= 10; i++)
  • while i = 1 to 10
  • None of These
View Answer

7. Which of the following is the correct statement for comment in a JavaScript?

  • //This is a comment
  • /*This is a comment*/
  • $This is a comment$
  • None of These
View Answer

8. Is JavaScript is the same as Java?

  • Yes
  • No
View Answer

9. ____________operator is used to assign a value to a variable?

  • *
  • x
  • =
  • +
View Answer

10. JavaScript is case-sensitive. True or False?

  • True
  • False
View Answer

11. Which of the following event occurs when the user clicks on an HTML element?

  • onmouseclick
  • onmouseover
  • onclick
  • None
View Answer

12. Javascript was designed for which of the following purposes

  • To Style HTML Pages
  • To Perform Server Side Scripting Opertion
  • To add interactivity to HTML Pages
  • To Execute Query Related to DB on Server
View Answer

13. Which of the following attribute is used to specify the character encoding used in an external script file?

  • type
  • charset
  • character
  • All of the above
View Answer

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

  • Breakpoint in JS
  • Statement in JavaScript
  • Line in JS
  • None of the above
View Answer

15. Which of the following option terminates Java Statement?

  • Semicolon
  • Full Stop
  • Comma
  • Slash
View Answer

16. _________ statement is used to declare variable in JavaScript.

  • Executable Statement
  • Declaration Statement
  • Conditional Statement
  • Assignment Statement
View Answer

17. ______ operator is used to concatenate two strings.

  • Dot
  • Arrow
  • Comma
  • Plus

18. Which of the following operator contains JavaScript that assigns a value to a variable based on some condition?

  • Assignment operator
  • Bitwise Operator
  • Conditional operator
  • Logical Operator
View Answer

19. Which of the following function of Boolean object returns the primitive value of the Boolean object?

  • toString()
  • toSource()
  • valueOf()
  • None of These
View Answer

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

  • FileUpload
  • Date
  • Function
  • File

21. Which of the following is the correct syntax to display "OnlineInterviewQuestions" in an alert box using JavaScript?

  • alert("OnlineInterviewQuestions");
  • confirm("OnlineInterviewQuestions");
  • msgbox("OnlineInterviewQuestions");
  • None of the above
View Answer

22. Which of the following is correct about features of Javascript?

  • It can not Handling dates and time.
  • JavaScript is a object-based scripting language.
  • JavaScript is not interpreter based scripting language.
  • None of the above
View Answer

23. What are variables used for in Javascript programs?

  • Varying randomly
  • Storing numbers, dates, or other values
  • Causing high-school algebra flashbacks
  • None of the above
View Answer

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

  • Special
  • Punctual
  • Mandetory
  • None of these
View Answer

25. The external JavaScript file must contain &lt;script> tag.

  • True
  • False