C# Interview Questions and Answers

C# Interview Questions And Answers

In this article, I am going to discuss the most frequently asked Basic C# Interview Questions and Answers. This is the part 1 of C# interview questions article series and hence in this article, we are going to discuss frequently asked basic C# interview questions. As part of this article, we are going to discuss the following C# Interview Questions with Answers.

  1. What is COM?
  2. What are the disadvantages of COM?
  3. What .NET Represents?
  4. What is a Framework and what does the .NET Framework provide?
  5. Explain about CLR and its Execution Process.
  6. What is exactly .NET?
  7. What are the language and its need?
  8. What are Technology and its need?
  9. What is Visual Studio?
  10. Explain about BCL.
  11. What is the Just-In-Time (JIT) compilation?
  12. What is Metadata?
  13. What is an assembly?
  14. What are the differences between managed code and unmanaged code?
  15. What is C#?
  16. What is the difference between an EXE and a DLL?
  17. What’s the difference between IEnumerable<T> and List<T>?
  18. Why is class an abstract data type?
  19. What are the new features introduced in c# 7?
What is COM?
  1. COM stands for Component Object Model.
  2. COM is one of Microsoft Technology. Using this technology we can develop windows applications as well as web applications.

In earlier COM, VB is the programming language that is used to implement windows application and ASP is used to implement web applications.

What are the disadvantages of COM?

The major two disadvantages of COM is

  1. Incomplete object-oriented programming means it will not support all the features of OOPs.
  2. Platform dependent means COM applications can run on only Windows OS.
What .NET Represents?
  1. NET stands for Network Enabled Technology.
  2. In .NET dot (.) refers to object-oriented and NET refers to the internet.

So the complete .NET means through object-oriented we can implement internet applications.

What is a Framework?

A framework is a software. Or we can say that a framework is a collection of many small technologies integrated together to develop applications that can be executed anywhere.

What does the .NET Framework provide?

.NET Framework provides two things such as

  1. BCL (Base Class Libraries)
  2. CLR (Common Language Runtime)
Explain about BCL.
  1. Base Class Libraries are designed by Microsoft.
  2. Without BCL we can’t write any code in .NET so BCL also was known as Building block of Programs of .NET.
  3. These are installed into the machine when we installed the .NET framework into the machine.

The physical location of BCL is C:\Windows\assembly

BCL contains predefined classes and these classes are used for the purpose of application development.

Explain about CLR and its Execution process.

CLR is the core component under the .NET framework which is responsible for converting MSIL code into native code and then execution.

C# Interview Questions And Answers

In .NET, the code is compiled twice.

  1. In 1st compilation source code is compiled by respective language compiler and intermediate code is generated known as MSIL (Microsoft Intermediate Language) or IL (Intermediate language code) Or Managed code.
  2. In the 2nd compilation, MSIL is converted into Native code using CLR.

Always 1st compilation is slow and 2nd compilation is first.

What is JIT?
  1. JIT stands for Just-in-time.
  2. JIT is the component of CLR which is responsible for converting MSIL code into Native code.
  3. This Native code is directly understandable by the operating system.
Explain different types of .NET Framework.

The .net framework is available in three different types

  1. .NET Framework: This is the general version required to run .NET applications on Windows OS only.
  2. .NET mono Framework: This is required if we want to run .NET applications on other OS like Unix, Linux, MAC OS, etc.
  3. .NET Compact Framework: This is required to run .NET applications on other devices like mobile phones and smartphones.

Note: MSIL is only CPU dependent and will run only on Windows OS only using .NET Framework because .NET Framework is designed for Windows OS only.

There is another company known as “NOVEL” designed separate framework known as “MONO Framework”. Using this framework we can run MSIL on different OS Like Linux, UNIX, Mac, BSD, OSX, etc.

.NET is platform-dependent using the .NET framework but independent using the MONO framework.

