Test Your JavaScript Skills with Mixed MCQs part three

JavaScript Skills with Mixed MCQs

1. What is the primary purpose of the event loop in JavaScript?

2. Which type of typing does JavaScript use?

3. What is JSON used for in JavaScript?

4. What is unique about the 'this' keyword in arrow functions?

5. What will the following code output?

        console.log(5 == '5');
    

6. Which comparison operator checks for both value and type equality?

7. What will the following code output?

        let i = 10;
        if (true) {
            let i = 20;
            console.log(i);
        }
        console.log(i);
    

8. What will the following code output?

        const arr = [1, 2, 3, 4];
        const result = arr.filter(num => num > 2);
        console.log(result);
    

9. What will the following code output?

        const obj = {
            count: 0,
            increment: () => {
                this.count++;
            }
        };
        obj.increment();
        console.log(obj.count);
    

10. What will the following code output?

        console.log('Start');
        setTimeout(() => console.log('Timeout'), 0);
        console.log('End');
    

11. What will the following code output?

        const arr = [1, 2, 3];
        const result = arr.map(x => x * 2);
        console.log(result);
    

12. Which method would you use to execute a function on each array element without creating a new array?

13. What is the result of typeof null in JavaScript?

14. What will the following code output?

        if (true) {
            let x = 10;
        }
        console.log(x);
    

15. What will the following code output?

        for (var i = 0; i < 3; i++) {
            setTimeout(() => console.log(i), 100);
        }
    

16. What is a closure in JavaScript?

17. What is the result of parseInt('abc') in JavaScript?

18. What happens when you assign a value to an undeclared variable in JavaScript (without 'use strict')?

19. Which method converts a JavaScript object to a JSON string?

20. Which Web Storage object allows data to persist with no expiration?

1 2 3 4

Post a Comment

Your comment will be visible after approval.
© TechTestLog. All rights reserved. Premium By Raushan Design
//My script