javascript-exam 0 votes, 0 avg 608 123456789101112131415 JavaScript Questions 1 / 15 1. Which of the following function of the String object returns the character in the string starting at the specified position via the specified number of characters? A. slice() B. split() C. substr() D. search() 2 / 15 2. 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 3 / 15 3. Which is the function used to call a function in every time duration? A. callafter() B. setInterval() C. setTimeout() D. setTime() 4 / 15 4. 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) 5 / 15 5. 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 6 / 15 6. 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 7 / 15 7. What is the purpose of the Attr object in the HTML DOM ? A. Used to focus on a particular part of the HTML page B. HTML Attribute C. Used to arrange elements D. CSS attribute 8 / 15 8. 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 9 / 15 9. Which property is used to define the HTML content to an HTML element with a specific id? A. innerText B. innerContent C. elementText D. innerHTML 10 / 15 10. Arrays in JavaScript are defined by which of the following statements? A. It is an ordered list of values B. It is an ordered list of objects C. It is an ordered list of string D. It is an ordered list of functions 11 / 15 11. 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*/ } 12 / 15 12. in javascript "===" operator defines what? A. Non-identical B. is equal to and is of the different types C. is equal to and is of the same type D. is equal 13 / 15 13. The "function" and " var" are known as: A. Keywords B. Data Types C. Declaration Statements D. Prototypes 14 / 15 14. Which of the following can be implemented using animation? A. Fireworks B. Fade Effect C. Roll-in or Roll-out D. All of the mentioned 15 / 15 15. Which JavaScript method is used to access an HTML element by id? A. getElementByID() B. getElement(Id) C. getElementById(id) D. elementById(id) Your score is LinkedIn Facebook VKontakte 0% Restart quiz By Wordpress Quiz plugin