转载: .net程序员高级面试题

转载自: http://sendhil.spaces.live.com/blog/cns!30862CF919BD131A!583.entry?wa=wsignin1.0&sa=534101846

 

 

Answers to Senior Developers/Architects
  1. What’s wrong with a line like this? DateTime.Parse(myString);

    Parse converts date at any cost. What if user passes date in format MM/dd/yyyy whereas you are expecting in dd/MM/yyyy.Assume the user is passing 12/09/2006 meaning Dec 12, 2006, whereas Parse (based on the current locale) picked it up as Sep 12, 2006. The result is not something which you would like. Also Parse takes more time compared to other as it has to check for a gazillion formats. Instead if you know the format its better to go with ParseExact. Then why the hell do we have Parse? May be for the old VB customers it was an easier transition. Chec out more here or here
  2. What are PDBs? Where must they be located for debugging to work?

    A Program DataBase file (extension .pdb) is a binary file that contains type and symbolic debugging information gathered over the course of compiling and linking the project. A PDB file is created when you compile a C/C++ program with /ZI or /Zi or a Visual Basic, Visual C#, or JScript program with the /debug option. The Visual Studio debugger uses the path to the PDB in the EXE or DLL file to find the project.pdb file. If the debugger cannot find the PDB file at that location, or if the path is invalid, for example, if the project was moved to another computer, the debugger searches the path containing the EXE followed by the symbol paths specified in the Options dialog box (Solution Properties-->Debug Symbol Files node in VS.NET 2003). The debugger will not load a PDB that does not match the binary being debugged.
  3. What is cyclomatic complexity and why is it important?

    This calls for a separate entry in itself. http://sendhil.spaces.live.com/blog/cns!30862CF919BD131A!581.entry
  4. Write a standard lock() plus “double check” to create a critical section around a variable access.

    This calls for a separate entry in itself. http://sendhil.spaces.live.com/blog/cns!30862CF919BD131A!582.entry
  5. What is FullTrust? Do GAC’ed assemblies have FullTrust?

    Full Trust Permission Set Grants unrestricted permissions to system resources. My_Computer_Zone code group by default has has FullTrust permission. This can be changed using CASPOL.exe though.
  6. What benefit does your code receive if you decorate it with attributes demanding specific Security permissions?

    Allows administrators to see exactly which permissions your application needs to run, using PermView
    Prevents your code from being exploited beyond what permissions it absolutely needs
    Allows your application to forcibly fail instead of having to manually handle situations where it might be denied permissions it requires.
    More info can be found here / here
  7. What does this do? gacutil /l | find /i "Corillian"

    gacutil /l lists the assemblies in GAC. Find /i lists all the assemblies which have Corillian in their identity. (/i ignores case I suppose).
  8. What does this do? sn -t foo.dll

    Extracts the publick key token from the strongly named assembly foo.dll
  9. What ports must be open for DCOM over a firewall? What is the purpose of Port 135?

    135 is used by Windows RPC. HKEY_LOCAL_MACHINE\Software\Microsoft\Rpc\Internet (Key) Ports (Multi Line String Value) specifies what other ports will be open.
  10. Contrast OOP and SOA. What are tenets of each?

    OOP Tenets - Abstraction, Encapsulation, Inhertiance, Polymorphism. SOA Tenats - (PEACE) - Policy based negotiation, Explicitness of boundaries, Autonomy, Contract Exchange Differences: Read this nice analogy. This is as best as it can get http://blogs.msdn.com/smguest/archive/2004/01/29/64871.aspx
  11. How does the XmlSerializer work? What ACL permissions does a process using it require?

    The XmlSerializer creates a temporary assembly with two types named XmlSerializationReader1, XmlSerializationWriter1 which derive from XmlSerializationReader and XmlSerializationWriter classes. These types are responsible for DeSerializing and Serializing respectively. The XMlSerializer constructors caches the assemblies emitted if you use one of these constructors
    System.Xml.Serialization.XmlSerializer(Type) 
    System.Xml.Serialization.XmlSerializer(Type,String)
    Its recommended to use these. So the account under which host process is running must have Write, Delete permissions on the temporary directory. This the user profile temp directory for windows applications and the app specific folder under Temporary ASP.NET Files (in the framework directory) for ASP.NET applications
  12. Why is catch(Exception) almost always a bad idea?

    When you catch an exception, you’re stating that you expected this exception, you understand why it occurred, and you know how to deal with it. In other words, you’re defining a policy for the application. However, you shouldn’t catch Exception because a StackOverflowException or OutOfMemoryException exception could be thrown at any time. Hiding these fatal problems and allowing the application to continue running will cause unpredictable results.
  13. What is the difference between Debug.Write and Trace.Write? When should each be used? Debug.Write is compiled into a release build. Trace.Write gets compiled irrespective of the build configuration chosen. Trace is useful for production debugging (can be turned on off based on config at various levels / severity). Debug is useful for development environment debugging.
  14. What is the difference between a Debug and Release build? Is there a significant speed difference? Why or why not?

    • A debug build generates a file containing debug symbols (.pdb); a release build does not.
    • A debug build generates extra instructions to accomodate the debugger (e.g. NOP instructions to assist your setting breakpoints); a release build does not include these.
    • A release build uses full optimizations when compiling which might include rearranging your code or inlining it for efficiency, a debug build doesn't do this.
    • A debug build allocates extra memory on the heap for objects to facilitate detecting memory overwrite errors; a release build doesn't do this.
    • A release build will thus be smaller, faster, and more efficient than a debug build.
    More Info
    http://p2p.wrox.com/topic.asp?TOPIC_ID=16066
    http://www.hanselman.com/blog/PermaLink.aspx?guid=a40c0d4f


转载于:https://www.cnblogs.com/laynelin/archive/2010/01/02/1637710.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值