JavaScript MCQ with Answers
- In which element we put javascript?
- The correct place to insert a JavaScript is ?
- Which of the following is the correct syntax for referring to an external script called "xxx.js"?
- How we write "Hello World" in an alert box?
- Which of the following is an IF statement in JavaScript?
- Which of the following is the correct statement of WHILE loop start?
- Which of the following is the correct statement for comment in a JavaScript?
- Is JavaScript is the same as Java?
- ____________operator is used to assign a value to a variable?
- JavaScript is case-sensitive. True or False?
- Which of the following event occurs when the user clicks on an HTML element?
- Javascript was designed for which of the following purposes
- Which of the following attribute is used to specify the character encoding used in an external script file?
- 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.
Last Updated: Jan 03, 2024
Posted in Interview Questions
.jpg)
1. In which element we put javascript?
- <javascript>
- <scripting>
- <script>
- None of These
2. The correct place to insert a JavaScript is ?
- The <head> section
- The < body> section
- Both 1 & 2
- none of these
View Answer the correct place to insert a JavaScript is The < head> section & The < body> section.
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 <script src="xxx.js"> is the correct syntax for referring to an external script called "xxx.js".
4. How we write "Hello World" in an alert box?
- alertBox("Hello World");
- msgBox("Hello World");
- msg("Hello World");
- alert("Hello World");
View Answer we write "Hello World" in an alert("Hello World");
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 if (i == 5) is an IF statement in JavaScript.
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 while (i <= 10) is the correct statement of WHILE loop start.
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 //This is a comment 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?
View Answer = 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?
- onmouseclick
- onmouseover
- onclick
- None
View Answer when the user clicks on an HTML element "onclick" event occurs.
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
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
14. Executable single line of Script is called as _________________.
- Breakpoint in JS
- Statement in JavaScript
- Line in JS
- None of the above
15. Which of the following option terminates Java Statement?
- Semicolon
- Full Stop
- Comma
- Slash
16. _________ statement is used to declare variable in JavaScript.
- Executable Statement
- Declaration Statement
- Conditional Statement
- Assignment Statement
17. ______ operator is used to concatenate two strings.
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
19. Which of the following function of Boolean object returns the primitive value of the Boolean object?
- toString()
- toSource()
- valueOf()
- None of These
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
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 JavaScript is a object-based scripting language.
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
24. Spaces,Punctuation marks are called as __________ Symbols in JavaScript.
- Special
- Punctual
- Mandetory
- None of these
25. The external JavaScript file must contain <script> tag.