Where I write code.

Sunday, 23 January 2022

JavaScript 1000+ MCQ Question- Part 1

JavaScript MCQ Questions

1.What is JavaScript?





... Answer is B)
JavaScript is a scripting language, which can be used on client on server side.


2. JavaScript is single-threaded



... Answer is A)
JavaScript is single-threaded.


3. JavaScript has asynchronous execution model



... Answer is B)
JavaScript is single threaded and has a synchronous execution model.

4. Can JavaScript be used for backend development?



... Answer is A)
JavaScript can be used for backend development using Node.js.


5. How can a datatype be declared to be constant in JavaScript?





... Answer is C)
The const keyword is used to declare a variable as a constant type in Javascript, e.g.:
                
                    const pieValue=3.14
                
            


6. What will be output of following statement?

    
        let a='3';
        console.log(a+3);
    



... Answer is B)
As you have a string datatype first, any variable that comes after the “+” operator it will be concatenated to your data, i.e "33".


7. Correct way to declare variable?





... Answer is C)
We can declare a variable using var or let or const, etc.


8. Is Javascript case sensitive?



... Answer is A)
All JavaScript identifiers are case sensitive. e.g. fistName and firstname both are different variables.


9. What will be output of following statement?

            
                var val1='JavaScript';
                var val1='JSDevLife';
                console.log(val1);
            
        



... Answer is C)
If we use var then we can redeclare it, and it will take last updated value so it prints JSDevLife.


9. What will be output of following statement?

            
                let val1='JavaScript';
                let val1='JSDevLife';
                console.log(val1);
            
        



... Answer is A)
Variables defined with let cannot be redeclared.


1 comment:

  1. That was such a truthful explanation. You very beautifully explain the concepts, and I completely relate to them. When I think about to hired flutter app developers, the name Eiliana.com strikes first in my mind because I recently hired a few experts, and I am impressed with how they treated their customers.

    ReplyDelete