নিচের কোন কৌশলটি অর্থের সময় মূল্যকে বিবেচনা করেনা

Updated: 10 months ago
  • ক
    ARR
    100%
    1 votes
  • খ
    IRR
    0%
    0 votes
  • গ
    NPV
    0%
    0 votes
  • ঘ
    Profitability Index
    0%
    0 votes
208
ব্যাখ্যাঃ

Question: What will be logged to the console after executing the following JavaScript code snippet?

function counter() {
    let count = 0;
    return function() {
        count++;
        return count;
    };
}

const increment = counter();
console.log(increment());
console.log(increment());

Options:

        
  • A) 1 then 1
  •     
  • B) 1 then 2
  •     
  • C) undefined then undefined
  •     
  • D) ReferenceError

Correct Answer: B) 1 then 2

Detailed Explanation:

This question evaluates your understanding of closures and scope persistence in JavaScript.

        
  • What is a Closure? A closure gives an inner function access to its outer function's scope even after the outer function has closed or returned.
  •     
  • Execution Flow:         
                  
    • Calling counter() instantiates a new execution context where the local variable count is initialized to 0.
    •             
    • The returned inner function forms a closure that maintains a persistent reference to the variable count.
    •             
    • The first call, increment(), modifies count from 0 to 1 and outputs 1.
    •             
    • The second call, increment(), references the same updated variable in memory, increasing count to 2 and outputting 2.
    •         
        
  •     
  • Why other options are incorrect:         
                  
    • A is incorrect because the variable count is not reset on subsequent function calls; the lexical environment persists across invocations.
    •             
    • C is incorrect because the inner function explicitly returns the updated numerical value of count.
    •             
    • D is incorrect because count remains accessible within the lexical scope chain, so no error is thrown.
    •         
        
Satt AI
Satt AI
1 month ago

Related Question

View All
Updated: 2 weeks ago
  • ক
    To put curtain in windows of a bank
  • খ
    To put iron grill in windows of a bank building
  • গ
    Windows used to transact cash in a bank
  • ঘ
    The mechanism to show inflated deposit for the time being
176
  • ক
    Cost, Asset, Money, Efficiency, Loan, Service
  • খ
    Capital Adequacy, Asset quality, Management, Earning Capacity, Liquidity, Sensitivity of Market risks
  • গ
    Credit, Advance, Marketability, Earning, Leverage, Surveillance
  • ঘ
    Caring, Adaptability, Management, Efficiency, Liability, Sociability.
122
Updated: 2 weeks ago
  • ক
    Qiyas
  • খ
    Ijtihad
  • গ
    Ibadat
  • ঘ
    Muamalat
  • ঙ
    None of these
268
  • ক
    নগদান প্রবাহ
    0%
    0 votes
  • খ
    বাট্টার হার
    0%
    0 votes
  • গ
    মূলধন ব্যয়
    100%
    1 votes
  • ঘ
    অভ্যন্তরীণ আয়ের হার
    0%
    0 votes
199
  • ক
    সাধারণ শেয়ার
    100%
    1 votes
  • খ
    অগ্রাধিকার শেয়ার
    0%
    0 votes
  • গ
    বন্ড
    0%
    0 votes
  • ঘ
    ডিবেঞ্চার
    0%
    0 votes
230
শিক্ষকদের জন্য বিশেষভাবে তৈরি

১ ক্লিকে প্রশ্ন, শীট, সাজেশন ও
অনলাইন পরীক্ষা তৈরির সফটওয়্যার!

শুধু প্রশ্ন সিলেক্ট করুন — প্রশ্নপত্র অটোমেটিক তৈরি!

প্রশ্ন এডিট করা যাবে
জলছাপ দেয়া যাবে
ঠিকানা যুক্ত করা যাবে
Logo, Motto যুক্ত হবে
অটো প্রতিষ্ঠানের নাম
অটো সময়, পূর্ণমান
প্রশ্ন এডিট করা যাবে
জলছাপ দেয়া যাবে
ঠিকানা যুক্ত করা যাবে
Logo, Motto যুক্ত হবে
অটো প্রতিষ্ঠানের নাম
অটো সময়, পূর্ণমান
অটো নির্দেশনা (এডিটযোগ্য)
অটো বিষয় ও অধ্যায়
OMR সংযুক্ত করা যাবে
ফন্ট, কলাম, ডিভাইডার
প্রশ্ন/অপশন স্টাইল পরিবর্তন
সেট কোড, বিষয় কোড
অটো নির্দেশনা (এডিটযোগ্য)
অটো বিষয় ও অধ্যায়
OMR সংযুক্ত করা যাবে
ফন্ট, কলাম, ডিভাইডার
প্রশ্ন/অপশন স্টাইল পরিবর্তন
সেট কোড, বিষয় কোড
এখনই শুরু করুন ডেমো দেখুন
৫০,০০০+
শিক্ষক
৩০ লক্ষ+
প্রশ্নপত্র
মাত্র ১৫ পয়সায় প্রশ্নপত্র
১ ক্লিকে প্রশ্ন, শীট, সাজেশন তৈরি করুন আজই

Complete Exam
Preparation

Learn, practice, analyse and improve

1M+ downloads
4.6 · 8k+ Reviews

Question Analytics

মোট উত্তরদাতা

জন

সঠিক
ভুল
উত্তর নেই