HomeCode HereC# library quiz C# library quiz Admin 1 min read Updated November 16, 2026 Nine questions on collections, LINQ, exceptions, files and async/await. C# C# library quiz 9 questions, instant feedback Question 1 of 9 Which collection gives O(1) lookup by key? A List B Dictionary C Queue D T[] A dictionary hashes the key to find the value, which is constant time on average. Question 2 of 9 What does a List do when it grows? A Nothing, it is fixed B Allocates a larger array and copies C Uses a linked list D Throws The backing array doubles, and the existing elements are copied into it. Question 3 of 9 Which LINQ method transforms each element? A Where B Select C OrderBy D GroupBy Select maps each element to a new value. Where filters, OrderBy sorts and GroupBy groups. Question 4 of 9 What does deferred execution mean for a LINQ query? A It runs when enumerated B It runs at declaration C It never runs D It runs on a thread A query is a description of work; it executes when you iterate it or call a terminal method such as ToList. Question 5 of 9 Which exception should wrap an invalid argument? A Exception B ArgumentException C InvalidOperationException D IOException ArgumentException (or ArgumentNullException) names the failure precisely. InvalidOperationException is for wrong state. Question 6 of 9 What does a finally block do? A Runs whether or not an exception was thrown B Hides exceptions C Rethrows D Only runs on success finally runs on both paths, which is where cleanup that is not a using declaration belongs. Question 7 of 9 What does using do for a file stream? A Imports a namespace B Disposes it when the block ends C Opens it asynchronously D Locks it using calls Dispose on an IDisposable at the end of the scope, even when an exception is thrown. Question 8 of 9 What should an async method return when it produces no value? A void B Task C Task D null Task is awaited and carries exceptions. async void is only for event handlers, because it cannot be awaited. Question 9 of 9 Why avoid .Result on a Task? A It is slower B It blocks and can deadlock in some contexts C It throws always D It returns void Blocking on an asynchronous operation can deadlock when a synchronisation context is captured. Await instead. Check my answers Try again Your answers stay in this browser. Nothing is sent to a server. More quizzes C# basics quiz Coming soon C# control flow quiz 9 questions C# objects quiz 9 questions All quizzes