javascript-exam 0 votes, 0 avg 227 123456789101112131415 JavaScript Questions 1 / 15 1. 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 2 / 15 2. 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 3 / 15 3. 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 4 / 15 4. 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 5 / 15 5. What is the result in the console of running the code shown? var start = 1; function setEnd() { var end = 10; } setEnd(); console.log(end); A. 10 B. 1 C. ReferenceError D. None of the above 6 / 15 6. 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 7 / 15 7. What will be the output of the following code snippet? let sum = 0; const a = [1, 2, 3]; a.forEach(getSum); print(sum); function getSum(ele) { sum += ele; } A. 2 B. 1 C. 6 D. None of the above 8 / 15 8. What will be the output of the following code snippet? (function(){ setTimeout(()=> console.log(1),2000); console.log(2); setTimeout(()=> console.log(3),0); console.log(4); })(); A. 1 2 3 4 B. 2 3 4 1 C. 2 4 3 1 D. 4 3 2 1 9 / 15 9. JavaScript objects are written with _____. A. round brackets () B. curly brackets {} C. double quotes "" D. square brackets [] 10 / 15 10. What will be the output of the following code snippet? a = [1, 2, 3, 4, 5]; print(a.slice(2, 4)); A. 3, 4 B. 2, 3 C. 3, 4, 5 D. 2, 3, 4 11 / 15 11. When an operator’s value is NULL, the typeof returned by the unary operator is: A. Boolean B. Object C. Undefined D. Integer 12 / 15 12. 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) 13 / 15 13. Which of the following is the language of javascript? A. text/javascript B. text/ECMAscript C. text/Vbscript D. javaScript VBscript 14 / 15 14. 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 15 / 15 15. What does … operator do in JS? A. It is used to spread iterables to individual elements B. it is used to describe a datatype of undefined size C. no such operator exists D. None of the above Your score is LinkedIn Facebook Twitter VKontakte 0% Restart quiz