日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > asp.net >内容正文

asp.net

.Net程序员面试 中级篇 (回答Scott Hanselman的问题)

發布時間:2023/12/20 asp.net 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 .Net程序员面试 中级篇 (回答Scott Hanselman的问题) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

  繼《.Net 程序員面試 C# 語言篇 (回答Scott Hanselman的問題)》跟《.Net程序員面試 每個人都應知道篇 (回答Scott Hanselman的問題)》之后,今天回答Scott Hanselman在他清單上列出的“中級.Net程序員應該知道的問題”。

?

1. 面向接口,面向對象,面向方向的編程的不同 (Describe the difference between Interface-oriented, Object-oriented and Aspect-oriented programming.)

?

Interface-oriented (面向接口): 其實項目中非常頻繁的使用Interface,但從來不知道這就叫 Interface-oriented programming. 使用Interface的好處就是降低代碼的耦合程度,比方說,一個Url需要用戶登陸才能訪問,如果 thisUrl : IAuthentication, 那么你在實現 thisUrl class的時候,就不需要操心Authentication的問題。使用Interface的另外一個好處是,單元測試thisUrl 類的時候,可以mock IAuthentication.

?

Object-oriented (面向對象): 自己從來沒有嚴謹的定義過,但知道對象有狀態,有方法,相似對象的抽象叫做類,對象是類的具體。面向對象的編程有封裝,多臺,繼承等概念。

?

Aspect-oriented (面向方向): 一種避免重復性代碼的編程方法,當代碼中很多地方都重復用到同一個功能的時候 e.g. logging,可以使用aspect統一處理logging這部分的邏輯。The Ted Neward Challenge (AOP without the buzzwords)?這篇文章對我理解這個概念非常有幫助。

?

2. 接口跟類的區別?Describe what an Interface is and how it’s different from a Class.

接口(Interface): 不能實列化,自己沒有狀態,方法也沒有具體的實現,被繼承時,繼承類需要實現接口的所有方法。接口就像租房時網上下載的一個租房合同模板。

類 (Class): 可以被實例化,有狀態,被繼承時,繼承類也不需要重新實現被繼承類中的方法。但是如果被繼承類的方法中有abstract修飾的,繼承類則需要實現這個方法。類像是已經被填上內容的租房合同的模板。

?

3. 什么是反射?What is Reflection?

代碼在運行過程中動態獲取程序集的信息,對象的信息,或者直接調用對象的方法或屬性 e.g. var i = 100; i.GetType(); 輸出System.Int32.

?

4. XML web service 跟 .Net Remoting 的不同 (What is the difference between XML Web Services using ASMX and .NET Remoting using SOAP?)

XML Web service: 是開放標準,使用Http/SOAP協議交互。

.Net Remoting: 是微軟自己的技術,只能在.Net里面使用。

因為自己沒有接觸過ASMX, .Net Remoting, 所以只能了解個皮毛,在網上看到一個答案,比較的詳細:

Remoting assumes the other end is .NET. This is because .NET remoting using SOAP uses the SoapFormatter to serialize data. SoapFormatter embeds the type information required to deserialize the object into the message itself. This requires that the client and the server must have access to this assembly. Remoting believes in the .NET Type System. Remoting believes in sharing types and assemblies. Remoting can support DCOM style Client Activated Objects which are stateful. The use of CAOs though have to be carefully thought about because CAOs cannot be load balanced. ASMX model does not assume that the other end is .NET. ASMX uses XmlSerializer to serialize data. Xmlserailizer believes that the XML Type System, that is the XSD is superior and works on serializing data conforming to a schema. In other words XML Web Services believe in sharing schema and contracts over types and assemblies. This makes the Web Services interoperable. ASMX services are usually stateless.

?

5. XmlSchema和CLS的類型體系是否異種同形? (Are the type system represented by XmlSchema and the CLS isomorphic?)

查了baidu才知道, isomorphic的意思, 異種同形. XmlSchema跟CLS的類型體系是不完全一樣的, 比如說數字類型, XmlSchema 就有negativeInteger等.Net沒有的類型.

?

6.?早期綁定跟晚期綁定的不同?(what is the difference between early-binding and late-binding?)

