In this article, I am going to discuss the most frequently asked Basic C# Interview Questions and Answers.
1. What is COM?
2. What are the disadvantages of COM?
The major two disadvantages of COM is
4. What is a Framework and what does the .NET Framework provide?
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
BCL contains predefined classes and these classes are used for the purpose of application development.
5. 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.
In .NET, the code is compiled twice.
What is JIT?
The .net framework is available in three different types
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?
.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
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
VB.NET, C#.NET: VB.NET and C#.NET both are programming languages. Using these two programming languages we can develop windows applications.
ASP.NET:
Visual Studio is a Microsoft IDE tool which is needed to develop applications with the .NET framework. The IDE integrates 3 features
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.
12. What is metadata?
Metadata describes every type and member defined in our code in a Multilanguage form. Metadata stores the following information.
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.
14. What are the differences between managed code and unmanaged code?
Managed code/methods:
C# is an object-oriented type safe and managed language that is compiled by.Net framework to generate Microsoft Intermediate Language.
16. 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
17. What’s the difference between IEnumerable<T> and List<T>?
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
19. 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. What is COM?
- COM stands for Component Object Model.
- COM is one of Microsoft Technology. Using this technology we can develop windows applications as well as web applications.
2. What are the disadvantages of COM?
The major two disadvantages of COM is
- Incomplete object-oriented programming means it will not support all the features of OOPs.
- Platform dependent means COM applications can run on only Windows OS.
- NET stands for Network Enabled Technology.
- In .NET dot (.) refers to object-oriented and NET refers to the internet.
4. What is a Framework and what does the .NET Framework provide?
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
- BCL (Base Class Libraries)
- CLR (Common Language Runtime)
- Base Class Libraries are designed by Microsoft.
- Without BCL we can’t write any code in .NET so BCL also was known as Building block of Programs of .NET.
- These are installed into the machine when we installed the .NET framework into the machine.
BCL contains predefined classes and these classes are used for the purpose of application development.
5. 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.
In .NET, the code is compiled twice.
- 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.
- In the 2nd compilation, MSIL is converted into Native code using CLR.
What is JIT?
- JIT stands for Just-in-time.
- JIT is the component of CLR which is responsible for converting MSIL code into Native code.
- This Native code is directly understandable by the operating system.
The .net framework is available in three different types
- .NET Framework: This is the general version required to run .NET applications on Windows OS only.
- .NET mono Framework: This is required if we want to run .NET applications on other OS like Unix, Linux, MAC OS, etc.
- .NET Compact Framework: This is required to run .NET applications on other devices like mobile phones and smartphones.
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?
- .NET is not an Operating system.
- It is not an application or package.
- .NET is not a database.
- It is not an ERP application.
- .NET is not a Testing Tool.
- It is not a programming language.
.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
- VB.NET
- C#.NET
- VC++.NET
- J#.NET
- F#.NET
- Jscript.NE
- WindowsPowerShell
- Iron phyton
- Iron Ruby
- ASP.NET (Active Server Pages.NET)
- ADO.NET (Active Data Object.NET)
- WCF (Windows Communication Foundation)
- WPF (Windows Presentation Foundation)
- WWF (Windows Workflow Foundation)
- AJAX (Asynchronous JavaScript and XML)
- LINQ (Language Integrated Query)
- ASP.NET MVC (Model View Controller)
- ASP.NET WEB API
- A language acts as the mediator between the programmer and the system.
- It offers some rules and regulations for writing the program.
- The language also offers some libraries which are required for writing the program.
- The collection of programs is called software.
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
VB.NET, C#.NET: VB.NET and C#.NET both are programming languages. Using these two programming languages we can develop windows applications.
ASP.NET:
- ASP.NET is a part of a Framework.
- The ASP.NET is a technology which provides a set of predefined classes. Using these classes we can implement web applications.
- ASP.NET is needed language support.
- ADO stands for ActiveX Data Objects.
- The ADO.NET is a .NET database technology.
- ADO.NET provides a set of predefined classes. Using these predefined classes we can perform the operations with the database server.
- WCF stands for Windows Communication Foundation.
- The WCF is a distributed technology. Using this technology we can implement SOA (Service Oriented Architecture) programming.
- SOA programming provides communication between heterogeneous applications.
- Applications that are developed using different technologies or different programming languages are known as heterogeneous applications.
- The WPF stands for windows presentation foundation.
- WPF is a .NET technology using this technology we can create 2D, 3D, graphics, animations for windows application.
- Using this technology we can also create our own audio/video players and also implement gaming applications.
- LINQ stands for Language Integrated Query.
- It is query-writing Technology.
- LINQ offers to write queries in the programming code itself.
- This concept is introduced in .NET framework 3.5
- LINQ queries applying in database data and non-database data also.
Visual Studio is a Microsoft IDE tool which is needed to develop applications with the .NET framework. The IDE integrates 3 features
- Editor
- Compiler
- Interpreter
- .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.
- 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).
- CLR is the foundation of the .NET framework which provides services like safety, memory management, garbage collection, and exception handling.
- 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.
- 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.
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.
12. What is metadata?
Metadata describes every type and member defined in our code in a Multilanguage form. Metadata stores the following information.
- Description of assembly.
- Identity (name, version, culture, public key).
- The types that are exported
- Other assemblies that this assembly depends on.
- Security permissions needed to run.
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.
14. What are the differences between managed code and unmanaged code?
Managed code/methods:
- Machine instructions are in MSIL format and located in assemblies will be executed by the CLR will have the following advantages
- Memory management to prevent memory leaks in program code.
- Thread execution
- Code safety verification
- Compilation.
- The Unmanaged codes are the instructions which are targeted for specific platforms. Unmanaged code will exist in any of the formats.
- COM/COM+ components
- Win 32 Dlls/system DLLs
- As these codes are in native formats of OS, these instructions will be executed faster compared with JIT compilation and execution of managed code.
C# is an object-oriented type safe and managed language that is compiled by.Net framework to generate Microsoft Intermediate Language.
16. 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
17. What’s the difference between IEnumerable<T> and List<T>?
- IEnumerable is an interface, whereas List is one specific implementation of IEnumerable. A list is a class.
- 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.
- IEnumerable doesn’t allow random access, whereas List does allow random access using the integral index.
- In general from a performance standpoint, iterating through IEnumerable is much faster than iterating thru a List.
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
19. 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
- Out variables
- Pattern matching
- Digit Separators
- Tuples
- Deconstruction (Splitting Tuples)
- Local functions
- Literal improvements
- Ref returns and locals
- Generalized async return types
- More expression-bodied members
- Throw expressions
- Discards
- Async main
- Default literal expressions
- Inferred tuple element names
0 comments:
Post a Comment
If you like this website, please share with your friends on Facebook, Twitter, LinkedIn.