Loading

Quipoin Menu

Learn • Practice • Grow

java-script / Function in JS
mcq
Direction: Choose the correct option

Q1.

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

Q2.

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

Q3.

What will be the output of the following JavaScript code?

let x = 10;
let y = "10";
console.log(x === y);
A. true
B. false
C. undefined
D. TypeError
Direction: Choose the correct option

Q4.

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
Direction: Choose the correct option

Q5.

Which loop is best suited for iterating over arrays?
A. for
B. while
C. do...while
D. forEach