Javascript interview questions part 41

Javascript interview questions part 41

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

Total Questions: 20

1. What is the code to be used to trim whitespaces ?

Correct Answer is : let trimmed = (l.trim() for (l in lines));

2. What will be the reaction when a catch clause has no conditionals?

Correct Answer is : Takes it to be true

3. When will the finally block be called?

Correct Answer is : After try-catch execution

4. What is the return type of typeof for standard JavaScript objects?

Correct Answer is : object

5. Which method to use while working with XML fragments, instead of XML()?

Correct Answer is : XMLList()

6. Which of the following is the descendant operator?

Correct Answer is :

7. Which of the following is an example to perform the most common XML manipulations using the XML objects invocation?

Correct Answer is : insertChildBefore()

8. What is the code required to delete all “weight” tags?

Correct Answer is : delete pt..weight;

9. JavaScript is a _______________ language.

Correct Answer is : Object-Based

10. What would be the most appropriate output for the following code snippet? var a=5 , b=1 var obj = { a : 10 } with(obj) { alert(b) }

Correct Answer is : 1

11. A conditional expression is also called a _______________

Correct Answer is : Immediate if

12. Which is a more efficient code snippet? Code 1 : for(var num=10;num>=1;num--) { document.writeln(num); } Code 2 : var num=10; while(num>=1) { document.writeln(num); num++; }

Correct Answer is : Code 1

13. What is block statement in JavaScript?

Correct Answer is : block that combines multiple statements into a single compound statement

14. When an empty statement is encountered, a JavaScript interpreter __________

Correct Answer is : Ignores the statement

15. The “var” and “function” are __________

Correct Answer is : Declaration statements

16. Consider the following statements switch(expression) { statements } In the above switch syntax, the expression is compared with the case labels using which of the following operator(s)?

Correct Answer is : #ERROR!

17. What happens in the following javascript code snippet? var count = 0; while (count < 10) { console.log(count); count++; }

Correct Answer is : The value of count from 0 to 9 is displayed in the console

18. The enumeration order becomes implementation dependent and non-interoperable if:

Correct Answer is : If the object inherits enumerable properties

19. When are the mouse events generated?

Correct Answer is : When user clicks or moves the mouse over a document

20. The properties that specify the position and button state of the mouse are

Correct Answer is : clientX and clientY

Similar Interview Questions

    Search for latest jobs

    Icon
    Icon