JavaScript Questions March 14, 2023 | No Comments 0 votes, 0 avg 447 123456789101112131415 JavaScript Questions 1 / 15 1. 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 2 / 15 2. 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 3 / 15 3. 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" 4 / 15 4. Why JavaScript Engine is needed? A. Both Compiling & Interpreting the JavaScript B. Parsing the javascript C. Interpreting the JavaScript D. Compiling the JavaScript 5 / 15 5. 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 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. Which statement is used to skip the iteration of the loop A. break B. pass C. skip D. continue 8 / 15 8. 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 9 / 15 9. What will be the output of the following code snippet? var a = true + true + true * 3; print(a) A. 3 B. zero C. error D. 5 10 / 15 10. 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[] 11 / 15 11. 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 12 / 15 12. 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 13 / 15 13. 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 14 / 15 14. Which of the following values is not a Boolean false? A. Boolean(0) B. Boolean("") C. Boolean(NaN) D. Boolean("false") 15 / 15 15. Which is the correct syntax for the function definition? A. return_type function function_name(parameter1, parameter2, ...) { /*Function's body*/ } B. function function_name(parameter1, parameter2, ...) { /*Function's body*/ } C. return_type function_name(parameter1, parameter2, ...) { /*Function's body*/ } D. function function_name(parameter1, parameter2, ...) as return_type { /*Function's body*/ } Your score is LinkedIn Facebook Twitter VKontakte 0% Restart quiz Questions, Quiz