JavaScript Questions March 14, 2023 | No Comments 0 votes, 0 avg 600 123456789101112131415 JavaScript Questions 1 / 15 1. What is the code for getting the current time? A. now = new Date(); B. var now = new Date(); C. var now = Date(); D. var now = new Date(current); 2 / 15 2. Which of the following is the language of javascript? A. text/javascript B. text/ECMAscript C. text/Vbscript D. javaScript VBscript 3 / 15 3. 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 4 / 15 4. 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 5 / 15 5. What will happen, if the following JavaScript code is executed? var count =0; while (count <10) { console.log(count); count++; } A. An error is displayed B. An exception is thrown C. The values of count variable are logged or stored in a particular location or storage D. The value of count from 0 to 9 is displayed in the console 6 / 15 6. 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 7 / 15 7. Which of the following is not a vaid javascript variable.? A. 2names B. _first_and _lastname C. FirstAndLast D. first2last 8 / 15 8. 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 9 / 15 9. Will the following JavaScript code work? var js = (function(x) {return x*x;}(10)); A. Exception will be thrown B. Memory leak C. Error D. Yes 10 / 15 10. The "function" and " var" are known as: A. Keywords B. Data Types C. Declaration Statements D. Prototypes 11 / 15 11. 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 12 / 15 12. Which of the following is a valid function to truncate number of full minutes between two time stamps? A. this_month() function B. minutes_between() function C. hours_between() function D. weeks_between() function 13 / 15 13. When the switch statement matches the expression with the given labels, how is the comparison done? A. Both the datatype and the result of the expression is compared B. only the datatype of the expression is compared C. only the value of the expression is compared D. none of the above 14 / 15 14. 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 15 / 15 15. 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> Your score is LinkedIn Facebook VKontakte 0% Restart quiz By WordPress Quiz plugin Questions, Quiz