.NET牛人应该知道些什么,我的回答

2022-06-16 13:44:02 浏览数 (1)

What Great .NET Developers Ought To Know (More .NET Interview Questions)

A while back, I posted a list of ASP.NET Interview Questions. Conventional wisdom was split, with about half the folks saying I was nuts and that it was a list of trivia. The others said basically "Ya, those are good. I'd probably have to look a few up." To me, that's the right response.

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?
  • How would one implement ASP.NET HTML output caching, caching outgoing versions of pages generated via all values of q= except where q=5 (as in http://localhost/page.aspx?q=5)?

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牛人应该知道些什么

前些日子我发了一份ASP.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?

0 人点赞