JOIN ADRE 2.0 Telegram Group

JavaScript Questions & Answers – Closures | JavaScript Multiple Choice Questions and Answers

Questions
1 What kind of scoping does JavaScript use?
A Literal
B Lexical
C Segmental
D Sequential

Answer: Lexical
2 What must be done in order to implement Lexical Scoping?
A Get the object
B Dereference the current scope chain
C Reference the current scope chain
D Return the value

Answer: Reference the current scope chain
Advertisement
Article and Schedule Quiz Start Test!

DOWNLOAD CURRENT AFFAIRS PDF FROM APP

3 What is closure?
A Function objects
B Scope where function’s variables are resolved
C Both Function objects and Scope where function’s variables are resolved
D Function return value

Answer: Both Function objects and Scope where function’s variables are resolved
4 Which of the following is not an example of closures?
A Objects
B Variables
C Functions
D Graphics

Answer: Graphics
5 Which of the following uses a lot of CPU cycles?
A GUI
B Statically generated graphics
C Dynamically generated graphics
D Generic scoping

Answer: Dynamically generated graphics
6 What will be the function of the following JavaScript code?
var scope = "global scope";
function checkscope() 
{
    var scope = "local scope"; 
    function f() 
    { 
         return scope; 
    }
    return f;
}
A Returns value null
B Returns exception
C Returns the value in scope
D Shows an error message

Answer: Returns the value in scope
7 What is the fundamental rule of lexical scoping?
A Functions are declared in the scope
B Functions are executed using scope chain
C Functions are declared outside the scope
D Variables are declared within the function

Answer: Functions are executed using scope chain
8 What is the opposite approach to the lexical scoping?
A Literal scoping
B Static scoping
C Dynamic scoping
D Generic scoping

Answer: Dynamic scoping
9 What is the purpose of the dynamic scoping?
A Variables can be declared outside the scope
B Variables must be declared outside the scope
C Variables cannot be declared outside the scope
D Variable cannot be declared within the function

Answer: Variables can be declared outside the scope
10 Which of the algorithmic languages is not lexical scoping standardized in?
A Ada
B Pascal
C Modula2
D Html

Answer: Html

ADRE 2.0 FULL LENGTH MOCK TEST

Take Mock Tests

Missiles Mock Test Start Test!
SSC MTS Mock Test Start Test
IBPS CLERK MOCK TEST Start Test
SSC MTS 2022 JULY 26 Shift 1 (ENGLISH) Start Test!
SSC GD Previous Year Paper 2021 Nov 17 Shift - I (Hindi) Start Test!
SSC CGL Tier - 1 PYP 2022 April 21 Shift- 1 (ENGLISH) Start Test!
MPSC PAPER I MOCK TEST 1 (ENGLISH) Start Test!
IB Security Assistant Mock test 1 (english) Start Test!
UP POLICE CONSTABLE MOCK TEST 1 Start Test!
DELHI POLICE CONSTABLE MOCK TEST 1 (HINDI) Start Test!
Advertisement
Assam Direct Recruitment Test Series