Test How Well You Really Know C#
C# looks friendly until it surprises you. Why does a mutable struct in a readonly field never change? Why does a LINQ query see items added after it was written? Why does an async method print before the caller does, and why does the same lambda capture 3, 3, 3 in a for loop but 0, 1, 2 in foreach? These practice tests check how deeply you understand the language, one short program at a time.
What this practice test course offers:
- 200 original multiple-choice questions in 4 practice tests of 50, grouped by topic
- Short programs you must reason about: what does it print, does it compile (and with which CS error or warning), or which exception does it throw
- An explanation for every answer option, plus an overall explanation of the rule behind it
- Every program compiled and run with the .NET 11 SDK and C# 15, so every answer matches what the real compiler and runtime do
- Modern C# included: records, pattern matching, nullable reference types, collection expressions, primary constructors, the field keyword, extension members, union types and closed hierarchies
Topics covered:
- Value versus reference types, boxing, overflow, conversions, string equality and operator precedence
- Structs, records, initialization order, virtual versus new, and overload resolution
- Interfaces with default members, generics, constraints and variance
- LINQ deferred execution, multiple enumeration, closures over loop variables and collections
- Exceptions, finally, exception filters, using and IDisposable
- Delegates, events, lambdas, switch expressions and patterns
- Nullable value types and nullable reference types
- async and await, tasks, cancellation and the newest C# 13, 14 and 15 features
Who should take this course?
- C# and .NET developers preparing for interviews, coding assessments or code reviews
- Experienced developers who want to catch up with C# 12 to 15
- Students who have finished a C# course and want challenging practice questions
If you have never written C#, start with a C# fundamentals course and come back here to test yourself.
How to use the tests: take one test at a time, then read every explanation, including the ones for questions you answered correctly. Retake a test a few days later to check that the rules have stuck.
The programs assume a default .NET 11 console project (top-level statements, implicit usings and nullable reference types enabled) and the en-US culture.
This course is independent and is not affiliated with or endorsed by Microsoft. C# and .NET are trademarks of Microsoft Corporation.