Javascript interview questions part 23

Javascript interview questions part 23

Take as many assements as you can to improve your validate your skill rating

Total Questions: 20

1. What is the return data type of the property accept that belongs to the Input element?

Correct Answer is : string

2. What is the purpose of the property width belonging to the ImageData element?

Correct Answer is : Number of pixels per row of data

3. What is the purpose of the adoptNode() method?

Correct Answer is : Removes node and Makes it ready for insertion

4. What is the function of the method importNode()?

Correct Answer is : Copies without removing

5. How can you create a node for comment in JavaScript?

Correct Answer is : createComment()

6. How can you dispatch a synthetic event object?

Correct Answer is : dispatchEvent()

7. How do you specifically execute a command in JavaScript?

Correct Answer is : execCommand()

8. Consider the following code snippet const pi=3.14; var pi=4; console.log(pi); What will be the output for the above code snippet?

Correct Answer is : This will flash an error

9. The let keyword can be used ___________

Correct Answer is : all of the mentioned

10. The main difference between the variables declared with var and with let is __________

Correct Answer is : let is confined to a particular function but var is not

11. Consider the following code snippet function oddsums(n) { let total = 0, result=[]; for(let x = 1; x <= n; x++) { let odd = 2*x-1; total += odd; result.push(total); } return result; } What would be the output if oddsums(5); is executed after the above code snippet ?

Correct Answer is : Returns [1,4,9,16,25].

12. Consider the following code snippet console.log(p) If p is not defined, what would be the result or type of error?

Correct Answer is : Reference Error

13. Consider the following code snippet let x=x+1; console.log(x); What will be the result for the above code snippet?

Correct Answer is :

14. Consider the following code snippet [x,y]=[y,x]; What is the result of the above code snippet?

Correct Answer is : Flashes an error

15. Which looping statement allows XML tags to appear in JavaScript programs and adds API for operating on XML data?

Correct Answer is : for/each loop

16. Which exception does the Iterators throw from their next() method when there are no more values to iterate, that work on finite collections ?

Correct Answer is : Stop Iteration

17. Which method of the iterable object returns an iterator object for the collection?

Correct Answer is : _iterator_()

18. The word “document” mainly refers to

Correct Answer is : Static Information

19. Which object is the main entry point to all client-side JavaScript features and APIs?

Correct Answer is : Window

20. Which identifier is used to represent a web browser window or frame?

Correct Answer is : window

Similar Interview Questions

    Search for latest jobs

    Icon
    Icon