JavaScript Questions March 14, 2023 | No Comments 0 votes, 0 avg 575 123456789101112131415 JavaScript Questions 1 / 15 1. What is the prototype represents in the following JavaScript code snippet? function javascript() {}; A. Not valid B. Protoype of a function C. Function javascript D. A custom constructor 2 / 15 2. What will be the output of the following JavaScript code? const arr = [10, 20, 30]; let result = 0; arr.forEach(myFunction); document.write("Result: " , result) function myFunction(value, index, array) { result += value; } A. Result: 60 B. Result: 102030 C. Result: 10,20,30 D. ValueError 3 / 15 3. What is the use of the noscript tag in Javascript? A. The contents are displayed by non-JS-based browser B. clears all cookies ans cache C. both A and B D. None of the above 4 / 15 4. Which is the correct syntax to call an external JavaScript file in the current HTML document? A. <script src="jsfile.js"></script> B. <script href=" jsfile.js"></script> C. <import src=" jsfile.js"></import> D. <script link=" jsfile.js"></script> 5 / 15 5. What will be the output of the following code snippet? const obj1 = {Name: "Hello", Age: 16}; const obj2 = {Name: "Hello", Age: 16}; print(obj1 === obj2); A. 1 B. Undefined C. None of the above 6 / 15 6. When the switch statement matches the expression with the given labels, how is the comparison done? A. Both the datatype and the result of the expression is compared B. only the datatype of the expression is compared C. only the value of the expression is compared D. none of the above 7 / 15 7. How are windows, tabs, iframes, and frames treated according to client-side javascript? A. They are all browsing contexts B. They are all browsing information C. They are all Window contexts D. They are all Window objects 8 / 15 8. What will be the output of the following JavaScript code If these is a p tag element with id=”demo”? var numbers1 = [4, 9]; var numbers2 = numbers1.map(myFunction); document.getElementById("demo").innerHTML = numbers2; function myFunction(value, index, array) { return value * 2; } A. 8 9 B. 8 18 C. 4 9 D. error 9 / 15 9. What will be the output of the following JavaScript code? const curr = new Date(); document.write(curr); A. Tue Dec 21 2021 13:04:36 GMT+0530 B. Tue Dec 21 2021 13:04:36 (India Standard Time) C. Tue Dec 21 2021 13:04:36::00::01 GMT+0530 (India Standard Time) D. Tue Dec 21 2021 13:04:36 GMT+0530 (India Standard Time) 10 / 15 10. Which of the following is not considered as an error in javascript? A. syntax error B. missing of semicolon C. division by zero D. missing of bracket 11 / 15 11. Which of the following is the correct way for writing Java Script array? A. var salaries = new Array(1:39438, 2:39839 3:83729) B. var salaries = new (Array1=39438, Array 2=39839 Array 3=83729) C. var salaries = new Array(39438, 39839,83729) D. var salaries = new Array() values = 39438, 39839 83729 12 / 15 12. Which statement creates a new object using the Person constructor? A. var student = construct Person; B. var student = new Person(); C. var student = Person(); D. var student = construct Person(); 13 / 15 13. Which property references the DOM object that dispatched an event? A. self B. object C. target D. source 14 / 15 14. What will be the output of the following code snippet? function solve(arr, rotations){ if(rotations == 0) return arr; for(let i = 0; i < rotations; i++){ let element = arr.pop(); arr.unshift(element); } return arr; } // solve([44, 1, 22, 111], 5); A. [111, 44, 1, 22] B. [44, 1, 22, 111] C. [111, 22, 1, 44] D. [1, 22, 111, 44] 15 / 15 15. Which object serves as the global object at the top of the scope chain? A. Hash B. Property C. Element D. Window Your score is LinkedIn Facebook VKontakte 0% Restart quiz By WordPress Quiz plugin Questions, Quiz