- What is a Garbage Collector in C# (what does it do).
- Are the objects automatically GC-ed in C#? If not, why/how?
- Are the structs automatically GC-ed in C#?
- Tell me the difference between stack and heap (memory management)
- What is a virtual destructor in C++?
- How do you run two methods in parallel in C#?
- If two methods both increment a variable, is there a problem (is the value higher or lower) and how to fix it?
- How do you implement a function that takes a byte value and return true if its most-significant-bit is set?
- What is the difference between as and is in C#?
Some Answers
You can use Parallel.Invoke or Task.Factory.StartNew and Task.WaitAll to run two methods in parallel.
structs are value-types so they are automatically GC-ed in C#.
Primitive data types like int live in stack while objects are normally in heap.
1 2 3 | inline bool check(byte v) { return v & 0b10000000; } |
inline bool check(byte v) { return v & 0b10000000; }
You need to lock the variables when multiple threads write to them at the same time – race conditions.
–EOF (The Ultimate Computing & Technology Blog) —
GD Star Rating
loading...
303 wordsloading...
Last Post: Steem Witness Update: Witness Feed Now Published Every Hour!
Next Post: Tips To Pass The CompTIA Linux+ LX0-103 Certification Exam