Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumC#deferred vs immediate LINQSingle-choice MCQ

What does this loop print? Both queries iterate the same in-memory list and the variable changes between them.

var nums = new List<int> { 1, 2, 3, 4 }; int limit = 2; var q = nums.Where(n => n > limit); limit = 3; int a = q.Count(); limit = 0; int b = q.Count(); Console.WriteLine($"{a},{b}");