Record a c # interview,

Source: Internet
Author: User

Record a c # interview,

The first interview after I recently attended a job. Although I did not talk about it in the end, I still had a lot of gains, both in terms of technology and interview experience.

This interview is quite different from the interview I attended at school.
The questions asked during the campus recruitment interview seem to be more specific. They are directly targeted at technical points. If you know such questions, you will know them. If you do not know them, you will not know them...
Most of the questions asked during this interview are rough. It seems that the interviewer wants to give free play to a larger space, that is, to say what he understands as much as possible...
However, I have several questions that I can't say .. It is estimated that the interviewer is not very impressed. Below are a few very bad technical questions to be answered. I'm the only one to ask...


Question 1: Memory Optimization
The previous question was "talking about C # Memory Management". I answered very concisely "CLR recycles memory through GC "...
When I heard this question, I was a bit confused. I was wondering how to optimize the GC algorithm ?! I really don't know how to implement the GC algorithm, So I hastily replied:
I don't know ..... (Then the two were silenced for several seconds)

Post-event analysis:
First of all, no matter whether the interviewer asks for GC algorithm optimization, my answer at the time was definitely to make the interviewer speechless, not only to make people feel that the technical depth is not enough, but also may make people feel that the interview attitude is incorrect.
In addition, even if there is nothing to say about "optimization", you can also talk about "Slag". On the other hand, your understanding is still far better than anything else.

Therefore, the better answer should be as follows:
1) do not construct a large struct.
Because the value type may be allocated to the stack, there is no way to manage the space it occupies by GC, and it depends on itself when to release the memory.
2) if you really want to construct a large volume of struct, you should consider using ref for this type of method parameters.
Because the value type is completely copied when the parameter is passed by value, it not only takes space but also time. If you do not need to retain the copy, directly transferring the address will increase the efficiency.
3) Release unmanaged resources using IDisposable instead of destructor.
Because the time when the Destructor is called is extremely uncertain, even the objects that have run the Destructor will have to wait for the next GC to be recycled. IDisposable does not have these two shortcomings.
4) WeakReference.
For an object that occupies a lot of space and is not difficult to construct, using weak references is a good choice.


Question 2: C # Can I write unmanaged code?
I am also very confused when receiving this question, because I did not take C # To write any unmanaged code, and adhered to the principle of "better trust has its untrustworthy and Its untrustworthy, I think there may be ways to implement unmanaged code...
After a while, I thought about whether to ask about pointers? Then let's talk about this...

Post-event analysis:
Strictly speaking, C # is a programming language, and it relies entirely on compilers that are not hosted. However, the interviewer apparently did not ask this question...
Besides, the unsafe code is still dependent on CLR and accepts type checks, so I think it should be hosted. NGen cannot be left behind by CLR or managed...
I don't know how to deal with. NET Native. What I understand is that it streamlined the CLR and gave it together to the compilation cost code. It seems that it is still not completely out of the CLR.
Then Baidu came to a magic thing, the operating system written by C... What the gods do
Http://en.wikipedia.org/wiki/SharpOS_%28operating_system%29

Better answer:
Just give me your understanding. It's better than saying nothing...


Question 3: About binding and dependency attributes
This question is my technical blind zone... Although I have read WPF books before, I have forgotten about it for a long time. Early in the morning, I did not write this book into my resume at the beginning...
During the interview, I only vaguely remembered that there was an INotifyPropertyChanged. I answered that the set Method of the dependency attribute triggers an event and binds it...

Post-event analysis:
After turning over the source code, we can see that no half-cent relationship exists between DependencyProperty and DependencyObject and INotifyPropertyChanged...
So what is the implementation of this binding? So we continue to translate the source code...
Starting with FrameworkElement. SetBinding, it has been switched to BindingExpressionBase. Seeing a ValueChanged event in this class, I suddenly felt that the truth was not far from me...
However, the DependencyObject. SetValue and the event are not found...
In the end, I had no choice but to Debug and the source code. Every suspicious method looked like F11, so I tried to find out what it was...
Then I got familiar with the DependencyObject. policypropertychange method... ORZ

Better answer:
This really cannot be answered... It can only be blamed for the lack of warmth at ordinary times.



The last thing I want to talk about is that fresh graduates still have an advantage in finding a job. During school recruitment, enterprises will pay more attention to the future increment of students, and the current inventory will not be extravagant.
At the same time, large enterprises will pay more attention to increment than small and medium-sized enterprises, because small and medium-sized enterprises cannot afford that risk. It is too difficult for them to bet on the Growth of candidates.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.