JavaScript Questions March 14, 2023 | No Comments 0 votes, 0 avg 542 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. The “function” and ” var” are known as: A. Keywords B. Data Types C. Declaration Statements D. Prototypes 3 / 15 3. 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 4 / 15 4. 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) 5 / 15 5. 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); 6 / 15 6. Which of the following methods is used to access HTML elements using Javascript? A. getElementById() B. getElementByClassName() C. Both A and B D. None of the above 7 / 15 7. Which of the following can be implemented using animation? A. Fireworks B. Fade Effect C. Roll-in or Roll-out D. All of the mentioned 8 / 15 8. Which is the function that calls another function after a time interval? A. setTimeout() B. setTime() C. callafter() D. timeSet() 9 / 15 9. What will be the output of the following JavaScript code with a p tag with id=demo? function myFunction() { document.getElementById("demo").innerHTML = Math.atan2(8, 4); } A. 1 B. 1.01 C. 1.05 D. 1.1 10 / 15 10. 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 11 / 15 11. 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> 12 / 15 12. Which is the correct syntax for the function definition? A. return_type function function_name(parameter1, parameter2, ...) { /*Function's body*/ } B. function function_name(parameter1, parameter2, ...) { /*Function's body*/ } C. return_type function_name(parameter1, parameter2, ...) { /*Function's body*/ } D. function function_name(parameter1, parameter2, ...) as return_type { /*Function's body*/ } 13 / 15 13. Which of the following global variables is used to get parameters? A. $HTTP_GET_VAR[] B. $HTTP_GET_VARS() C. $HTTP_GET_VARS D. $HTTP_GET_VARS[] 14 / 15 14. how can you write into HTML output using javascript? A. using innerHTML B. Using console.log() C. Using document.write() D. using window.alert() 15 / 15 15. 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 Your score is LinkedIn Facebook VKontakte 0% Restart quiz By WordPress Quiz plugin Questions, Quiz