javascript-exam 0 votes, 0 avg 611 123456789101112131415 JavaScript Questions 1 / 15 1. Which of the following is the correct output for the following JavaScript code: var grade='Z'; var result; switch(grade) { case 'A': result+="10"; case 'B': result+=" 9"; case 'C': result+=" 8"; default: result+=" 100"; } document.write(result); A. 10 B. 17 C. 18 D. 100 2 / 15 2. What will be the output of the following JavaScript code? var cars = ["Honda","Hyundai","Mahindra"]; var result = cars.shift(); document.writeln("Result: ", cars); A. Result: Honda,Hyundai,Mahindra B. Result: Honda C. Result: Hyundai,Mahindra D. Result: Honda,Mahindra 3 / 15 3. 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 4 / 15 4. 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 5 / 15 5. The correct syntax to write "Hello World" in javascript. A. jscript.write("Hello World") B. response.write("Hello World") C. print("Hello World") D. print.jscript("Hello World") 6 / 15 6. What will be the result or type of error if p is not defined in the following JavaScript code snippet? console.log(p) A. Value not found Error B. Reference Error C. Null D. Zero 7 / 15 7. 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 8 / 15 8. 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> 9 / 15 9. Which of the following values is not a Boolean false? A. Boolean(0) B. Boolean("") C. Boolean(NaN) D. Boolean("false") 10 / 15 10. 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 11 / 15 11. 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 12 / 15 12. 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 13 / 15 13. Which of the following is the method used to add an element to the desired location? A. add.element() B. element.add() C. element.appendChild() D. addelement() 14 / 15 14. What will be the output of the following JavaScript code? var arr = [7, 5, 9, 1]; var min = Math.min.apply(null, arr); document.writeln(min); A. 7 B. 5 C. 1 D. 9 15 / 15 15. Which of the following methods can be used to display data in some form using Javascript? A. document.write() B. console.log() C. window.alert() D. all of the above Your score is LinkedIn Facebook VKontakte 0% Restart quiz By Wordpress Quiz plugin