Show List

Quiz - JavaScript - 3

70%

Public Average Score
Select the right answer for below questions:

What is the difference between “null” and “undefined” in JavaScript?
“null” means that a variable has been explicitly set to no value, while “undefined” means that a variable has been declared but has not been assigned a value
There is no difference
“null” means that a variable is inaccessible, while “undefined” means that the variable is accessible but has no value
“null” is a value, while “undefined” is a variable
“null” means that a variable has been explicitly set to no value, while “undefined” means that a variable has been declared but has not been assigned a value

What is the output of the following JavaScript code?console.log(typeof(null));
Number
String
Object
Null
Object

What is the difference between an anonymous function and a named function in JavaScript?
Anonymous functions cannot be referenced, while named functions can be
Named functions cannot be referenced, while anonymous functions can be
Anonymous functions cannot be called, while named functions can be
Named functions cannot be called, while anonymous functions can be
Anonymous functions cannot be referenced, while named functions can be

What is the purpose of “this” keyword in JavaScript?
To reference the object that a function is a property of
To reference the global object
To reference the object that the function is a method of
To reference the object that the function is bound to
To reference the object that a function is a property of

How do you declare a function in JavaScript?
Using a literal notation
Using a constructor
Using the “function” keyword
Using a variable
Using the “function” keyword

What is the difference between “==” and “===” in JavaScript?
“==” performs type coercion while “===” does not
“===” performs type coercion while “==” does not
There is no difference
“==” and “===” cannot be used in JavaScript
“==” performs type coercion while “===” does not

How do you declare a class in JavaScript?
Using a constructor
Using a literal notation
Using a function
Using the “class” keyword
Using the “class” keyword

What is the difference between a class and an object in JavaScript?
A class is a blueprint for objects, while an object is an instance of a class
An object is a blueprint for classes, while a class is an instance of an object
There is no difference
Classes and objects cannot be used in JavaScript
A class is a blueprint for objects, while an object is an instance of a class

What is the output of the following JavaScript code? var a = 5;var b = 10;console.log(a + b);
10
5
15
20
15

What is closure in JavaScript?
A closure is a function that remembers its outer variables and can access them even if they are no longer in scope
A closure is a function that can only access variables within its own scope
A closure is a function that can only access variables within the global scope
A closure is a function that cannot access any variables
A closure is a function that remembers its outer variables and can access them even if they are no longer in scope

Submit
Retry
{"qz1-543683":"“null” means that a variable has been explicitly set to no value, while “undefined” means that a variable has been declared but has not been assigned a value","qz1-543684":"Object","qz1-543685":"Anonymous functions cannot be referenced, while named functions can be","qz1-543686":"To reference the object that a function is a property of","qz1-543687":"Using the “function” keyword","qz1-543688":"“==” performs type coercion while “===” does not","qz1-543689":"Using the “class” keyword","qz1-543690":"A class is a blueprint for objects, while an object is an instance of a class","qz1-543691":"15","qz1-543692":"A closure is a function that remembers its outer variables and can access them even if they are no longer in scope"}

    Leave a Comment


  • captcha text