不知道是不是這么翻譯的,early-binding: 是指編譯的時候綁定,late-binding是指運行的時候綁定.e.g.?person.DoSomething() early binding.
late binding:

?

1 Type animal = typeof(Animal);
2 ?object o = Activator.CreateInstance(animal);
3 var text = animal.InvokeMember("DoSomething", BindingFlags.Default | BindingFlags.InvokeMethod, null, o, null);

?

?

?

7.?Is using Assembly.Load a static reference or dynamic reference?

動態

?

8. 什么時候合適使用Assembly.LoadFrom 或 Assembly.LoadFile?(When would using Assembly.LoadFrom or Assembly.LoadFile be appropriate?)

自己不太明白,什么時候用比較合適,有哪位知道嗎?

?

9. 一個程序集合格的名字是怎么樣的?是文件名嗎?如不是,區別是什么?(What is an Asssembly Qualified Name? Is it a filename? How is it different?)

一個程序集的名字有四個部分組成,文件名(file name),不包含后綴,Public key Token, Culture, Version. 跟文件名不同,

?

10.?Assembly.Load("foo.dll") 對嗎?(Is this valid? Assembly.Load("foo.dll");)

不對,Assembly.Load("foo, Version=1.0.2004.0, Culture=neutral, PublicKeyToken=8744b20f8da049e3")

?

11.?strongly-named 程序集跟非strongly-named 程序集有何不同?(How is a strongly-named assembly different from one that isn’t strongly-named?)

strongly-named 程序集可以保成程序集的獨特性,并且可以防止使用被別人篡改過的程序集

?

12.?Can DateTimes be null?

DateTime 不能為Null.

?

13. 解釋JIT, NGEN,以及它們的優劣?(What is the JIT? What is NGEN? What are limitations and benefits of each?)

JIT: Just In Time 編譯,優勢: 任何JIT都可以編譯; 劣勢:?啟動時間比較長.

NGEN: 直接編譯成機器代碼,優勢: 啟動時間比較長; 劣勢: 只能運行在本系統.

?

不確定是否這樣解釋?請高手指正.

?

14.?How does the generational garbage collector in the .NET CLR manage object lifetime? What is non-deterministic finalization?

CLR把對象分成三代, .Net GC通過一個對象被創建的時間來決定這個對象的壽命. 創建時間比較短的對象越早被收集, 創建時間比較長的對象越晚被收集.

non-deterministic finalization 是指你根本沒有辦法確定或控制一個對象被GC收集.

?

15.?Finalize() 和 Dispose() 的區別 (What is the difference between Finalize() and Dispose()?)

GC在收集一個對象的時候, 調用Finalize(), 程序員沒有辦法調用. 但是程序員應該負責在使用未托管資源(unmanaged object or resources)時使用Dispose(), 確保該資源被GC及時收集.

?

16.?How is the using() pattern useful? What is IDisposable? How does it support deterministic finalization?

using()可以確保Dispose()在using() block 結束的時候被調用. IDisposable 只有一個方法, Dispose(), 當一個類繼承IDisposable時, 這個類的對象使用using()時, Dispose()被調用.

?

17.?What does this useful command line do? tasklist /m "mscor*"

列出所有使用符合引號內pattern的dll的進程.

?

18.?What is the difference between in-proc and out-of-proc?

In-proc 發生在一個進程之內, Out-of-proc 發生在不同進程之間。

?

19.?What technology enables out-of-proc communication in .NET?

.Net remoting

?

20.?When you’re running a component within?ASP.NET, what process is it running within on Windows XP? Windows 2000? Windows 2003?

Windows XP and 2000 : aspnet_wp.exe?

Windows 2003 : w3wp.exe

?

  回答這20道題目的時候,明顯感覺到難度,花了大半天的時間,其中很多是在借助了google 之后閱讀了很多的文章才知道一些。看來,成為一位合格的中級.Net程序員要補的課還真是不少呢。

?

  很好奇,不知道博客園里的.Net程序員們有多少對這些問題都能夠了如指掌,對答如流的?

轉載于:https://www.cnblogs.com/lipu/archive/2010/11/14/interview_questions_middle_level_by_Scott_Hanselman.html

總結

以上是生活随笔為你收集整理的.Net程序员面试 中级篇 (回答Scott Hanselman的问题)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。