English
Review questions
Questions for self-check and exam preparation, grouped by course topic.
Topic 1. .NET and program structure
- What is the .NET platform? Explain the purpose of the Common Language Runtime (CLR), the Base Class Library (BCL), and the Common Intermediate Language (CIL).
- Explain the process of compiling and running a C# program from source code to machine code. What is JIT compilation?
- What capabilities does the .NET 10 SDK provide? List the main dotnet CLI commands for creating, building, and running a project.
- Describe the structure of a solution and a project in Microsoft Visual Studio 2026. What is the purpose of the .csproj project file?
- What is NuGet? How do you add a package to a project with Visual Studio and the dotnet CLI?
- Describe the structure of a C# program. What are top-level statements and the Main method?
- What are namespaces? Explain the purpose of using directives, global using directives, and implicit using directives.
Topic 2. Types, variables, operators
- What built-in data types does C# have? Give their value ranges and the corresponding .NET types (System.Int32, System.Double, and so on).
- What is the difference between value types and reference types? How are they placed in memory (the stack and the managed heap)?
- Explain implicit typing of variables with var. What are its limitations?
- What are nullable types? Explain the ?., ??, and ??= operators.
- Explain explicit and implicit type conversion and the Convert, Parse, and TryParse methods. What are boxing and unboxing?
- What operators does C# support? Explain operator precedence, integer division, and overflow checking (checked, unchecked).
Topic 3. Branching and loops
- Explain how the if-else statement and the ternary ?: operator work.
- Describe the switch statement and the switch expression. Give examples of pattern matching.
- Compare the for, while, and do-while loops. When is each of them appropriate?
- How does the foreach loop work? Which objects can it iterate over?
- Explain the purpose of the break, continue, and return statements. Give examples of their use in nested loops.
Topic 4. Arrays and strings
- How do you declare, create, and initialize a one-dimensional array? What default values do array elements have?
- Compare multidimensional (rectangular) and jagged arrays. Give examples.
- Which methods of the System.Array class are used for sorting, searching, and copying arrays?
- Why are strings of type string immutable? What consequences does this have for program performance?
- Which methods of the String class are used for searching, comparing, splitting, and formatting strings? Explain string interpolation.
- What is the StringBuilder class for? Compare using it with string concatenation.
Topic 5. Methods and recursion
- Describe the syntax of a method declaration. What is a method signature?
- Explain the ways of passing parameters to methods: by value, by reference (ref), output (out) parameters, and input (in) parameters.
- What are default parameters, named arguments, and a params parameter array?
- What is method overloading? By what criteria does the compiler choose the appropriate method?
- What is recursion? Give an example of a recursive method and explain when a StackOverflowException occurs.
- What are expression-bodied members and local functions?
Topic 6. Debugging and exceptions
- What debugging tools does Microsoft Visual Studio 2026 provide? Explain breakpoints, stepping, and the Locals, Watch, and Call Stack windows.
- What is an exception? Explain how try, catch, and finally blocks work.
- Describe the hierarchy of .NET exception classes. Give examples of standard exceptions (ArgumentException, NullReferenceException, InvalidOperationException, and so on).
- How do you create a custom exception class? Explain the difference between throw and throw ex.
- What are exception filters (catch when)? How do you correctly handle several exception types?
- Explain the purpose of the using statement and the IDisposable interface for releasing resources.
Topic 7. Classes and objects
- What are a class and an object? How is an object created with the new operator, and where is it placed in memory?
- Compare the fields and properties of a class. What are auto-implemented properties and init-only properties?
- What kinds of constructors exist in C#? Explain the default constructor, constructor overloading, and calling this(…).
- What are object initializers? Compare them with using constructors.
- What are primary constructors and required properties?
- How does the garbage collector work in .NET? What is a finalizer for?
Topic 8. Encapsulation, static members
- What is encapsulation? How is it implemented in C#?
- Explain the access modifiers public, private, protected, internal, protected internal, and private protected.
- What are static fields, methods, and constructors? How does a static class differ from a regular one?
- Compare constants (const) and read-only fields (readonly).
- What are partial and nested classes? When are they used?
Topic 9. Inheritance and polymorphism
- What is inheritance? Explain the inheritance syntax and calling the base class constructor (base).
- What is polymorphism? Explain virtual methods (virtual) and overriding them (override).
- How does overriding a method (override) differ from hiding it (new)?
- What is the sealed modifier used for with classes and methods?
- Which methods do all classes inherit from System.Object? Why override the ToString, Equals, and GetHashCode methods?
- Explain upcasting and downcasting in a class hierarchy, the is and as operators, and type pattern matching.
Topic 10. Abstract classes, interfaces
- What are an abstract class and an abstract method? When is it appropriate to use them?
- What is an interface? Compare abstract classes and interfaces.
- Explain how a class implements several interfaces and explicit interface implementation.
- What are default interface methods?
- Explain the purpose of the standard interfaces IComparable<T>, IComparer<T>, IEquatable<T>, and ICloneable.
Topic 11. Structures, records, tuples
- What is a structure (struct)? Compare structures and classes.
- What are records (record, record struct)? Explain value-based comparison of records and the with expression.
- What is an enumeration (enum)? How are the [Flags] attribute and bitwise operators used with enumerations?
- What are tuples (ValueTuple)? Explain named tuple elements and deconstruction.
- Compare the ways of returning several values from a method: output parameters, tuples, and records.
Topic 12. Operators and indexers
- How do you overload operators for your own class? Which operators can be overloaded, and what rules must be followed?
- How do you overload the == and != operators and keep them consistent with the Equals and GetHashCode methods?
- Explain user-defined implicit and explicit conversion operators.
- What is an indexer? Give an example of a class with an indexer.
- What are extension methods? What are the requirements for declaring them?
Topic 13. Generics and collections
- What are generics? What advantages do generic classes and methods have compared with using the object type?
- Explain generic type parameter constraints (where T : class, struct, new(), a base class, an interface).
- Describe the main collections of the System.Collections.Generic namespace: List<T>, Dictionary<TKey, TValue>, HashSet<T>, Queue<T>, and Stack<T>.
- Compare arrays, List<T>, and LinkedList<T> in terms of the performance of the main operations.
- Explain the role of the IEnumerable<T> and IEnumerator<T> interfaces. How do you create an iterator with yield return?
- What are covariance and contravariance of generic interfaces and delegates (out, in)?
Topic 14. Delegates, lambdas, events
- What is a delegate? How do you declare a delegate, create an instance of it, and call a method through a delegate?
- Explain the standard generic delegates Func, Action, and Predicate.
- What are anonymous methods and lambda expressions? What is a closure?
- What are multicast delegates? How do you add a method to the invocation list and remove it?
- What are events (event)? Explain the standard .NET event pattern with the EventHandler<TEventArgs> delegate.
Topic 15. LINQ
- What is LINQ? Compare query syntax and method syntax.
- Explain the LINQ filtering, projection, and sorting operators: Where, Select, OrderBy, ThenBy.
- Explain the LINQ grouping and join operators: GroupBy, Join, and GroupJoin.
- What LINQ aggregate operators do you know (Count, Sum, Average, Min, Max, Aggregate)?
- What is the deferred execution of LINQ queries? Which methods cause a query to execute immediately?
- Explain the LINQ partitioning and set operators: Take, Skip, Distinct, Union, Intersect, Except. What are anonymous types?
Topic 16. Files, streams, JSON
- Which classes of the System.IO namespace are used for working with files and directories (File, FileInfo, Directory, Path)?
- What is a stream (Stream)? Explain working with text files with the StreamReader and StreamWriter classes.
- Compare text and binary files. How do the FileStream, BinaryReader, and BinaryWriter classes work?
- What is serialization? Explain serializing and deserializing objects to and from JSON with the JsonSerializer class of the System.Text.Json library.
- How do you configure JSON serialization with JsonSerializerOptions and the [JsonPropertyName] and [JsonIgnore] attributes? How do you read and write files asynchronously (async, await)?
Topic 17. SOLID and design patterns
- Explain the SOLID principles. Give an example of a violation of the single responsibility principle and a way to eliminate it.
- Explain the open/closed principle and the Liskov substitution principle using examples of class hierarchies.
- Explain the interface segregation principle and the dependency inversion principle. What is dependency injection?
- What are design patterns? Describe the creational patterns Singleton and Factory Method.
- Describe the behavioral patterns Strategy and Observer and their implementation with C# language features.
Topic 18. Testing and refactoring
- What is unit testing? Explain the structure of a unit test according to the Arrange–Act–Assert pattern.
- How do you create an xUnit unit test project in Visual Studio 2026? Explain the [Fact] and [Theory] attributes and the methods of the Assert class.
- How do you run and analyze tests in the Test Explorer window? What is code coverage?
- What are test doubles (stubs, mock objects)? What is the Moq library used for?
- What is refactoring? Give examples of refactoring techniques (extracting a method, renaming, replacing a conditional with polymorphism) and the refactoring tools of Visual Studio 2026.