Engineering, Design, Marketing, and More

.NET interview questions

The most popular questions

Use our complementary questions and answers to filter and hire the best. Questions crowdsourced by our clients, answers by Punch. We provide these complementary questions to help our clients more quickly create tests for potential hires at their organizations.

Get a question answered
Punch offers four divisions of services: design, engineering, staffing, and demand

Interview questions for your next interview

Question
How is .NET able to support multiple languages?
Answer
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). This is called as Managed Code. This Managed code is run in .NET enviroment. So after compilation to this IL the language is not a barrier. A code can be call or use a function written in another language.
Question
What are Attributes?
Answer
Attributes are declared tags in code that insert additional metadata into an assembly. There exist two types of attributes in the .NET Framework. Predefined attributes such as AssemblyVersion, which already exist and are accessed through the Runtime Classes; and custom attributes, which you write yourself by extending the System.Attribute class.

Find developers today

Hire a Punch engineer

Punch offers four divisions of services: design, engineering, staffing, and demand. Our four divisions form the core of our People Forward Approach.

Contact us
Find developers today
Question
Explain what relationship is between a Process, Application Domain and Application?
Answer
Each process is allocated its own block of available RAM space. No process can access another process' code or data. If the process crashes, it dies alone without taking the entire OS or a bunch of other applications down.

A process is an instance of a running application. An application is an executable on the hard drive or network. There can be numerous processes launched of same application, but one process can run just one application.
Question
What is a formatter?
Answer
A formatter is an object that is responsible for encoding and serializing data into messages on one end, and deserializing and decoding messages into data on the other end.
Question
What is deligation?
Answer
A deligate acts like a strongly type function pointer. Delegates can invoke the methods that they reference without making explicit calls to those methods.

Delegate is an entity that is entrusted with the task of representation, assign or passing on infromation. In code sense, it means a Delegate is entrusted with a Method to report information back to it when a certain task (which the Method expects) is accomplished outside the Method's class.
Question
What is data type and how many types of data types are in .NET?
Answer
A data type is a data storage format that can contain a specific type or range of values. Whenever you declare vaiables, each variable must be assigned a specific data type. Some common data types include integers, floating point, characters and strings. The following are the two types of data types available in .NET:

Value type - Refers to the data type that contains the data. In other words, the exact value or the data is directly stored in this data type. Primitive data types, such as int, float and char are examples of value type variables.

Reference type - Refers to a data type that can access data by reference. Reference is a value or an address that accesses a particular data by address, which is stored elsewhere in memory (heap memory). Some built-in reference type variables in .NET are string, array and object.
Question
What is a CTS?
Answer
CTS defines all of the basic types that can be used in the .NET Framework and the operations performed on those types.
Question
What is Common Language Runtime?
Answer
Common Language Runtime (or CLR) is .NET equivalent of Java Virtual Machine (JVM). It's the runtime that converts a MSIL code into the host machine language code, which is then executed appropriately. The CLR is the execution engine for .NET Framework applications. It provides a number of services like:
  • Code management
  • Application memory isolation
  • Verification of type safety
  • Conversion of IL to native code
  • Access to metadata
  • Managing memory for managed objects
  • Enforcement of code access security
  • Exception handling
  • Support for developer services like profiling, debugging and so on.
Question
What is .NET assembly?
Answer
An assembly is a collection of one or more .exe or .dll. An assembly is the fundamental unit for applicarion development and deployment process in the .NET Framework. An assembly contains a collection of types and resources that are built to work together and form a logical unit of functionality. An assembly provides the CLR with the information it needs to be aware of type implementations.
Question
What is garbage collection?
Answer
Garbage collection is a CLR feature which automatically manages memory. CLR automatically releases objects when they are no longer is use and referenced. That's why you should not put code int a class destructor to release resources. CLR will do it for you.

Find developers today

Hire a Punch engineer

Punch offers four divisions of services: design, engineering, staffing, and demand. Our four divisions form the core of our People Forward Approach.

