JavaScript Questions March 14, 2023 | No Comments 0 votes, 0 avg 558 123456789101112131415 JavaScript Questions 1 / 15 1. Which function is used to serialize an object into a JSON string in Javascript? A. Stringify() B. parse() C. convert() D. None of the above 2 / 15 2. Why is this keyword is not preferred in javascript? A. Highly memory consuming B. Functions should access the global objects C. Functions should not access the global objects D. Very inefficient to use 3 / 15 3. Among the given statements, which statement defines closures in JavaScript? A. JavaScript is a function that is enclosed with references to its inner function scope B. JavaScript is a function that is enclosed with references to its lexical environment C. JavaScript is a function that is enclosed with the object to its inner function scope D. None of the mentioned 4 / 15 4. Which of the following is correct about JavaScript? A. JavaScript is an Object-Based language B. JavaScript is Assembly-language C. JavaScript is an Object-Oriented language D. JavaScript is a High-level language 5 / 15 5. Which JavaScript method is used to access an HTML element by id? A. getElementByID() B. getElement(Id) C. getElementById(id) D. elementById(id) 6 / 15 6. Which object serves as the global object at the top of the scope chain? A. Hash B. Property C. Element D. Window 7 / 15 7. Which object in Javascript doesn’t have a prototype? A. Base Objects B. All Objects have prototype C. None of the objects have prototype D. None of the above 8 / 15 8. What will be the output of the following JavaScript code? function printArray(a) { var len = a.length, i = 0; if (len == 0) console.log("Empty Array"); else { // do-while loop in javascript do { console.log(a[i]); } while (++i < len); } } A. Prints “Empty Array” B. Prints 0 to the length of the array C. Prints the numbers in the array in order D. Prints the numbers in the array in the reverse order 9 / 15 9. What will be the output of the following JavaScript code? // Javascript code to compare the height function height() { var height = 123.56; var type = (height>=190) ? "tall" : "short"; return type; } A. short B. 123.56 C. tall D. 190 10 / 15 10. What will be the output of the following code snippet? (function(a){ return (function(){ console.log(a); a = 6; })() })(21); A. 6 B. NaN C. 21 D. runtime error 11 / 15 11. 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 12 / 15 12. JavaScript code can be written in ____. A. JavaScript file (.js file) B. HTML document directly C. JavaScript file and in HTML document directly D. In style sheets (.css file) 13 / 15 13. What does the ‘toLocateString()’ method do in JS? A. Returns a localised object representation B. Returns a localised string representation of an object C. Returns parsed string D. None of the above 14 / 15 14. 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> 15 / 15 15. 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[] Your score is LinkedIn Facebook VKontakte 0% Restart quiz By WordPress Quiz plugin Questions, Quiz