JavaScript MCQ Quiz | Set – 2Piyush PatilMay 1, 2023JavaScript Quiz, Quizzes, Web Development Share your love 127 Created on April 25, 2023 By Piyush PatilJavaScript Quiz | Set - 2 1 / 20Javascript is an _______ language? Object-Oriented Object-Based Procedural None of the above 2 / 20Which of the following keywords is used to define a variable in Javascript? var let const All of the above 3 / 20Which of the following methods is used to access HTML elements using Javascript? getElementById() getElementByClassName() Both A and B None of the above 4 / 20 Which of the following is not a JavaScript reserved word? return main switch if 5 / 20What is the output of the following code?var a = 10;var b = "20";var c = 30;console.log(a + b + c); "102030" 60 "1030" "2030" 6 / 20What is the purpose of the 'break' statement in JavaScript? To terminate a loop or switch statement To skip a loop iteration To continue to the next iteration of a loop None of the above 7 / 20What is the difference between 'let' and 'var' in JavaScript? 'let' has block scope, while 'var' has function scope. 'var' has block scope, while 'let' has function scope. Both have the same scope. None of the above. 8 / 20Which of the following is not a valid way to declare a JavaScript function? function myFunction() {} var myFunction = function() {} const myFunction = () => {} All of the above are valid ways to declare a JavaScript function. 9 / 20What is the output of the following code?var a = [1, 2, 3];console.log(a instanceof Array); true false TypeError SyntaxError 10 / 20What is the difference between 'null' and 'undefined' in JavaScript? 'null' means a variable has no value assigned, while 'undefined' means a variable has been declared but not assigned a value. 'undefined' means a variable has no value assigned, while 'null' means a variable has been declared but not assigned a value. Both mean the same thing in JavaScript. None of the above. 11 / 20What is the output of the following code?var a = 10;function myFunction() {console.log(a);var a = 20;}myFunction(); 10 20 undefined ReferenceError 12 / 20What is the output of the following code?console.log(typeof [] === "object"); true false [] is not a valid data type in JavaScript TypeError 13 / 20What is the difference between 'const' and 'let' in JavaScript? 'const' variables cannot be reassigned, while 'let' variables can be. 'let' variables cannot be reassigned, while 'const' variables can be. Both 'const' and 'let' variables cannot be reassigned. None of the above. 14 / 20What is the output of the following code?console.log(+"5"); "5" 5 NaN TypeError 15 / 20Which of the following is not a valid JavaScript event handler? onclick onmouseover ondragstart onloadstart 16 / 20What is the output of the following code?console.log("2" + 2); "22" "4" 4 TypeError 17 / 20What is the difference between '== and '!=' operators in JavaScript? '==' means equal to, while '!=' means not equal to. '!=' means equal to, while '==' means not equal to. Both operators are identical in their functionality. None of the above. 18 / 20What is the difference between '===' and '!==' operators in JavaScript? '===' checks for both value and type equality, while '!==' checks for only value inequality. '!==' checks for both value and type inequality, while '===' checks for only value equality. Both operators are identical in their functionality. None of the above. 19 / 20Which of the following is a valid JavaScript method to remove an element from an array? array.remove(element); array.splice(element); array.pop(); All of the above are valid. 20 / 20What is the output of the following code?console.log(typeof NaN === "number"); true false NaN is not a valid data type in JavaScript TypeError Your score isThe average score is 51% LinkedIn Facebook VKontakte 0% Restart quiz Share your love Previous Post Jelly Bubble Animation using HTML and CSS Next Post Think Create Cycle Animation using HTML and CSS
Crafting a 3D Police Squad Car with Pure CSSPiyush PatilDecember 18, 2024HTML & CSS, Frontend, Web Design, Web Development
Building a Pure CSS 3D KitchenPiyush PatilDecember 16, 2024Beginner, Frontend, HTML & CSS, Web Design, Web Development
Creating a CSS 3D Chess Board with PiecesPiyush PatilDecember 14, 2024HTML & CSS, Web Design, Web Development