javascript-exam 0 votes, 0 avg 483 123456789101112131415 JavaScript Questions 1 / 15 1. 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] 2 / 15 2. Any time you include javascript variable in HTML document, you must enclose those lines inside a _______ A. <div> and </div> B. <body> and </body> C. <script> and </script> D. <html> and </html> 3 / 15 3. 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 4 / 15 4. What is the prototype represents in the following JavaScript code snippet? function javascript() {}; A. Not valid B. Protoype of a function C. Function javascript D. A custom constructor 5 / 15 5. Which of the following values is not a Boolean false? A. Boolean(0) B. Boolean("") C. Boolean(NaN) D. Boolean("false") 6 / 15 6. Which of the following is the language of javascript? A. text/javascript B. text/ECMAscript C. text/Vbscript D. javaScript VBscript 7 / 15 7. 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); 8 / 15 8. Which JavaScript method is used to write HTML output? A. document.write() B. document.output() C. console.log() D. document.writeHTML() 9 / 15 9. 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 10 / 15 10. How to stop an interval timer in Javascript? A. clearInterval B. clearTimer C. interavlOver D. None of the above 11 / 15 11. 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 12 / 15 12. 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 13 / 15 13. Which of the following is the correct way for writing Java Script array? A. var salaries = new Array(1:39438, 2:39839 3:83729) B. var salaries = new (Array1=39438, Array 2=39839 Array 3=83729) C. var salaries = new Array(39438, 39839,83729) D. var salaries = new Array() values = 39438, 39839 83729 14 / 15 14. The process in which an object or data structure is translated into a format suitable for transferral over a network, or storage is called? A. Object Serialization B. Object Encapsulation C. Object Inheritance D. None of the above 15 / 15 15. When an operator’s value is NULL, the typeof returned by the unary operator is: A. Boolean B. Object C. Undefined D. Integer Your score is LinkedIn Facebook Twitter VKontakte 0% Restart quiz