JavaScript Questions March 14, 2023 | No Comments 0 votes, 0 avg 474 123456789101112131415 JavaScript Questions 1 / 15 1. In JavaScript, what is a block of statement? A. Conditional block B. block that combines a number of statements into a single compound statement C. both conditional block and a single statement D. block that contains a single statement 2 / 15 2. What will be the output of the following JavaScript code? let cars = ['Honda', 'Hyundai']; cars.push('Mahindra'); document.write(typeof cars + " " + cars); A. array Honda,Hyundai,Mahindra B. string Honda,Hyundai,Mahindra C. object Honda,Hyundai,Mahindra D. object "Honda", "Hyundai", "Mahindra" 3 / 15 3. The “function” and ” var” are known as: A. Keywords B. Data Types C. Declaration Statements D. Prototypes 4 / 15 4. What will be the output of the following JavaScript code? const prototype1 = {}; const object1 = Object.create(prototype1); console.log(Object.getPrototypeOf(object1) === prototype1); A. True B. error C. zero D. False 5 / 15 5. What will be the output of the following JavaScript code? let x = "10"; let y = + x; document.write(typeof y); A. string B. object C. undefined D. number 6 / 15 6. 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 7 / 15 7. Where is Client-side JavaScript code is embedded within HTML documents? A. A URL that uses the special javascript:code B. A URL that uses the special javascript:protocol C. A URL that uses the special javascript:encoding D. A URL that uses the special javascript:stack 8 / 15 8. What will be the output of the following code snippet? var a = 1; var b = 0; while (a <= 3) { a++; b += a * 2; print(b); } A. 1 2 3 B. 4 10 18 C. 1 4 7 D. None of the above 9 / 15 9. What will be the output of the following code snippet? var a = "Scaler"; var result = a.substring(2, 4); document.write(result); A. al B. ale C. cal D. caler 10 / 15 10. If A is the superclass and B is the subclass, then subclass inheriting the superclass can be represented as _________ A. B=inherit(A); B. B=A.inherit(); C. B.prototype=inherit(A); D. B.prototype=inherit(A.prototype); 11 / 15 11. Which collection object allows unique value to be inserted only once? A. Object B. Set C. Array D. Map 12 / 15 12. 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> 13 / 15 13. 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 14 / 15 14. 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 15 / 15 15. What will be the function of the following JavaScript program? var scope = "js scope"; function checkscope() { var scope = "javascript scope"; function f() { return scope; } return f; } A. Returns the value in scope B. Returns value null C. Shows an error message D. Returns exception Your score is LinkedIn Facebook Twitter VKontakte 0% Restart quiz Questions, Quiz