Some. Net-related questions worth thinking about and understanding

Source: Internet
Author: User

I used to be interviewed by others. Later, my daughter-in-law became a man-in-law for many years. I also interviewed others after I got into a technical management position. I always think there are some skills for interviews. It is really not easy to know if a candidate meets the job requirements in just half an hour or two.
I usually select an interview based on the interviewer's work experience. For interviewers with less work experience (two or less years), they prefer to do questions or actually perform machine operations, because such interviewers also do some preliminary work after they come in, it is enough to be proficient in operating software and understand some basic knowledge. If you have many years of work experience, you can generally talk to the interviewer to understand the level of the subject. As the saying goes, "when you reach out, you will know if there is anything ", experienced developers know what issues should be paid attention to in different occasions and stages, and they can know the level of their peers through conversations.
The above is my experience. Next I will also talk about some representative questions I have asked during the phone interview over the past few years. These questions are mostly related to. net. If you are interested, take a look. Of course, among these issues that I think are worth recording, there is absolutely no problem with the usage of controls. The following questions are sorted by the order of memories.

Q: What are the differences between ASP. net1.1 and ASP. net2.0.
See the Declaration Code of the ASP. NET page when ASP. net1.1 adopts the Page code separation mode (from the binyue forum, which I used to learn the three-tier architecture in my early years ):
<% @ Page Language = "C #" codebehind = "listlword. aspx. cs" autoeventwireup = "false" inherits = "tracelword1.listlword" %>
The corresponding background code declaration is as follows:
Public class listlword: system. Web. UI. Page
ASP. NET page code when ASP. net2.0 adopts the Page code separation mode:

<% @ Page Language = "C #" autoeventwireup = "true" codefile = "test. aspx. cs" inherits = "test" %>
The corresponding background code is as follows:

Public partial class test: system. Web. UI. Page
The Code Declaration shows that ASP. ASP in net1.1.. NET page HTML code is associated with CS code through the codebehind keyword. In the background code, it directly inherits system. web. UI. in ASP. net2.0 is associated by using the codefile keyword. The partial keyword is used in the background code, indicating that the current class is a local class.
Because it is a long time, combined with ASP. net1.1 is basically used by no one. I do not know the differences between the two methods. I remember someone who talked about the advantages of this method in the past. Here we will talk about some work behind the ASP. NET engine. Java EE programmers will be told that all JSP pages will be compiled into servlet files when they are requested for the first time, and then compiled into these servler files. class file, and then run the compiled file directly when you request it again. class file (someone told me this when I was learning JSP), in fact, in ASP. net also has a similar processing process, and. the processing process in. Net is a little more complicated than this (especially when the code separation mode is used ), when the first request is made, the compilation engine will include the ASPX page code containing HTML code and. CS file to synthesize. CS file, and then. the CS file is compiled. DLL file, JIT (instant compiler) will compile the code to the local machine code, and then run the local machine code to return the results to the client, the Code of these local machines will be cached in the memory. If the memory is not cleaned up and a client requests this page, the local machine code cached in the memory will be directly run, otherwise, you need. DLL file compilation cost local machine code and execution And cache. Of course, if the aspx code or. CS code is modified, the next request will go through the entire process again.

Q: Let's talk about the features of binary serialization and XML serialization.
Binary serialization and deserialization use the binaryformatter class, and XML serialization uses the xmlserializer class. The feature of binary serialization is that all Members will be serialized whether it is a read-only attribute or not; the serialization performance is high. XML serialization features high interoperability and readability.
In fact, there are other serialization methods such as soapformatter for serialization classes, which are suitable for different scenarios. Zhou Gong's blog also provides examples of binaryformatter, xmlserializer, and soapformatter usage. If you are interested, find one.

