.Net Interview Questions

By | April 28, 2014
  1. Explain the .NET architecture.
  2. How many languages .NET is supporting now? – When .NET was introduced it came with several languages. VB.NET, C#, COBOL and Perl, etc. The site DotNetLanguages.Net says 44 languages are supported.
  3. How is .NET able to support multiple languages? – a language should comply with the Common Language Runtime standard to become a .NET language. In .NET, code is compiled to Microsoft Intermediate Language (MSIL for short). This is called as Managed Code. This Managed code is run in .NET environment. So after compilation to this IL the language is not a barrier. A code can call or use a function written in another language.
  4. How ASP .NET different from ASP? – Scripting is separated from the HTML, Code is compiled as a DLL, these DLLs can be executed on the server.
  5. Resource Files: How to use the resource files, how to know which language to use?
  6. What is smart navigation? – The cursor position is maintained when the page gets refreshed due to the server side validation and the page gets refreshed.
  7. What is view state? – The web is stateless. But in ASP.NET, the state of a page is maintained in the in the page itself automatically. How? The values are encrypted and saved in hidden controls. this is done automatically by the ASP.NET. This can be switched off / on for a single control
  8. Explain the life cycle of an ASP .NET page.
  9. How do you validate the controls in an ASP .NET page? – Using special validation controls that are meant for this. We have Range Validator, Email Validator.
  10. Can the validation be done in the server side? Or this can be done only in the Client side? – Client side is done by default. Server side validation is also possible. We can switch off the client side and server side can be done.
  11. How to manage pagination in a page? – Using pagination option in DataGrid control. We have to set the number of records for a page, then it takes care of pagination by itself.
  12. What is ADO .NET and what is difference between ADO and ADO.NET? – ADO.NET is stateless mechanism. I can treat the ADO.Net as a separate in-memory database where in I can use relationships between the tables and select insert and updates to the database. I can update the actual database as a batch.

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

—————————————————————————————– What is purpose of Assembly Linker or define SDK Tool in .NET Framework? Answer: In .NET whole the working should be with the helps of DLLs.So all of Visual Studio .Net compilers gernate assemblies or u can say dll.If we want to create an assembly with manifest of a module.We can also put this assembly in seprate file.This AL tol gernate a file with an assembly manifest from modules or resources fles.The syntax of using Al.exe is al [sources] [options] This tool helps in creating multi-file assembly outside Visual Studio .Net .This multi file can contain modules that are written in diffrenet langauage in one application. Question: Can you have two files with the same file name in GAC? Answer: GAC is just a Folder that contains .dll that have strong name.We can say that GAC is a very special folder, and it is not possible two place two files with the same name into a Windows folder,But GAC differentiates by version number as well, so it’s possible for MyApp.dll and MyApp.dll to co-exist in GAC if the first one is version and the second one is Question: In Assembly which work as GacBrowser ? Answer: The GACPicker class allows the user to select an assembly from the Global Assembly Cache. It does this by looking at the filesystem representation of the GAC, since there appears to be no actual API in the current .NET environment. Question: What do u mean by Satellite Assemblies ? Answer: The assemblies which contains only culture information are known as satellite assemblies.This assembly is used to get language specific resources for an application . Question: What’s the difference between private and shared assembly? Answer: Privateassembly is used inside an application only and does not have to be identified by a strong name. Shared assembly can be used by multiple applications and has to have a strong name. Question: What do you know about .NET assemblies? Answer: Assemblies are the smallest units of versioning and deployment in the .NET application. Assemblies are also the building blocks for programs such as Web services, Windows services, serviced components, and .NET remoting applications. Questions:-What is Version Number and Culture in Assembly Manifest ? Answer:- Version number:- A major and minor version number, and a revision and build number. The common language runtime uses these numbers to enforce version policy.Means we can say it’s a primary key. Culture:- This relates to Satellite assembly. This information should be used only to Pick an assembly as a satellite assembly containing culture- or language-specific information. (We can also that assembly with culture information is automatically assumed to be a satellite assembly.)Questions:-What do you know about BCL? Answer:- The BCL (Base Class Library) is a combination of classes or we can say that it’s a library of functionalities and types available to all languages that used in .NET Framework. To make the programmer job more easier dot net gave a advantage to includes the BCL in order to collect a large number of common functions, just like to read a file and write to file, graphic rendering, database interaction, and XML document manipulation at one place . The scope of this is large and standard libraries for most other languages, including C++, and would be comparable in scope to the standard libraries is just like Java. The BCL is sometimes incorrectly referred to as the Framework Class Library (FCL), which is a superset including the Microsoft namespaces. Question: What’s a strong name ? Answer: A strong name includes the name of the assembly, version number, culture identity, and a public key token. Question: Whats an assembly ? Answer: Assemblies are the building blocks of .NET Framework applications; they form the fundamental unit of deployment, version control, reuse, activation scoping, and security permissions. An assembly is a collection of types and resources that are built to work together and form a logical unit of functionality. An assembly provides the common language runtime with the information it needs to be aware of type implementations. To the runtime, a type does not exist outside the context of an assembly. Question: How can you debug failed assembly binds ? Answer: Use the Assembly Binding Log Viewer (fuslogvw.exe) to find out the paths searched. Question: Where are shared assemblies stored ? Answer: Global assembly cache. Question: How can you tell the application to look for assemblies at the locations other than its own install ? Answer: Use the directive in the XML .config file for a given application. <probing privatePath=”c:\mylibs; bin\debug” /> should do the trick. Or you can add additional search paths in the Properties box of the deployed application.

