Loading

Quipoin Menu

Learn • Practice • Grow

java-script / JavaScript Use
mcq
Direction: Choose the correct option

Q1.

Which keyword is used to declare a block-scoped variable?
A. var
B. let
C. static
D. define
Direction: Choose the correct option

Q2.

Which of the following best describes a JavaScript closure?
A. A function inside another function
B. A function that remembers its outer scope
C. A loop structure
D. An object method
Direction: Choose the correct option

Q3.

What is the output of the following JavaScript code?

console.log(typeof undefined);
A. null
B. object
C. undefined
D. number
Direction: Choose the correct option

Q4.

Which loop is best suited for iterating over arrays?
A. for
B. while
C. do...while
D. forEach
Direction: Choose the correct option

Q5.

What will be printed by the following code?

var a = 5;
function demo(){
  var a = 10;
}
demo();
console.log(a);
A. 10
B. 5
C. undefined
D. Error