{"id":36574,"date":"2025-12-31T02:26:37","date_gmt":"2025-12-30T20:56:37","guid":{"rendered":"https:\/\/codeforgeek.com\/?p=36574"},"modified":"2025-12-31T02:26:40","modified_gmt":"2025-12-30T20:56:40","slug":"100-javascript-mcq","status":"publish","type":"post","link":"https:\/\/codeforgeek.com\/100-javascript-mcq\/","title":{"rendered":"100 JavaScript MCQ with Answers (2026 Edition)"},"content":{"rendered":"\n<p>Answering JavaScript MCQ or JavaScript quiz questions is a great way to prepare for coding interviews, online tests, competitive exams, or just to test your JS skills.<\/p>\n\n\n\n<p>These MCQs cover important concepts such as variables, data types, functions, loops, operators, the DOM, asynchronous programming, ES6 features, and much more.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">JavaScript Multiple Choice Questions<\/h2>\n\n\n\n<p>JavaScript is one of the most widely used programming languages in the world, especially for web development, and practising JavaScript MCQ questions is a smart way to test your knowledge, revise important topics, and recall fundamental concepts.<\/p>\n\n\n\n<p>Go through each JavaScript quiz, think about the answer, and then click \u201cShow Answer\u201d to check your response.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Q1. What is JavaScript mainly used for on websites?<\/h3>\n\n\n\n<p>A. Designing the layout<br>B. Styling text<br>C. Adding interaction and dynamic behavior<br>D. Hosting the website online<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> C<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q2. Which JavaScript command is used to show a popup alert message?<\/h3>\n\n\n\n<p>A. popup()<br>B. show()<br>C. alert()<br>D. notify()<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> C<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q3. Which keyword allows you to declare a variable that can be reassigned later?<\/h3>\n\n\n\n<p>A. const<br>B. let<br>C. fixed<br>D. define<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> B<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q4. Which of the following is a valid JavaScript variable name?<\/h3>\n\n\n\n<p>A. 3name<br>B. name#<br>C. _name<br>D. first-name<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> C<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q5. What data type is used to store true or false values in JavaScript?<\/h3>\n\n\n\n<p>A. Number<br>B. Boolean<br>C. String<br>D. LogicalType<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> B<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q6. What does the value \u2018undefined\u2019 usually represent in JavaScript?<\/h3>\n\n\n\n<p>A. A variable without a value assigned<br>B. A broken script<br>C. A false condition<br>D. A number conversion error<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> A<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q7. What will console.log(typeof null) output in JavaScript?<\/h3>\n\n\n\n<p>A. &#8216;null&#8217;<br>B. &#8216;object&#8217;<br>C. &#8216;undefined&#8217;<br>D. &#8216;number&#8217;<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> B<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q8. JavaScript is considered which type of language?<\/h3>\n\n\n\n<p>A. Strongly typed<br>B. Loosely typed<br>C. Machine language<br>D. Assembly language<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> B<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q9. Which operator checks both value and data type?<\/h3>\n\n\n\n<p>A. ==<br>B. ===<br>C. =<br>D. !==<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> B<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q10. What is the output of console.log(5);?<\/h3>\n\n\n\n<p>A. &#8216;5&#8217;<br>B. undefined<br>C. 5<br>D. null<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> C<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q11. What is JavaScript?<\/h3>\n\n\n\n<p>A. A markup language<br>B. A database language<br>C. A scripting language used mainly for web browsers<br>D. A server operating system<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> C<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q12. Which statement is used to repeat a block of code a specific number of times?<\/h3>\n\n\n\n<p>A. repeat<br>B. for<br>C. if<br>D. check<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> B<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q13. What does an if statement do in JavaScript?<\/h3>\n\n\n\n<p>A. Declares a constant<br>B. Runs code only when a condition is true<br>C. Stops execution<br>D. Creates a loop<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> B<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q14. Which of the following is NOT a loop in JavaScript?<\/h3>\n\n\n\n<p>A. for<br>B. while<br>C. loop<br>D. do-while<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> C<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q15. Which keyword is commonly used to exit a switch case?<\/h3>\n\n\n\n<p>A. stop<br>B. end<br>C. break<br>D. close<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> C<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q16. Which operator is known as the \u201cstrict equality\u201d operator?<\/h3>\n\n\n\n<p>A. =<br>B. ==<br>C. ===<br>D. !=<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> C<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q17. Which keyword is used to declare a block-scoped variable?<\/h3>\n\n\n\n<p>A. var<br>B. let<br>C. define<br>D. scope<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> B<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q18. What is JavaScript most commonly executed by?<\/h3>\n\n\n\n<p>A. The web browser<br>B. The server hardware<br>C. The database engine<br>D. The operating system kernel<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> A<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q19. Which symbol is used for comments that span only one line?<\/h3>\n\n\n\n<p>A. #<br>B. \/\/<br>C. &#8212;<br>D. **<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> B<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q20. Which of the following describes ECMAScript?<\/h3>\n\n\n\n<p>A. A browser<br>B. The official standard that JavaScript follows<br>C. A CSS library<br>D. A database engine<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> B<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q21. What is a function in JavaScript?<\/h3>\n\n\n\n<p>A. A CSS property<br>B. A reusable block of code<br>C. A database query<br>D. A browser event<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> B<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q22. How do you define a function in JavaScript?<\/h3>\n\n\n\n<p>A. function myFunc() {}<br>B. create myFunc() {}<br>C. define myFunc() {}<br>D. call myFunc() {}<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> A<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q23. What will console.log(4 + 6) output?<\/h3>\n\n\n\n<p>A. 10<br>B. &#8220;10&#8221;<br>C. 46<br>D. undefined<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> A<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q24. Which keyword is used to create a constant value in JavaScript?<\/h3>\n\n\n\n<p>A. let<br>B. const<br>C. var<br>D. constant<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> B<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q25. What is a JavaScript variable?<\/h3>\n\n\n\n<p>A. A place to store data values<br>B. A web server<br>C. A browser shortcut<br>D. A CSS effect<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> A<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q26. Which function converts a JSON string into a JavaScript object?<\/h3>\n\n\n\n<p>A. JSON.stringify()<br>B. JSON.parse()<br>C. JSON.convert()<br>D. JSON.decode()<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> B<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q27. What is a closure in JavaScript?<\/h3>\n\n\n\n<p>A. A way to delete variables<br>B. A function with access to its outer scope<br>C. A security feature<br>D. A loop structure<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> B<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q28. What is hoisting in JavaScript?<\/h3>\n\n\n\n<p>A. Removing variables<br>B. Moving declarations to the top<br>C. Encrypting code<br>D. Downloading scripts online<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> B<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q29. What is an arrow function?<\/h3>\n\n\n\n<p>A. A loop type<br>B. A shorter way to write functions<br>C. A DOM element<br>D. A CSS selector<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> B<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q30. What is the purpose of the return statement in a function?<\/h3>\n\n\n\n<p>A. To stop the browser<br>B. To exit the function and send back a value<br>C. To refresh the page<br>D. To declare a variable<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> B<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q31. What is a JavaScript object?<\/h3>\n\n\n\n<p>A. A list of ordered values<br>B. A collection of key\u2013value pairs<br>C. A database table<br>D. A CSS class<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> B<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q32. Which symbol is used to access object properties?<\/h3>\n\n\n\n<p>A. :<br>B. .<br>C. #<br>D. *<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> B<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q33. What does the spread operator (\u2026) do with arrays?<\/h3>\n\n\n\n<p>A. Compresses them<br>B. Expands elements individually<br>C. Deletes values<br>D. Sorts values alphabetically<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> B<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q34. What is a template literal in JavaScript?<\/h3>\n\n\n\n<p>A. A string inside quotes<br>B. A string written with backticks allowing interpolation<br>C. A JSON object<br>D. A CSS style rule<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> B<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q35. What does the this keyword usually refer to inside a method?<\/h3>\n\n\n\n<p>A. The global object only<br>B. The current object<br>C. A random value<br>D. The DOM tree root<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> B<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q36. What is an array in JavaScript?<\/h3>\n\n\n\n<p>A. A single number<br>B. A function<br>C. A list of ordered values<br>D. A Boolean value<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> C<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q37. Which method adds a new element to the end of an array?<\/h3>\n\n\n\n<p>A. push()<br>B. pop()<br>C. shift()<br>D. join()<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> A<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q38. Which built-in method removes the last array element?<\/h3>\n\n\n\n<p>A. delete()<br>B. pop()<br>C. remove()<br>D. trim()<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> B<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q39. What is the DOM in JavaScript?<\/h3>\n\n\n\n<p>A. A database<br>B. A programming language<br>C. A representation of the HTML page structure<br>D. A CSS rule system<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> C<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q40. Which method selects the first element that matches a CSS selector?<\/h3>\n\n\n\n<p>A. getElement()<br>B. select()<br>C. querySelector()<br>D. findElement()<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> C<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q41. What is an event in JavaScript?<\/h3>\n\n\n\n<p>A. A CSS change<br>B. A browser notification<br>C. A user action like click or keypress<br>D. A server update<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> C<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q42. Which method prevents a default browser action like form submit?<\/h3>\n\n\n\n<p>A. stop()<br>B. preventDefault()<br>C. cancel()<br>D. block()<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> B<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q43. What is the Fetch API used for?<\/h3>\n\n\n\n<p>A. Styling elements<br>B. Sending HTTP requests<br>C. Animating images<br>D. Storing cookies<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> B<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q44. What is NaN in JavaScript?<\/h3>\n\n\n\n<p>A. Null value<br>B. Not a Number<br>C. A Boolean<br>D. A function name<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> B<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q45. Which keyword is used to write an asynchronous function?<\/h3>\n\n\n\n<p>A. await<br>B. async<br>C. defer<br>D. promise<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> B<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q46. What does the JavaScript debugger statement do?<\/h3>\n\n\n\n<p>A. Deletes variables<br>B. Acts as a breakpoint during debugging<br>C. Restarts the script<br>D. Closes the browser tab<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> B<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q47. What is a Promise in JavaScript?<\/h3>\n\n\n\n<p>A. A loop<br>B. A placeholder for a future value<br>C. A string method<br>D. A DOM element type<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> B<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q48. What is the purpose of the await keyword?<\/h3>\n\n\n\n<p>A. To pause execution until a Promise is resolved<br>B. To declare a function<br>C. To create a loop<br>D. To define a variable<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> A<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q49. What will console.log(NaN === NaN) return?<\/h3>\n\n\n\n<p>A. true<br>B. false<br>C. undefined<br>D. error<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> B<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q50. What does the toString() method do?<\/h3>\n\n\n\n<p>A. Converts a string to a number<br>B. Converts a value to a string<br>C. Converts text to upper case<br>D. Removes spaces from text<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> B<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q51. Which array method runs a function on every element?<\/h3>\n\n\n\n<p>A. loop()<br>B. repeat()<br>C. forEach()<br>D. every()<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> C<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q52. What does toLocaleString() generally return?<\/h3>\n\n\n\n<p>A. A browser language code<br>B. A number formatted based on the user\u2019s region<br>C. A CSS color name<br>D. A JSON object string<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> B<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q53. Which method replaces part of a string using a pattern?<\/h3>\n\n\n\n<p>A. change()<br>B. swap()<br>C. replace()<br>D. update()<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> C<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q54. What does the map() method return?<\/h3>\n\n\n\n<p>A. The same array modified<br>B. A new array with transformed values<br>C. A Boolean result<br>D. A random number<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> B<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q55. Which of the following is true about JavaScript variable names?<\/h3>\n\n\n\n<p>A. They must start with a letter or _<br>B. They are case-sensitive<br>C. Both A and B<br>D. None of the above<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> C<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q56. Which command prints the current page?<\/h3>\n\n\n\n<p>A. print.page()<br>B. browser.print()<br>C. window.print()<br>D. page.print()<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> C<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q57. What is a global variable in JavaScript?<\/h3>\n\n\n\n<p>A. A variable created inside a function<br>B. A variable available everywhere<br>C. A constant value<br>D. A built-in object property<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> B<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q58. Which property returns the length of a string?<\/h3>\n\n\n\n<p>A. value<br>B. count<br>C. length<br>D. size<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> C<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q59. What does valueOf() return when used on a Boolean?<\/h3>\n\n\n\n<p>A. A string<br>B. A number<br>C. The primitive Boolean value<br>D. undefined<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> C<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q60. Which method converts a string to lowercase?<\/h3>\n\n\n\n<p>A. lower()<br>B. toLowerCase()<br>C. caseLower()<br>D. stringLower()<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> B<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q61. What is an arrow function commonly used for?<\/h3>\n\n\n\n<p>A. Shorter function expressions<br>B. Loop creation<br>C. Styling pages<br>D. Storing data in localStorage<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> A<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q62. Which JavaScript array method removes and returns the last element?<\/h3>\n\n\n\n<p>A. pop()<br>B. remove()<br>C. last()<br>D. tail()<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> A<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q63. Which method converts an array into a string?<\/h3>\n\n\n\n<p>A. stringify()<br>B. toString()<br>C. convert()<br>D. cast()<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> B<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q64. Which HTML tag is used to include JavaScript code?<\/h3>\n\n\n\n<p>A. &lt;code&gt;<br>B. &lt;js&gt;<br>C. &lt;script&gt;<br>D. &lt;run&gt;<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> C<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q65. How do you access an element with id=&#8221;title&#8221; in JavaScript?<\/h3>\n\n\n\n<p>A. document.get(&#8220;title&#8221;)<br>B. document.title()<br>C. document.getElementById(&#8220;title&#8221;)<br>D. document.id(&#8220;title&#8221;)<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> C<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q66. How do you link an external JavaScript file named app.js?<\/h3>\n\n\n\n<p>A. &lt;script file=&#8221;app.js&#8221;&gt;&lt;\/script&gt;<br>B. &lt;script src=&#8221;app.js&#8221;&gt;&lt;\/script&gt;<br>C. &lt;js src=&#8221;app.js&#8221;&gt;&lt;\/js&gt;<br>D. &lt;script href=&#8221;app.js&#8221;&gt;&lt;\/script&gt;<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> B<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q67. What will console.log(5 + &#8220;5&#8221;) output?<\/h3>\n\n\n\n<p>A. 10<br>B. &#8220;10&#8221;<br>C. &#8220;55&#8221;<br>D. error<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> C<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q68. What does lastIndexOf() return when the value is not found?<\/h3>\n\n\n\n<p>A. 0<br>B. null<br>C. undefined<br>D. \u22121<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> D<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q69. Is JavaScript the same as Java?<\/h3>\n\n\n\n<p>A. Yes<br>B. No<br>C. Only in ES6<br>D. Only in web browsers<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> B<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q70. What will eval(&#8220;3 * 4&#8221;) return?<\/h3>\n\n\n\n<p>A. &#8220;12&#8221;<br>B. 12<br>C. 34<br>D. 3.4<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> B<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q71. Which method selects all matching elements in the DOM?<\/h3>\n\n\n\n<p>A. querySelector()<br>B. querySelectorAll()<br>C. getElement()<br>D. selectAll()<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> B<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q72. Which queue handles Promise callbacks?<\/h3>\n\n\n\n<p>A. Render queue<br>B. Task queue<br>C. Microtask queue<br>D. Event queue<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> C<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q73. Which HTTP header helps prevent clickjacking?<\/h3>\n\n\n\n<p>A. Cache-Control<br>B. Content-Type<br>C. X-Frame-Options<br>D. Access-Control-Allow-Methods<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> C<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q74. Why is eval() generally avoided?<\/h3>\n\n\n\n<p>A. It is slow<br>B. It can be unsafe with user input<br>C. It increases code size<br>D. All of the above<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> D<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q75. Which command is used to install a package in Node.js?<\/h3>\n\n\n\n<p>A. node install<br>B. install npm<br>C. npm install<br>D. npm run install<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> C<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q76. Which method reads a file asynchronously in Node.js?<\/h3>\n\n\n\n<p>A. fs.read()<br>B. fs.readFile()<br>C. fs.readFileSync()<br>D. fs.openFile()<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> B<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q77. Which Web API allows storing data in the browser that remains even after closing the tab?<\/h3>\n\n\n\n<p>A. sessionStorage<br>B. localStorage<br>C. cacheStorage<br>D. clipboard API<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> B<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q78. Which DOM property returns the parent element of a node?<\/h3>\n\n\n\n<p>A. parentElement<br>B. rootNode<br>C. ownerNode<br>D. baseNode<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> A<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q79. Which Promise method resolves as soon as any promise is settled?<\/h3>\n\n\n\n<p>A. Promise.all()<br>B. Promise.allSettled()<br>C. Promise.race()<br>D. Promise.resolve()<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> C<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q80. What type of scope is created when using let inside a block?<\/h3>\n\n\n\n<p>A. Function scope<br>B. Global scope<br>C. Class scope<br>D. Block scope<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> D<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q81. Which built-in function returns the smallest value?<\/h3>\n\n\n\n<p>A. Math.smallest()<br>B. Math.min()<br>C. Math.low()<br>D. Math.floor()<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> B<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q82. Which event fires when a user clicks an element?<\/h3>\n\n\n\n<p>A. onchange<br>B. onhover<br>C. onclick<br>D. onpress<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> C<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q83. What is the difference between JavaScript and Java?<\/h3>\n\n\n\n<p>A. They are the same<br>B. JavaScript is mainly browser-based scripting<br>C. JavaScript is compiled<br>D. JavaScript is a database language<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> B<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q84. Which method rounds a number to the nearest integer?<\/h3>\n\n\n\n<p>A. Math.floor()<br>B. Math.ceil()<br>C. Math.round()<br>D. Math.fix()<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> C<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q85. Which of the following correctly creates an array?<\/h3>\n\n\n\n<p>A. var list = {1,2,3}<br>B. var list = [1,2,3]<br>C. var list = (1,2,3)<br>D. var list = &#8220;1,2,3&#8221;<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> B<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q86. Which syntax correctly starts a for loop?<\/h3>\n\n\n\n<p>A. for (i &lt; 5; i++)<br>B. for i = 1 to 5<br>C. for (i = 0; i &lt; 5; i++)<br>D. loop(i &lt; 5)<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> C<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q87. Which syntax correctly starts a while loop?<\/h3>\n\n\n\n<p>A. while i &lt; 10<br>B. while (i &lt; 10)<br>C. loop while (i &lt; 10)<br>D. repeat (i &lt; 10)<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> B<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q88. Which operator checks if two values are not equal?<\/h3>\n\n\n\n<p>A. !=<br>B. &lt;&gt;<br>C. !===<br>D. not=<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> A<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q89. Which operator checks strict equality?<\/h3>\n\n\n\n<p>A. =<br>B. ==<br>C. ===<br>D. eq<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> C<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q90. How do you call a JavaScript function named runTest?<\/h3>\n\n\n\n<p>A. function runTest<br>B. call runTest<br>C. exec runTest()<br>D. runTest()<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> D<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q91. Which syntax correctly defines a function?<\/h3>\n\n\n\n<p>A. define run(){}<br>B. function run(){}<br>C. create run(){}<br>D. make run(){}<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> B<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q92. Which syntax correctly writes a multi-line comment?<\/h3>\n\n\n\n<p>A. # comment<br>B. \/\/ comment<br>C. &lt;!&#8211; comment &#8211;&gt;<br>D. \/* comment *\/<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> D<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q93. Which syntax correctly writes a single-line comment?<\/h3>\n\n\n\n<p>A. # comment<br>B. \/\/ comment<br>C. \/* comment *\/<br>D. &#8212; comment<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> B<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q94. Is JavaScript case-sensitive?<\/h3>\n\n\n\n<p>A. Yes<br>B. No<br>C. Only variable names<br>D. Only functions<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> A<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q95. Where can JavaScript code be placed in an HTML page?<\/h3>\n\n\n\n<p>A. Only in the head<br>B. Only in the body<br>C. Either head or body<br>D. Only in external files<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> C<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q96. What is the type of null in JavaScript?<\/h3>\n\n\n\n<p>A. null<br>B. object<br>C. undefined<br>D. number<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> B<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q97. Which keyword declares a variable with block scope?<\/h3>\n\n\n\n<p>A. global<br>B. var<br>C. let<br>D. scope<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> C<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q98. Which operator checks equality without converting types?<\/h3>\n\n\n\n<p>A. ==<br>B. ===<br>C. !=<br>D. =<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> B<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q99. What does NaN stand for in JavaScript?<\/h3>\n\n\n\n<p>A. Not a Number<br>B. New and Null<br>C. None Available Now<br>D. Numeric and Null<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> A<\/p><\/details>\n\n\n\n<h3 class=\"wp-block-heading\">Q100. What feature allows using \u201cawait\u201d outside of functions in modern JavaScript modules?<\/h3>\n\n\n\n<p>A. Async IIFE<br>B. Top-level await<br>C. Global await mode<br>D. Module async mode<\/p>\n\n\n\n<details><summary><strong>Show Answer<\/strong><\/summary><p><strong>Answer:<\/strong> B<\/p><\/details>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>Practising JavaScript MCQ and quiz questions is one of the best ways to revise concepts and get ready for interviews or coding rounds. Keep learning and exploring new questions to build confidence. You can also go through these <a href=\"https:\/\/codeforgeek.com\/top-50-javascript-interview-questions-and-answers\/\">Top 50 JavaScript Interview Questions and Answers <\/a>for deeper interview preparation.<\/p>\n\n\n\n<p><strong>Resources and References<\/strong>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Learn JavaScript on MDN Web Docs<br><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/JavaScript\" target=\"_blank\" rel=\"noopener\">https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/JavaScript<\/a><\/li>\n\n\n\n<li>Read the ECMAScript Official Language Specification<br><a href=\"https:\/\/tc39.es\/ecma262\/\" target=\"_blank\" rel=\"noopener\">https:\/\/tc39.es\/ecma262\/<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Answering JavaScript MCQ or JavaScript quiz questions is a great way to prepare for coding interviews, online tests, competitive exams, or just to test your JS skills. These MCQs cover important concepts such as variables, data types, functions, loops, operators, the DOM, asynchronous programming, ES6 features, and much more. JavaScript Multiple Choice Questions JavaScript is [&hellip;]<\/p>\n","protected":false},"author":79,"featured_media":36607,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_surecart_dashboard_logo_width":"180px","_surecart_dashboard_show_logo":true,"_surecart_dashboard_navigation_orders":true,"_surecart_dashboard_navigation_invoices":true,"_surecart_dashboard_navigation_subscriptions":true,"_surecart_dashboard_navigation_downloads":true,"_surecart_dashboard_navigation_billing":true,"_surecart_dashboard_navigation_account":true,"_uag_custom_page_level_css":"","footnotes":""},"categories":[9],"tags":[],"class_list":["post-36574","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-js"],"blocksy_meta":[],"uagb_featured_image_src":{"full":["https:\/\/codeforgeek.com\/wp-content\/uploads\/2025\/12\/JavaScript-Quiz-Time.png",1920,1080,false],"thumbnail":["https:\/\/codeforgeek.com\/wp-content\/uploads\/2025\/12\/JavaScript-Quiz-Time-150x150.png",150,150,true],"medium":["https:\/\/codeforgeek.com\/wp-content\/uploads\/2025\/12\/JavaScript-Quiz-Time-300x169.png",300,169,true],"medium_large":["https:\/\/codeforgeek.com\/wp-content\/uploads\/2025\/12\/JavaScript-Quiz-Time-768x432.png",768,432,true],"large":["https:\/\/codeforgeek.com\/wp-content\/uploads\/2025\/12\/JavaScript-Quiz-Time-1024x576.png",1024,576,true],"1536x1536":["https:\/\/codeforgeek.com\/wp-content\/uploads\/2025\/12\/JavaScript-Quiz-Time-1536x864.png",1536,864,true],"2048x2048":["https:\/\/codeforgeek.com\/wp-content\/uploads\/2025\/12\/JavaScript-Quiz-Time.png",1920,1080,false]},"uagb_author_info":{"display_name":"Aditya Gupta","author_link":"https:\/\/codeforgeek.com\/author\/aditya\/"},"uagb_comment_info":0,"uagb_excerpt":"Answering JavaScript MCQ or JavaScript quiz questions is a great way to prepare for coding interviews, online tests, competitive exams, or just to test your JS skills. These MCQs cover important concepts such as variables, data types, functions, loops, operators, the DOM, asynchronous programming, ES6 features, and much more. JavaScript Multiple Choice Questions JavaScript is&hellip;","_links":{"self":[{"href":"https:\/\/codeforgeek.com\/wp-json\/wp\/v2\/posts\/36574","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codeforgeek.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codeforgeek.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codeforgeek.com\/wp-json\/wp\/v2\/users\/79"}],"replies":[{"embeddable":true,"href":"https:\/\/codeforgeek.com\/wp-json\/wp\/v2\/comments?post=36574"}],"version-history":[{"count":0,"href":"https:\/\/codeforgeek.com\/wp-json\/wp\/v2\/posts\/36574\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/codeforgeek.com\/wp-json\/wp\/v2\/media\/36607"}],"wp:attachment":[{"href":"https:\/\/codeforgeek.com\/wp-json\/wp\/v2\/media?parent=36574"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codeforgeek.com\/wp-json\/wp\/v2\/categories?post=36574"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codeforgeek.com\/wp-json\/wp\/v2\/tags?post=36574"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}