Question: Where’s global assembly cache located on the system ? Answer: Usually C:\winnt\assembly or C:\windows\assembly.

Question: How do you specify a custom attribute for the entire assembly (rather than for a class) ? Answer: Global attributes must appear after any top-level using clauses and before the first type or namespace declarations. An example of this is as follows: using System; [assembly : MyAttributeClass] class X {} Note that in an IDE-created project, by convention, these attributes are placed in AssemblyInfo.cs.

Question: What is delay signing ? Answer:Delay signing allows you to place a shared assembly in the GAC by signing the assembly with just the public key. This allows the assembly to be signed with the private key at a later stage, when the development process is complete and the component or assembly is ready to be deployed. This process enables developers to work with shared assemblies as if they were strongly named, and it secures the private key of the signature from being accessed at different stages of development. —————————————————————————————–

  • What is the difference between System.Int32 type and int type? I receive “interesting” answers like: System.Int32 is reference type while int is a value type, or System.Int32 is presented in 4 bytes while int only needs 2 bytes. The correct answer is that there is no difference between them, they are alias.
  • What is the purpose of the method GetHashCode() in System.Object class? Some candidates just cannot even guess what this method do. I’m not sure how they can properly use dictionary types without even knowing what the purpose of this method is.
  • Can you assign null value to a struct? Some confirm that they can (after I ask a few more questions to make sure that they are not referring to nullable types).
  • How does the modifier readonly affect reference types? A few say that you cannot modify the fields of the readonly instance. In fact, the only effect is that you cannot change the address inside that reference (i.e. assign it to another object).
  • Is this code valid public const object KEY = new object()? Many, especially those with the Java background, say they do not see any problem with it. In fact, that code does not compile since, unlike readonly, expressions assigned to “const” fields must be evaluatable at compile time.
  • Do you need to have a catch block whenever you use the try block? Some people just forget about the try...finally... pattern. As a side note, I’ve seen a developer who used the catch block just to re-throw the caught exception in order to use the finally block (since the poor guy thought that he could not use finally without having the catch block).
  • How can you make a class serializable (for .NET Remoting)? Some thinks classes are made serializable by default. Of course they are not, you need to either annotate the class with the Serializable attribute or implement the ISerializable interface.
  • What is the accessibility level of internal protected fields and methods? Some say these fields and methods can only be access by subclasses within the same assembly. Some others even tell me they do not think it is possible to combine these two modifiers. The right answer is these fields and methods can be accessed either by subclasses (in any assembly) or classes within the same assembly (or “friend” assembly).

Leave a Reply