Is it possible to use async/await inside a lock? Why?
C#
Why is async void considered bad practice?
How does the runtime understand that an asynchronous operation has finished and it needs to continue work?
What is ConfigureAwait(false)? What is it used for? What is a synchronization context?
What will be displayed in the console? ```csharp public class Program { static void Main() { var myClassObj = new MyClass(); var myStructObj = new MyStruct(); MethodA(myClassObj.Num); // MethodB(myStructObj); MethodC(myClassObj); MethodD(myClassObj); Console.WriteLine(myClassObj.Num); // ? Console.WriteLine(myStructObj.Num); // ? } private static void MethodA(int num) { num = num + 1; } private static void MethodB(MyStruct myStruct) { myStruct.Num += 1; } private static void MethodC(MyClass myClass) { myClass.Num += 1; } private static void MethodD(MyClass myClass) { myClass = new MyClass(); } } ```
What is a structure? Is it a value or reference type? Where is memory allocated? What are the boundaries of effective use of structures?
What is consistent hashing? Virtual shards/buckets?
What are indexes in a database? Types of indexes (B-tree, Hash, Full-text). Clustered vs non-clustered indexes. Covering indexes.
What heaps do you know besides the main one (SOH)? Tell me about the Large Object Heap and Pinned Object Heap.
Task with async/await: how does async/await work? What does it unfold into? What's the difference between Task and ValueTask?
What are GC roots? What types are there?
What will be outputted in a task with virtual methods? Which method has more ticks and why?
Tell me about the GC operation modes: server and desktop. When should each be used?
Tell me about parameter modifiers ref, in, out and their differences. What are readonly ref and ref readonly?
What is the essence of the GC generations concept (0, 1, 2)? What do we optimize?
String task: what will be output? How is the == operator overloaded for strings? What is a string interning pool?
A colleague's task has come up for your Code Review What issues do you see in the code? ```csharp namespace SomeProject.Data { public class UserRepository { public Task SaveUser(User user, Dictionary<int,string> shards) { var shardIdx = user.Id % 3; var shardAddress = shards[shardIdx]; using(var shardService = new ShardService(shardAddress)) { return shardService.SaveUserAsync(user); } } } } ```
LINQ task: what will be output? What is the type of the query variable? What is the difference between IEnumerable and IQueryable?
How to implement your own Where without yield? What is yield and how does it work under the hood?
There is a system that polls temperature, humidity, and pressure sensors located in rooms and saves the readings in a table. Sensor readings are taken once a day. Not all three types of sensors may be installed in each room, and some sensors may not provide data due to failures. You need to write a query that outputs aggregated information about sensor readings of all types for each room per day. Data structure Field Type Description date timestamp Reading date room_id int Room identifier where the sensor is located sensor_type int Sensor type (1 - temperature sensor, 2 - humidity sensor, 3 - pressure sensor) value int Value received from the sensor Example CREATE TABLE t_sensor_data ( date TIMESTAMP, room_id INT, sensor_type INT, value INT ); INSERT INTO t_sensor_data (date, room_id, sensor_type, value) VALUES ('2023-01-01', 1, 1, 25), ('2023-01-01', 1, 2, 15), ('2023-01-01', 2, 1, 27), ('2023-01-01', 2, 2, 12), ('2023-01-01', 2, 3, 940), ('2023-01-01', 1, 1, 27), ('2023-01-01', 1, 2, 45), ('2023-01-01', 1, 3, 950), ('2023-01-01', 2, 1, 25), ('2023-01-01', 2, 2, 30), ('2023-01-01', 2, 3, 940); SELECT * FROM t_sensor_data;