javascript-exam 0 votes, 0 avg 535 123456789101112131415 JavaScript Questions 1 / 15 1. Which JavaScript method is used to create a new array with array elements that passes a test? A. forEach() B. map() C. forMap() D. filter() 2 / 15 2. 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 3 / 15 3. 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 4 / 15 4. 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 5 / 15 5. What will be the output of the following code snippet? print(typeof(NaN)); A. Object B. Number C. String D. None of the above 6 / 15 6. What does the Javascript “debugger” statement do? A. It will debugg all the errors in the program at runtime. B. It acts as a breakpoint in a program C. it will debugg error in the current statement if any D. None of the above 7 / 15 7. Which JavaScript statements when embedded in an HTML page can respond to user events such as mouse clicks, form input and page navigation A. Native B. Server-Side C. Local D. Client-Side 8 / 15 8. 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 9 / 15 9. 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" 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 central concept of JavaScript memory management? A. Reliability B. Reachability C. Efficiency D. Transparency 12 / 15 12. 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[] 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. 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. 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 Your score is LinkedIn Facebook VKontakte 0% Restart quiz By Wordpress Quiz plugin