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

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

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 week ago

Related Question

View All
  • ক
    নগদান প্রবাহ
    0%
    0 votes
  • খ
    বাট্টার হার
    0%
    0 votes
  • গ
    মূলধন ব্যয়
    100%
    1 votes
  • ঘ
    অভ্যন্তরীণ আয়ের হার
    0%
    0 votes
186
  • ক
    সাধারণ শেয়ার
    100%
    1 votes
  • খ
    অগ্রাধিকার শেয়ার
    0%
    0 votes
  • গ
    বন্ড
    0%
    0 votes
  • ঘ
    ডিবেঞ্চার
    0%
    0 votes
216
  • ক
    সাধারন ইক্যুইটির ব্যয়
    0%
    0 votes
  • খ
    বর্তমান মূলধন কাঠামো
    0%
    0 votes
  • গ
    সর্বোত্তম মূলধন কাঠামো
    0%
    0 votes
  • ঘ
    ঋণের কর পরবর্তী খরচ
    0%
    0 votes
185
  • ক
    কমে
    100%
    1 votes
  • খ
    বাড়ে
    0%
    0 votes
  • গ
    থিতিশীল থাকে
    0%
    0 votes
  • ঘ
    কোনো প্রভাব পড়ে না
    0%
    0 votes
162
  • ক
    সর্বসাধারনকে ঋণদান
    0%
    0 votes
  • খ
    গ্রাহক ও সর্বসাধারনের জন্য দীর্ঘমেয়াদী কল্যান সাধন
    100%
    1 votes
  • গ
    সঞ্চয় সংগ্রহ বাড়ানো
    0%
    0 votes
  • ঘ
    সামাজিক অনুষ্ঠানে অর্থায়ন করা
    0%
    0 votes
287
  • ক
    বিদ্যমান সাধারণ শেয়ার
    0%
    0 votes
  • খ
    অগ্রাধিকার শেয়ার
    0%
    0 votes
  • গ
    ঋণ
    0%
    0 votes
  • ঘ
    নতুন সাধারণ শেয়ার
    0%
    0 votes
281
শিক্ষকদের জন্য বিশেষভাবে তৈরি

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

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

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

Complete Exam
Preparation

Learn, practice, analyse and improve

1M+ downloads
4.6 · 8k+ Reviews

Question Analytics

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

জন

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