C# interview questions
LiveTypes, collections, LINQ, async and the language features .NET interviewers probe first.
Subtopics
- Value vs reference types12
- Collections & LINQ12
- async/await & Task12
- OOP & interfaces12
- Generics12
- Exceptions12
- Records & structs12
- IDisposable & using12
- Delegates & events12
- String handling & spans12
Sample questions
- CodingJuniorasync/await & Task
Write a private
async Task<int>helper that returns its argument doubled, then implement the public entry pointSumDoubled(List<int> numbers).SumDoubleditself is synchronous: it must start one helper task per number, await them all with - CodingJuniorasync/await & Task
An unreliable async operation is scripted by
outcomes: attempt numberi(zero-based) succeeds whenoutcomes[i]istrue. ImplementAttemptsUntilSuccess(List<bool> outcomes, int maxAttempts). - TheoryJuniorasync/await & Task
What does
awaitactually do when you hit it? Does it start a new thread? - TheoryJuniorasync/await & Task
Why is
async voidalmost always a mistake, and what is the one place it is legitimate? - CodingJuniorCollections & LINQ
Implement
GroupByLength(List<string> words)returning aDictionary<int, int>from word length to how many words have that length. Ignorenulland empty strings. - CodingJuniorCollections & LINQ
Implement
AboveThreshold(List<int> numbers, int threshold)that returns the distinct values strictly greater thanthreshold, sorted ascending, as aList<int>. Return an empty list when nothing qualifies.