• 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?

    原文地址:http://www.hanselman.com/blog/WhatGreatNETDevelopersOughtToKnowMoreNETInterviewQuestions.aspx

    作者:Scott Hanselman

    原文标题:What Great .NET Developers Ought To Know

    译者:Tony Qu

    前些日子我发了一份ASP.NET面试题 清单. 有一些访客比较保守,觉得我是没事找事,里面都是些很琐碎的问题。剩下的人则说“蛮不错的,我得去看一看其中的一些问题” 我更喜欢后者的回复,我觉得后者才是正确的态度。 

    当然我并不想把.NET软件开发概括为一些简单的小问题,我只是想让大家多思考。我相信一个真正优秀的ASP.NET(及WinForm)开发人员应该不仅仅会拖放控件到设计器中,也应该掌握更多的东西。一个优秀的赛车比赛选手很了解他自己的坐驾,他知道哪些可以做?哪些不能做? 

    所以我准备了另外一份清单——一份扩展的清单,供你使用。这是我上个星期在从博伊西去波特兰的路上写在一块板上的,并且我也考虑到了那些觉得我的清单过于琐碎的意见,试图把这个清单按节管理。如果你从来没有深入ASP.NET,你肯定不会知道所有ASP.NET问题的答案。如果你是一个独立顾问,你可能从来没有遇到过这些概念。但在我呆在科林斯的这4年中,这些问题我都遇到过。因此,是否全面理解这些问题也许与你是不是一个优秀的开发者没有关系,但在遇到问题时它的确可以帮你节省不少时间。  

    .NET牛人应该知道些什么? 

    任何一个使用.NET的人 

    描述线程与进程的区别? 什么是Windows服务,它的生命周期与标准的EXE程序有什么不同 Windows上的单个进程所能访问的最大内存量是多少?它与系统的最大虚拟内存一样吗?这对于系统设计有什么影响? EXE和DLL之间的区别是什么? 什么是强类型,什么是弱类型?哪种更好些?为什么? PID是什么?在做系统的故障排除时如何使用它? 单个TCP/IP端口上能够侦听多少个进程? 什么是GAC?它解决了什么问题?
     
    中级.NET开发人员 

    阐述面向接口、面向对象、面向方面编程的区别 什么是Interface?它与Class有什么区别? 什么是反射? 使用ASMX的XML Web服务与使用SOAP的.NET Remoting的区别? 类型系统是由XMLSchema表示的吗?CLS是XMLSchema表示的吗? 从概念上阐述前期绑定(early-binding)和后期绑定(late-binding)的区别? 调用Assembly.Load算静态引用还是动态引用? 何时使用Assembly.LoadFrom?何时使用Assembly.LoadFile? 什么叫Assembly Qualified Name?它是一个文件名吗?它有什么不同? Assembly.Load("foo.dll"); 这句话是否正确? 做强签名的assembly与不做强签名的assembly有什么不同? DateTime是否可以为null? 什么叫JIT?什么是NGEN?它们分别有什么限制和好处? .NET CLR中一代的垃圾收集器是如何管理对象的生命周期的?什么叫非确定性终结? Finalize()和Dispose()之间的区别? using() 语法有用吗?什么是IDisposable?它是如何实现确定性终结的。 tasklist /m "mscor*" 这句命令是干嘛的? in-proc和out-of-proc的区别 .NET里的哪一项技术能够实现out-of-proc通讯? 当你在ASP.NET中运行一个组件时,它在Windows XP, Windows 2000, Windows 2003上分别跑在哪个进程里面?
     
    高级开发人员/架构师 

    DateTime.Parse(myString); 这行代码有什么问题? PDB是什么东西? 在调试中它应该放在哪里? 什么叫圈复杂度(cyclomatic complexity)?为什么它很重要? 写一个标准的lock(),在访问变量的前后创建临界区,要有"双重检查", 什么叫FullTrust?放入GAC的assembly是否是FullTrust的? 代码加上需要安全权限的特性有什么好处? gacutil /l  ¦ find /i "Corillian" 这句命令的作用是什么? sn -t foo.dll 这句命令是干嘛的? DCOM需要防火墙打开哪些端口?端口135是干嘛用的? 对比OOP和SOA,它们的目的分别是什么? XmlSerializer是如何工作的?使用这个类的进程需要什么ACL权限? 为什么不提倡catch(Exception)? Debug.Write和Trace.Write有什么不同?何时应该使用哪一个? Debug Build和Release Build的区别,是否会有明显的速度变化?请说明理由。 JIT是以assembly为单位发生还是以方法为单位发生?这对于工作区有何影响? 对比抽象基类和接口的使用 a.Equals(b)和a == b一样吗? 在对象比较中,对象一致和对象相等分别是指什么? 在.NET中如何实现深拷贝(deep copy)? 请解释一下IClonable 什么叫装箱? string是值类型还是引用类型? XmlSerializer使用的针对属性的模式有什么好处?解决了什么问题? 为什么不应该在.NET中使用out参数?它究竟好不好? 特性能够放到某个方法的参数上?如果可以,这有什么用?
     
    C# 组件开发人员 

    什么时候使用override?什么时候使用new? 什么叫shadowing? 解释virtual、sealed、override和abstract的区别 Foo.Bar, Version=2.0.205.0, Culture=neutral, PublicKeyToken=593777ae2d274679d 解释这个字符串每个部分的重要性和作用 解释public、protected、private和internal的区别 使用Primary Interop Assembly (PIA)有什么好处? NUnit是通过什么机制获知需要测试哪些方法的? catch(Exception e){throw e;}和catch(Exception e){throw;}的区别 typeof(foo)和myFoo.GetType()的区别? public class c{ public c(string a) : this() {;}; public c() {;} } 解释第一个构造函数中发生了什么? 这个构造函数有什么用? 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?

    任何一个使用.NET的人

    1) 描述线程与进程的区别?

    线程(Thread)与进程(Process)二者都定义了某种边界,不同的是进程定义的是应用程序与应用程序之间的边界,不同的进程之间不能共享代码和数据空间,而线程定义的是代码执行堆栈和执行上下文的边界。一个进程可以包括若干个线程,同时创建多个线程来完成某项任务,便是多线程。而同一进程中的不同线程共享代码和数据空间。用一个比喻来说,如果一个家庭代表一个进程,在家庭内部,各个成员就是线程,家庭中的每个成员都有义务对家庭的财富进行积累,同时也有权利对家庭财富进行消费,当面对一个任务的时候,家庭也可以派出几个成员来协同完成,而家庭之外的人则没有办法直接消费不属于自己家庭的财产。

    2) 什么是Windows服务,它的生命周期与标准的EXE程序有什么不同

    Windows服务是运行在windows后台指定用户下(默认System)的应用程序,它没有标准的UI界面,想比标准的EXE程序,Windows服务是在服务开始的时候创建,而在服务结束的时候销毁,而且可以设置服务是否与操作系统一起启动,一起关闭。它支持三种方式:1)自动方式 2)手动方式 3)禁用 。自动方式的时候,windows服务将在OS启动后自动启动运行,而手动方式则必须手工启动服务,禁用的情况下服务将不能被启动。另外标准的EXE默认使用的当前登录的用户,而windows服务则默认使用System用户,这在对系统资源访问的时候特别需要注意。

    3) Windows单个进程所能访问的最大内存量是多少?它与系统的最大虚拟内存一样吗?这对于系统设计有什么影响?

    这个需要针对硬件平台,公式为单个进程能访问的最大内存量=2的处理器位数次方/2,比如通常情况下,32位处理器下,单个进程所能访问的最大内存量为:232 /2 = 2G 。单个进程能访问的最大内存量是最大虚拟内存的1/2,因为要分配给操作系统一半虚拟内存。

    4) 什么是强类型,什么是弱类型?哪种更好些?为什么?

    强类型是在编译的时候就确定类型的数据,在执行时类型不能更改,而弱类型在执行的时候才会确定类型。没有好不好,二者各有好处,强类型安全,因为它事先已经确定好了,而且效率高。一般用于编译型编程语言,如c++,java,c#,pascal等,弱类型相比而言不安全,在运行的时候容易出现错误,但它灵活,多用于解释型编程语言,如javascript,vb等

    5) PID是什么?在做系统的故障排除时如何使用它?

    PID是进程编号,在系统发现故障的时候,可以根据它寻找故障所发生的具体进程,并且可通过visual studio.net等ide将故障进程附加到进程中进行调试(debug)

    6) 单个TCP/IP端口上能够被多少个进程侦听?

    可以为多个,多个为端口复用 (多谢蛙蛙池塘的提醒)
    看下面代码


    端口复用
    Socket socket1 = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
    Socket socket2 = new Socket(AddressFa
     

    转自周公

  • 相关阅读:
    xagrs 指定参数位置
    Virtual Machine Kernel Panic : Not Syncing : VFS : Unable To Mount Root FS On Unknown-Block (0,0)
    Laravel Session() 失效的问题
    dirname
    github、git、idea
    ubuntu环境变量在/etc/environment
    ubuntu的PPA
    VMware 增加硬盘ubuntu
    比特币概念
    cpu查询
  • 原文地址:https://www.cnblogs.com/wenrenhua08/p/3993662.html
Copyright © 2020-2023  润新知