<a href="http://www.hanselman.com/blog/WhatGreatNETDevelopersOughtToKnowMoreNETInterviewQuestions.aspx">What Great .NET Developers Ought To Know (More .NET Interview Questions)</a>
Certainly I wasn't trying to boil all of .NET Software Development down to a few simple "trivia" questions. However, I WAS trying to get folks thinking. I believe that really good ASP.NET (and for that matter, WinForms) is a little [read: lot] more than just draging a control onto a designer and hoping for the best. A good race driver knows his car - what it can do and what it can't.
So, here's another list...a greatly expanded list, for your consumption (with attribution). I wrote this on a plane last week on the way from Boise to Portland. I tried to take into consideration the concerns that my lists contain unreasonable trivia. I tried to make a list that was organized by section. If you've never down ASP.NET, you obviously won't know all the ASP.NET section. If you're an indenpendant consultant, you may never come upon some of these concepts. However, ever question here has come up more than once in the last 4 years of my time at Corillian. So, knowing groking these questions may not make you a good or bad developer, but it WILL save you time when problems arise.
What Great .NET Developers Ought To Know
Everyone who writes code
Describe the difference between a Thread and a Process?
What is a Windows Service and how does its lifecycle differ from a "standard" EXE?
What is the maximum amount of memory any single process on Windows can address? Is this different than the maximum virtual memory for the system? How would this affect a system design?
What is the difference between an EXE and a DLL?
What is strong-typing versus weak-typing? Which is preferred? Why?
Corillian's product is a "Component Container." Name at least 3 component containers that ship now with the Windows Server Family.
What is a PID? How is it useful when troubleshooting a system?
How many processes can listen on a single TCP/IP port?
What is the GAC? What problem does it solve?
Mid-Level .NET Developer
Describe the difference between Interface-oriented, Object-oriented and Aspect-oriented programming.
Describe what an Interface is and how it’s different from a Class.
What is Reflection?
What is the difference between XML Web Services using ASMX and .NET Remoting using SOAP?
Are the type system represented by XmlSchema and the CLS isomorphic?
Conceptually, what is the difference between early-binding and late-binding?
Is using Assembly.Load a static reference or dynamic reference?
When would using Assembly.LoadFrom or Assembly.LoadFile be appropriate?
What is an Asssembly Qualified Name? Is it a filename? How is it different?
Is this valid? Assembly.Load("foo.dll");
How is a strongly-named assembly different from one that isn’t strongly-named?
Can DateTimes be null?
What is the JIT? What is NGEN? What are limitations and benefits of each?
How does the generational garbage collector in the .NET CLR manage object lifetime? What is non-deterministic finalization?
What is the difference between Finalize() and Dispose()?
How is the using() pattern useful? What is IDisposable? How does it support deterministic finalization?
What does this useful command line do? tasklist /m "mscor*"
What is the difference between in-proc and out-of-proc?
What technology enables out-of-proc communication in .NET?
When you’re running a component within ASP.NET, what process is it running within on Windows XP? Windows 2000? Windows 2003?
Senior Developers/Architects
What’s wrong with a line like this? DateTime.Parse(myString);
What are PDBs? Where must they be located for debugging to work?
What is cyclomatic complexity and why is it important?
Write a standard lock() plus “double check” to create a critical section around a variable access.
What is FullTrust? Do GAC’ed assemblies have FullTrust?
What benefit does your code receive if you decorate it with attributes demanding specific Security permissions?
What does this do? gacutil /l | find /i "Corillian"
What does this do? sn -t foo.dll
What ports must be open for DCOM over a firewall? What is the purpose of Port 135?
Contrast OOP and SOA. What are tenets of each?
How does the XmlSerializer work? What ACL permissions does a process using it require?
Why is catch(Exception) almost always a bad idea?
What is the difference between Debug.Write and Trace.Write? When should each be used?
What is the difference between a Debug and Release build? Is there a significant speed difference? Why or why not?
Does JITting occur per-assembly or per-method? How does this affect the working set?
Contrast the use of an abstract base class against an interface?
What is the difference between a.Equals(b) and a == b?
In the context of a comparison, what is object identity versus object equivalence?
How would one do a deep copy in .NET?
Explain current thinking around IClonable.
What is boxing?
Is string a value type or a reference type?
What is the significance of the "PropertySpecified" pattern used by the XmlSerializer? What problem does it attempt to solve?
Why are out parameters a bad idea in .NET? Are they?
Can attributes be placed on specific parameters to a method? Why is this useful?
C# Component Developers
Juxtapose the use of override with new. What is shadowing?
Explain the use of virtual, sealed, override, and abstract.
Explain the importance and use of each component of this string: Foo.Bar, Version=2.0.205.0, Culture=neutral, PublicKeyToken=593777ae2d274679d
Explain the differences between public, protected, private and internal.
What benefit do you get from using a Primary Interop Assembly (PIA)?
By what mechanism does NUnit know what methods to test?
What is the difference between: catch(Exception e){throw e;} and catch(Exception e){throw;}
What is the difference between typeof(foo) and myFoo.GetType()?
Explain what’s happening in the first constructor: public class c{ public c(string a) : this() {;}; public c() {;} } How is this construct useful?
What is this? Can this be used within a static method?
ASP.NET (UI) Developers
Describe how a browser-based Form POST becomes a Server-Side event like Button1_OnClick.
What is a PostBack?
What is ViewState? How is it encoded? Is it encrypted? Who uses ViewState?
What is the <machinekey> element and what two ASP.NET technologies is it used for?
What three Session State providers are available in ASP.NET 1.1? What are the pros and cons of each?
What is Web Gardening? How would using it affect a design?
Given one ASP.NET application, how many application objects does it have on a single proc box? A dual? A dual with Web Gardening enabled? How would this affect a design?
Are threads reused in ASP.NET between reqeusts? Does every HttpRequest get its own thread? Should you use Thread Local storage with ASP.NET?
Is the [ThreadStatic] attribute useful in ASP.NET? Are there side effects? Good or bad?
Give an example of how using an HttpHandler could simplify an existing design that serves Check Images from an .aspx page.
What kinds of events can an HttpModule subscribe to? What influence can they have on an implementation? What can be done without recompiling the ASP.NET Application?
Describe ways to present an arbitrary endpoint (URL) and route requests to that endpoint to ASP.NET.
Explain how cookies work. Give an example of Cookie abuse.
Explain the importance of HttpRequest.ValidateInput()?
What kind of data is passed via HTTP Headers?
Juxtapose the HTTP verbs GET and POST. What is HEAD?
Name and describe at least a half dozen HTTP Status Codes and what they express to the requesting client.
How does if-not-modified-since work? How can it be programmatically implemented with ASP.NET?
Explain <@OutputCache%> and the usage of VaryByParam, VaryByHeader.
How does VaryByCustom work?
Developers using XML
What is the purpose of XML Namespaces?
When is the DOM appropriate for use? When is it not? Are there size limitations?
What is the WS-I Basic Profile and why is it important?
Write a small XML document that uses a default namespace and a qualified (prefixed) namespace. Include elements from both namespace.
What is the one fundamental difference between Elements and Attributes?
What is the difference between Well-Formed XML and Valid XML?
How would you validate XML using .NET?
Why is this almost always a bad idea? When is it a good idea? myXmlDocument.SelectNodes("//mynode");
Describe the difference between pull-style parsers (XmlReader) and eventing-readers (Sax)
What is the difference between XPathDocument and XmlDocument? Describe situations where one should be used over the other.
What is the difference between an XML "Fragment" and an XML "Document."
What does it meant to say “the canonical” form of XML?
Why is the XML InfoSet specification different from the Xml DOM? What does the InfoSet attempt to solve?
Contrast DTDs versus XSDs. What are their similarities and differences? Which is preferred and why?
Does System.Xml support DTDs? How?
Can any XML Schema be represented as an object graph? Vice versa?
.NET牛人應該知道些什麼
當然我并不想把.NET軟體開發概括為一些簡單的小問題,我隻是想讓大家多思考。我相信一個真正優秀的ASP.NET(及WinForm)開發人員應該不僅僅會拖放控件到設計器中,也應該掌握更多的東西。一個優秀的賽車比賽選手很了解他自己的坐駕,他知道哪些可以做?哪些不能做?
是以我準備了另外一份清單——一份擴充的清單,供你使用。這是我上個星期在從博伊西去波特蘭的路上寫在一塊闆上的,并且我也考慮到了那些覺得我的清單過于瑣碎的意見,試圖把這個清單按節管理。如果你從來沒有深入ASP.NET,你肯定不會知道所有ASP.NET問題的答案。如果你是一個獨立顧問,你可能從來沒有遇到過這些概念。但在我呆在科林斯的這4年中,這些問題我都遇到過。是以,是否全面了解這些問題也許與你是不是一個優秀的開發者沒有關系,但在遇到問題時它的确可以幫你節省不少時間。
.NET牛人應該知道些什麼?
任何一個使用.NET的人
描述線程與程序的差別? (程序就是一個獨立的運作的程式,線程是依附于程序的,具體概念還真不清楚。)
什麼是Windows服務,它的生命周期與标準的EXE程式有什麼不同 (Windows服務是沒有運作界面的由Windows服務管理程式進行統一管理的程式,Windows服務一般随作業系統一起運作而不需要人為的啟動運作。标準EXE程式運作後一般是提供了互動界面的,而且一般是人為啟動而不是随作業系統的啟動而啟動。)
Windows上的單個程序所能通路的最大記憶體量是多少?它與系統的最大虛拟記憶體一樣嗎?這對于系統設計有什麼影響? (32位OS中單個程序能通路2G的記憶體,如果啟動了3GB開關的話就可以通路3G記憶體,如果使用了AWE的話可以通路更多的記憶體。與最大虛拟記憶體不一樣吧,系統設計中,對于32位系統,OS操作2G記憶體,另外2G記憶體給程式使用,最大記憶體量決定了某些程式比如SQL Server的性能。)
EXE和DLL之間的差別是什麼? (EXE是可以執行的程式,DLL是動态連結庫,是用于被EXE或其他DLL調用的,用于提供程式接口)
什麼是強類型,什麼是弱類型?哪種更好些?為什麼? (明确定義了資料類型的就叫強類型,未明确類型或類型可以變化的叫弱類型。沒有什麼更好的說法,各有優點。強類型意義明确,發生錯誤的幾率更低,弱類型更靈活。)
PID是什麼?在做系統的故障排除時如何使用它? (PID就是程序辨別的意思,是程序運作時的一個辨別,用于唯一的表示該程序,排除故障時就是根據PID來确認發生故障的程序的。)
單個TCP/IP端口上能夠偵聽多少個程序? (應該是一個吧。)
什麼是GAC?它解決了什麼問題? (全局程式集緩存,在整個作業系統中緩存一些程式集,其他引用該程式集的程式就不需要将這些程式集拷貝到EXE運作的目錄了。)
中級.NET開發人員
闡述面向接口、面向對象、面向方面程式設計的差別 (面向接口就是在定義API時使用接口類型而不是類,面向對象就是将資料和方法封裝成類,通過類的方式進行程式設計,面向方面就完全不知道了)
什麼是Interface?它與Class有什麼差別? (接口就是定義了需要實作的屬性和方法。Class是有具體的實作的,而接口隻是一個定義,Class隻能單繼承,而一個類缺可以實作多個接口。)
什麼是反射? (具體定義不清楚,我隻知道通過反射可以獲得一個程式集中的命名空間、類、屬性、方法等,當然還有Attribute)
使用ASMX的XML Web服務與使用SOAP的.NET Remoting的差別? (Web服務是應用與Internet的RPC,而Remoting是區域網路的,我隻知道這麼點)
類型系統是由XMLSchema表示的嗎?CLS是XMLSchema表示的嗎? (不懂)
從概念上闡述前期綁定(early-binding)和後期綁定(late-binding)的差別? (不知道這裡的前期綁定和後期綁定是什麼)
調用Assembly.Load算靜态引用還是動态引用? (靜态)
何時使用Assembly.LoadFrom?何時使用Assembly.LoadFile? (都是載入一個檔案,不知道有什麼差別,隻有看MSDN了,估計是一個隻能Load同一檔案夾中的檔案,而另一個可以Load其他檔案夾下的檔案。)
什麼叫Assembly Qualified Name?它是一個檔案名嗎?它有什麼不同? (不懂)
Assembly.Load("foo.dll"); 這句話是否正确? (沒有錯吧,難道必須使用絕對路徑?)
做強簽名的assembly與不做強簽名的assembly有什麼不同? (強簽名後不可被修改運作,不做強簽名就可以被反編譯修改,然後重新編譯運作。)
DateTime是否可以為null? (不可)
什麼叫JIT?什麼是NGEN?它們分别有什麼限制和好處? (不知道)
.NET CLR中一代的垃圾收集器是如何管理對象的生命周期的?什麼叫非确定性終結? (一個對象執行個體沒有被任何地方引用時就稱為垃圾,當記憶體不夠是GC就會将該對象執行個體占用的空間清理出來。)
Finalize()和Dispose()之間的差別? (不知道)
using() 文法有用嗎?什麼是IDisposable?它是如何實作确定性終結的。 (using()文法可以在使用對象後自動立即清除在其中使用的對象,是相當有用的。IDisposable是Dispose方法的接口。)
tasklist /m "mscor*" 這句指令是幹嘛的? (完全不懂)
in-proc和out-of-proc的差別 (不明白問題是什麼意思)
.NET裡的哪一項技術能夠實作out-of-proc通訊? (不懂)
當你在ASP.NET中運作一個元件時,它在Windows XP, Windows 2000, Windows 2003上分别跑在哪個程序裡面? (win2000:沒有接觸過,xp:忘記了,win2003:w3wp.exe)
進階開發人員/架構師
DateTime.Parse(myString); 這行代碼有什麼問題? (可能會抛出異常)
PDB是什麼東西? 在調試中它應該放在哪裡? (調試檔案,PDB檔案和對應的EXE,DLL檔案在同一個檔案夾)
什麼叫圈複雜度(cyclomatic complexity)?為什麼它很重要? (圈複雜度就是代碼中條件語句和循環語句出現的次數,他說明了函數的複雜性,低比較好。)
寫一個标準的lock(),在通路變量的前後建立臨界區,要有"雙重檢查", (lock(this.TextBox1){this.TextBox1.Text="test";}雙重檢查不會)
什麼叫FullTrust?放入GAC的assembly是否是FullTrust的? (不懂)
代碼加上需要安全權限的特性有什麼好處? (……)
gacutil /l | find /i "Corillian" 這句指令的作用是什麼? (……)
sn -t foo.dll 這句指令是幹嘛的? (算該程式集的公鑰還是密鑰哦)
DCOM需要防火牆打開哪些端口?端口135是幹嘛用的? (得百度一下,不知道)
對比OOP和SOA,它們的目的分别是什麼? (OOP面向對象程式設計,是一種程式設計思想和方式,以對象為基礎,SOA面向服務的架構,将API封裝為服務(比如Web服務),然後針對這些暴露出的服務進行程式設計。)
XmlSerializer是如何工作的?使用這個類的程序需要什麼ACL權限? (不知道)
為什麼不提倡catch(Exception)? (Catch的時候應該捕捉具體的Exception類型,而不是通用的Exception)
Debug.Write和Trace.Write有什麼不同?何時應該使用哪一個? (沒有用過Trace.Write,是以不知道有何不同)
Debug Build和Release Build的差別,是否會有明顯的速度變化?請說明理由。 (Debug模式下會将很多調試資訊添加到程式中,而Release模式下不會有,速度有一定變化,單不明顯。)
JIT是以assembly為機關發生還是以方法為機關發生?這對于工作區有何影響? (不知道)
對比抽象基類和接口的使用 (抽象基類定了的是抽象方法和一下實作方法,接口隻提供定義,不提供任何實作)
a.Equals(b)和a == b一樣嗎? (不一樣,Equals還要求類型一樣,而==隻要求值一樣)
在對象比較中,對象一緻和對象相等分别是指什麼? (對象一緻包括對象的類型和對象的值都相同,而對象相等是指值相等)
在.NET中如何實作深拷貝(deep copy)? (.net隻提供了淺拷貝的方法,深拷貝隻有自己程式設計了)
請解釋一下IClonable (實作object Clone()方法的接口)
什麼叫裝箱? (将對象轉換為基對象)
string是值類型還是引用類型? (都是)
XmlSerializer使用的針對屬性的模式有什麼好處?解決了什麼問題? (不知道)
為什麼不應該在.NET中使用out參數?它究竟好不好? (應該使用對象來傳值,使用out是不是很好的)
特性能夠放到某個方法的參數上?如果可以,這有什麼用? (可以啊,用處忘記了,得翻MSDN了)
C# 元件開發人員
什麼時候使用override?什麼時候使用new? 什麼叫shadowing? (重寫父類的方法的時候用override以實作多态,如果父類中的方法不是virtual的也不是abstract的才使用new,shadowing不懂)
解釋virtual、sealed、override和abstract的差別 (virtual申明虛方法的關鍵字,說明該方法可以被重寫,sealed說明該類不可被繼承,override重寫基類的方法,abstract申明抽象類和抽象方法的關鍵字,抽象方法不提供實作,由子類實作,抽象類不可執行個體化。)
Foo.Bar, Version=2.0.205.0, Culture=neutral, PublicKeyToken=593777ae2d274679d 解釋這個字元串每個部分的重要性和作用 (程式集的名字、版本、Culture不知道,公鑰,這些用于GAC中申明一個唯一的程式集)
解釋public、protected、private和internal的差別(public可被内外通路,protected隻能被内部和之類通路,private隻能内部通路,internal隻能在該程式集中被通路)
使用Primary Interop Assembly (PIA)有什麼好處? (不懂)
NUnit是通過什麼機制獲知需要測試哪些方法的? (反射,為測試方法加了Attribute)
catch(Exception e){throw e;}和catch(Exception e){throw;}的差別(将發生的異常對象抛出,另一個隻是抛出異常,并沒有抛出原異常對象)
typeof(foo)和myFoo.GetType()的差別? (typeof(foo)不會出現異常,myFoo.GetType()可能會因為myFoo為null而産生異常)
public class c{ public c(string a) : this() {;}; public c() {;} } 解釋第一個構造函數中發生了什麼? 這個構造函數有什麼用? (第一個構造函數調用了第二個構造函數,這個構造函數構造了一個c對象的執行個體。)
this是幹嘛用的?能夠用在static方法中? (this表示該執行個體内,不能用于static中)
ASP.NET (UI)開發人員(基本不會,就不答了)
闡述一個基于浏覽器的Form POST如何變成一個伺服器端的事件,如Button1_OnClick。
什麼是PostBack?
什麼是ViewState? 它是否被編碼過? 是否被加密過?誰會使用ViewState?
<machinekey>元素是幹嘛用的?它用于哪兩項ASP.NET技術?
說出ASP.NET 1.1中的3種Session State提供程式以及它們的優缺點?
什麼叫Web Gardening? 在設計中如何使用它?
假設有一個ASP.NET應用程式,那麼單獨一個程序中允許多少應用程式對象?那兩個程序呢?啟用了Web Gardening的2個程序呢?這對設計有何影響?
ASP.NET會重用多個請求之間的線程嗎?是否每個HttpRequest都有自己的線程?你是否應該用ASP.NET的Thread Local存儲?
[ThreadStatic]屬性在ASP.NET中有用嗎?它有沒有副作用?是好是壞?
如何使用HttpHandler簡化現有的為.aspx頁面提供驗證圖檔的設計
HttpModule訂閱的是什麼類型的事件? 這對于實作有何影響?如果不打算重新編譯ASP.NE應用程式,應該怎麼做?
說出表示任意一個終端(URL)的方式,以及ASP.NET中把請求路由到那個終點的方式
解釋cookie的工作原理。給出一個濫用Cookie的例子。
解釋HttpRequest.ValidateInput()的重要性?
哪些資料是通過HTTP Header傳遞的?
對比HTTP動詞GET和POST? 什麼是HEAD?
說出至少6個HTTP狀态碼以及它們的含義
if-not-modified-since的工作原理是什麼? 用ASP.NET如何實作它?
解釋 <@OutputCache%>和如何使用VaryByParam、VaryByHeader.
VaryByCustom是如何工作的?
如何通過q=? (除了q=5)來實作ASP.NET HTML輸出緩沖和緩沖過期(比如http://localhost/page.aspx?q=5)?
XML開發人員(我基本上不會,就不回答了)
XML命名空間的作用?
何時适合使用DOM?何時不适合?有沒有尺度限制?
什麼是WS-I基本配置?它重要在哪裡?
寫一個小XML文檔,其中使用的是預設的命名空間,以及一個合法的(字首)命名空間,其中要有分别屬性這兩個命名空間的元素
元素和特性的基本差別在哪裡?
格式完好的XML和有效的XML有什麼差別?
.NET中如何驗證XML?
myXmlDocument.SelectNodes("//mynode"); 為什麼這句代碼不好?什麼時候它是好的?
拉式解析(XmlReader)與事件讀取器(Sax)的差別
XPathDocument和XmlDocument的差別? 在何種情況下應該用哪一個?
“XML片斷”與“XML文檔”有什麼差別
什麼叫格式規範的XML?
XML InfoSet規範與Xml DOM有什麼不同? InfoSet是要解決什麼問題?
比較DTD和XSD,它們的相似點與差別分别是什麼?哪個更好些?為什麼?
System.Xml支援DTD嗎?如果支援,如何使用?
XML Schema能夠表示為對象圖?對象圖能夠表示為XML Schema?
本文轉自深藍居部落格園部落格,原文連結:http://www.cnblogs.com/studyzy/archive/2008/04/13/1151805.html,如需轉載請自行聯系原作者