Q: What is a small copy? What is deep copy? How to implement deep copy?
Shallow copy is also called Shadow Copy. A memberwiseclone () method is defined in the ancestor object class of all objects in. Net to implement shallow copy. The specific method is to create a superficial copy by creating a new object and then copying the non-static fields of the current object to the new object. If the field is of the value type, perform a step-by-step copy on the field. If the field is of reference type, the referenced object is copied but not referenced. Therefore, the original object and its counterparts reference the same object.
There will be a problem in the shortest copy, that is, if we perform shortest copy on Object A to get object B, assuming that object A contains the reference type variable M, once m is changed, the corresponding variable value in object B also changes. In some cases, unpredictable conditions may occur. To solve this problem, deep copy is required ). After deep copy is performed, the value of the variable of the-value type is copied to B, and the value of the field of the referenced type in a is copied to B, in this way, changing the value of the reference type in a will not reflect the corresponding field in B.
How to implement deep copy? In msdn, we recommend that you implement icloneable to create deep or superficial replicas. In practice, serialization A is generally used, then, deserialize the serialized result to B to achieve deep copy.

Q: Let's take a look at the details of ASP. NET named pipelines.
ASP. NET named pipeline is also called HTTP pipeline. It refers to the details of a series of processing processes after the client requests are sent to the ASP. NET engine by the Web server. For details about HTTP Process processing, see ASP. in Chapter 12th of "net Night Talk" (because of the agreement signed with the press, it was not posted on the blog). If you want to know the details, please refer to "Workshop.
Here, we only show the figure of the author's speech here, which is quite good.

Q: What is the difference between ASP. NET in iis5, IIS6, and iis7?.
Iis5 ASP. NET Request Processing Process
Worker Process.
IIS6 ASP. NET Request Processing Process
Memory, which works in user-mode, and in kernel-mode, allows access to all memory and CPU commands.
Iis7 ASP. NET Request Processing Process
In iis7, there are two processing modes: Classic mode and integration mode. In iis7, the classic mode is compatible with IIS6. In IIS6, ASP. net isapi exists as a plug-in, while in iis7, it is converted from the role of the plug-in to the core.
The execution architecture of IIS6 and the execution architecture of the iis7 application pool configured in Classic Mode
Execution architecture diagram of IIS 7 (Architecture in managed channel mode)
That is, the improvements from iis5 to IIS6 are mainly on HTTP. sys, while the improvements from IIS6 to iis7 are mainly on ISAPI.
Note: The above text and pictures from the preparation of the Article, the article is:

Q: Which interface does the system. Web. UI. Page class implement? What methods and attributes does it define?
We know all ASP. net pages are directly or indirectly integrated from system. web. UI. page class, system. web. UI. the page class implements system. web. the ihttphandler interface defines a void processrequest (httpcontext context) method and an isreusable attribute. The isreusable attribute is a bool value, which indicates whether the ihttphandler instance can be used again. Generally, this value should be set to false. A typical example is the page class compiled by ourselves, because it is set to false by default, even if you want to send multiple requests to the same page on the server, different instances are obtained each time. Many beginners often ask: I have declared a member variable on the page and assigned a value. Why is there no value after I click the PostBack button? Because the instance is not reused, a new instance is obtained after submission (it is recommended that you do not change this default setting easily to store variable values among different requests ).
The events and methods in the ASP. NET page lifecycle are as follows:

Q: What is your idea if I use the. NET language to design a web server similar to tomcat?
Tomcat is a Java EE container in Java that supports JSP and servlet. In my early years, I had the idea of imitating tomcat, so I also answered my ideas. At that time, when someone asked this question, I didn't really need to use code to implement such a function, because most people didn't have the experience of writing Web servers, this is mainly used to assess my response and ideas when I encounter a problem that I have never encountered before.

Q: How does a database deadlock occur? How to solve the deadlock problem?
If there is still a link between the previous issue and. net, it actually has nothing to do with. net. To be honest, I have never encountered a database deadlock before, so I don't know how to solve it. Later, I read a lot of materials and have some knowledge about this. If you are interested, please refer to
Conclusion: In the past few years of interview experience, not only are technical questions asked, there are also management issues (I have also talked about several typical management issues on my blog, named "several common problems in Technical Management"). recall some technical issues and summarize them. In addition to summing up, it also gives some programmers who have learned how to drag controls to learn about ASP. net to dig deep into the knowledge that can be learned, of course, these are just points, after you master these points, you can try to point with surface, do not stay on the surface.
Zhou Gong

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: 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.