What is not .NET?
  1. .NET is not an Operating system.
  2. It is not an application or package.
  3. .NET is not a database.
  4. It is not an ERP application.
  5. .NET is not a Testing Tool.
  6. It is not a programming language.
What is exactly .NET?

.NET is a framework tool that supports many programming languages and many technologies. It supports 60+ programming languages. In 60+ programming languages, 9 are designed by Microsoft and remaining are designed by Non-Microsoft.

Microsoft designed programming languages are as follows

  1. VB.NET
  2. C#.NET
  3. VC++.NET
  4. J#.NET
  5. F#.NET
  6. Jscript.NE
  7. WindowsPowerShell
  8. Iron phyton
  9. Iron Ruby

Technologies supported by the .NET framework are as follows

  1. ASP.NET (Active Server Pages.NET)
  2. ADO.NET (Active Data Object.NET)
  3. WCF (Windows Communication Foundation)
  4. WPF (Windows Presentation Foundation)
  5. WWF (Windows Workflow Foundation)
  6. AJAX (Asynchronous JavaScript and XML)
  7. LINQ (Language Integrated Query)
  8. ASP.NET MVC (Model View Controller)
What are the language and its need?
  1. A language acts as the mediator between the programmer and the system.
  2. It offers some rules and regulations for writing the program.
  3. The language also offers some libraries which are required for writing the program.
  4. The collection of programs is called software.
What are Technology and it’s needs?

Technology is designed for a particular purpose. For example development of web-related applications in .NET using a technology ASP.NET. But the technology does not offer any specific rules for writing the programs. That’s why technology can’t be implemented individually.

VB.NET, C#.NET both are programming languages. Using these two languages we can implement windows/desktop applications individually. Every language is having its own compiler

Basic C# Interview Questions and Answers


VB.NET and C#.NET both are programming languages. Using these two programming languages we can develop windows applications.

  1. ASP.NET is a part of a Framework.
  2. The ASP.NET is a technology which provides a set of predefined classes. Using these classes we can implement web applications.
  3. ASP.NET is needed language support.
  1. ADO stands for ActiveX Data Objects.
  2. The ADO.NET is a .NET database technology.
  3. ADO.NET provides a set of predefined classes. Using these predefined classes we can perform the operations with the database server.
  1. WCF stands for Windows Communication Foundation.
  2. The WCF is a distributed technology. Using this technology we can implement SOA (Service Oriented Architecture) programming.
  3. SOA programming provides communication between heterogeneous applications.
  4. Applications that are developed using different technologies or different programming languages are known as heterogeneous applications.
  1. The WPF stands for windows presentation foundation.
  2. WPF is a .NET technology using this technology we can create 2D, 3D, graphics, animations for windows application.
  3. Using this technology we can also create our own audio/video players and also implement gaming applications.
  1. LINQ stands for Language Integrated Query.
  2. It is query-writing Technology.
  3. LINQ offers to write queries in the programming code itself.
  4. This concept is introduced in .NET framework 3.5
  5. LINQ queries applying in database data and non-database data also.
What is Visual Studio?

Visual Studio is a Microsoft IDE tool which is needed to develop applications with the .NET framework. The IDE integrates 3 features

  1. Editor
  2. Compiler
  3. Interpreter
What is .net?
  1. .NET is a programming framework created by Microsoft that developers can use to create applications more easily. The framework provides libraries commonly used by developers. The .NET Base Class Libraries (BCL) servers that purpose.
  2. The .NET provides language interoperability across several programming languages. Programs are written for .NET Framework execute in a software environment called Common Language Runtime (CLR).
  3. CLR is the foundation of the .NET framework which provides services like safety, memory management, garbage collection, and exception handling.
  4. CLR manages the execution of code. The code that is managed by CLR is called managed code. Unmanaged code does not get managed by CLR. CLR’s interoperability helps to interact between managed and unmanaged code.
  5. Common Language Specification (CLS) and Common Type System (CTS) as part of CLR. CTS is responsible for interpreting data types into a common format. CLS provides the ability of code to interact with code that is written with a different programming language.