Contact us
Find developers today
Question
How to enforce garbage collection in .NET?
Answer
You can enforce garbage collection process by calling the System.GC.Collect() method. But most of the time, this should be avoided because it may create performance issues.
Question
What is concept of Boxing and Unboxing?
Answer
Boxing is used to convert value types to object. From other side, Unboxing is converting the object to the value type. This is quite expensive operation and should be used wisely.
Question
Can I use multiple inheritance in .NET?
Answer
.NET doesn't support multiple inheritance. However the purpose is accomplished using multiple iterfaces implementation.
Question
What are the steps to create an assembly and add it to the GAC?
Answer
The global assembly cache (GAC) is a machine-wide code cache that stores assemblies shared by several applications on the computer. You should share assemblies in GAC only when you need it. Here you are the steps:
  • Create a strong name using sn.exe tool (sn -k mykey.snk)
  • Add the strong name in AssemblyInfo.cs: [Assembly: AssemblyKeyFile("mykey.snk")]
  • Rebuild project and then install it to GAC by drag and drop it to assembly folder (C:\Windows\assembly or C:\WINNT\assembly) and then execute "gacutil -i assembly.dll" in command line
Question
What is difference between System.String and System.StringBuilder classes?
Answer
Both classes are used to store string values. However System.String is immutable (read only) by nature means once value is assigned to String object it cannot be changed. When the value is changed, a new object is created in memory and then a new value is assigned.

On other hand, System.StringBuilder class is mutable and can be used when it's required to make a large amount of string manipulations.
Question
What is ViewState?
Answer
ViewState is used to retain the state of server-side objects between page postbacks.
Question
Where is the ViewState stored after the page postback?
Answer
ViewState is stored in a hidden field on the page at client side. ViewState is transported to the client and back to the server, and is not stored on the server or any otherexternal source.
Question
Can code files of different languages be added to App_Code folder?
Answer
No. The code files must be in same language to be kept in App_code folder.

Find developers today

Hire a Punch engineer

Punch offers four divisions of services: design, engineering, staffing, and demand. Our four divisions form the core of our People Forward Approach.

Contact us
Find developers today
Question
What is RedirectPermanent in ASP.Net?
Answer
RedirectPermanent performs a permanent redirection from the requested URL to the specified URL. Once the redirection is done, it also returns 301 Moved Permanentlyresponses.
Question
What are the advantages of Passport authentication?
Answer
All websites can be accessed using single login credentials. So, no need to remember login credentials for each web site.
Question
List the major built-in objects in ASP.NET?
Answer
  • Application
  • Request
  • Response
  • Server
  • Session
  • Context
  • Trace
Question
What are the different validators in ASP.NET?
Answer
  1. Required field Validator
  2. Required field Validator
  3. Compare Validator
  4. Custom Validator
  5. Regular expression Validator
  6. Summary Validator
Question
Which data type does the RangeValidator control support?
Answer
The data types supported by the RangeValidator control are Integer, Double, String,Currency, and Date.
Question
In which event are the controls fully loaded?
Answer
Page load event guarantees that all controls are fully loaded. Controls are also accessedin Page_Init events but you will see that view state is not fully loaded during this event.
Question
What are the different types of authentication?
Answer
  • Windows Authentication
  • Forms Authentication
  • Passport Authentication
Question
What are the Web Form Events available in ASP.NET?
Answer
  • Page_Init
  • Page_Load
  • Page_PreRender
  • Page_Unload
  • Page_Disposed
  • Page_Error
  • Page_AbortTransaction
  • Page_CommitTransaction
  • Page_DataBinding

Find developers today

Hire a Punch engineer

Punch offers four divisions of services: design, engineering, staffing, and demand. Our four divisions form the core of our People Forward Approach.

Contact us
Find developers today
Question
What are the navigation ways between pages available in ASP.NET?
Answer
Ways to navigate between pages are:
  1. Hyperlink control
  2. Response.Redirect method
  3. Server.Transfer method
  4. Server.Execute method
  5. Window.Open script method
Question
What is Satellite assembly?
Answer
Satellite assembly is a kind of assembly that includes localized resources for an application. Each satellite assembly contains the resources for one culture.
Question
List down the sequence of methods called during the page load?
Answer
  • Init() - Initializes the page.
  • Load() - Loads the page in the server memory.
  • PreRender() - the brief moment before the page is displayed to the user as HTML
  • Unload() - runs just after page finishes loading.
Question
What do you know about MSIL?
Answer
MSIL is the Microsoft Intermediate Language. All .Net languages' executable exists asMSIL which gets converted into machine specific language using JIT compiler just before execution.

Ask a question

Ask a question, and one of our engineers will answer it.

We keep our questions nice and simple to be useful for everyone, and we may not answer or publish every question.

Your number is stored privately and never shared.
By submitting a question, you agree to our terms.
Request sent. Thank you!
Send another one