What is the Just-In-Time (JIT) compilation?

The MSIL is the language that all of the .NET languages compile down to. After they are in this intermediate language, a process called Just-In-Time compilation occurs when resources are used from our application at runtime.

What is metadata?

Metadata describes every type and member defined in our code in a Multilanguage form. Metadata stores the following information.

  1. Description of assembly.
  2. Identity (name, version, culture, public key).
  3. The types that are exported
  4. Other assemblies that this assembly depends on.
  5. Security permissions needed to run.
What is an assembly?

Assemblies are the building block of .NET framework applications; they form the fundamental unit of deployment, version control, reuse, and activation scoping and security permissions.

What are the differences between managed code and unmanaged code?

Managed code/methods:

  1. Machine instructions are in MSIL format and located in assemblies will be executed by the CLR will have the following advantages
  2. Memory management to prevent memory leaks in program code.
  3. Thread execution
  4. Code safety verification
  5. Compilation.

Unmanaged code/ methods:

  1. The Unmanaged codes are the instructions which are targeted for specific platforms. Unmanaged code will exist in any of the formats. 
  2. COM/COM+ components
  3. Win 32 Dlls/system DLLs
  4. As these codes are in native formats of OS, these instructions will be executed faster compared with JIT compilation and execution of managed code.
What is C#?

C# is an object-oriented type safe and managed language that is compiled by.Net framework to generate Microsoft Intermediate Language.

What is the difference between an EXE and a DLL?

EXE is an executable file and can run by itself as an application whereas DLL is usually consumed by an EXE or by another DLL and we cannot run or execute DLL directly.

For example in .NET compiling a Console Application or a Windows Application generates EXE, whereas compiling a Class Library Project or an ASP.NET web application generates DLL. In the .NET framework, both EXE and DLL are called assemblies.

A DLL can be reused in the application whereas an exe file can never be reused in an application.

EXE stands for executable, and DLL stands for Dynamic Link Library

What’s the difference between IEnumerable<T> and List<T>?
  1. IEnumerable is an interface, whereas List is one specific implementation of IEnumerable. A list is a class.
  2. FOR-EACH loop is the only possible way to iterate through a collection of IEnumerable whereas List can be iterated using several ways. The list can also be indexed by an int index, the element can be added to and removed from and have items inserted at a particular index.
  3. IEnumerable doesn’t allow random access, whereas List does allow random access using the integral index.
  4. In general from a performance standpoint, iterating through IEnumerable is much faster than iterating thru a List
Why is class an abstract data type?

A Class is an Abstract Data Type because it specifies what data members and member functions (methods) contain in it (class), but won’t provide information on how those are implemented. That makes Class Abstract and Class is User Defined DataType. So, it’s an Abstract Data Type

What are the new features introduced in c# 7?

This is a very commonly asked c# interview question. This question is basically asked to check if you are passionate about catching up with the latest technological advancements. The list below shows the new features that are introduced in c# 7.

Let’s have a look at the new features that are introduced as part of C# 7

  1. Out variables
  2. Pattern matching
  3. Digit Separators
  4. Tuples
  5. Deconstruction (Splitting Tuples)
  6. Local functions
  7. Literal improvements
  8. Ref returns and locals
  9. Generalized async return types
  10. More expression-bodied members
  11. Throw expressions
  12. Discards
  13. Async main
  14. Default literal expressions
  15. Inferred tuple element names

In the next article, I am going to discuss Interface and Inheritance related interview questions and answers in C#. Here, in this article, I try to explain most frequently asked Basic C# Interview Questions and Answers. I hope you enjoy this Basic C# Interview Questions and Answers article. 

Leave a Reply

Your email address will not be published. Required fields are marked *