Skip to content

πŸ”΄ .NET Core Interview Questions and Answered to prepare for your next .NET developer interview

Notifications You must be signed in to change notification settings

aershov24/net-core-interview-questions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 

Repository files navigation

.NET Core Interview Questions And Answers

The sun is setting on .NET Framework. From now on, .NET Core is king. New projects, be they web or desktop, should be started in .NET Core. Stay prepared for your next .NET Core Tech Interview with our list of top .NET Core interview questions and answers.

You could also find all the answers here πŸ‘‰ https://www.fullstack.cafe/.NET%20Core.

Q1: What is .NET Core? ⭐

Answer:

The .NET Core platform is a new .NET stack that is optimized for open source development and agile delivery on NuGet.

.NET Core has two major components. It includes a small runtime that is built from the same codebase as the .NET Framework CLR. The .NET Core runtime includes the same GC and JIT (RyuJIT), but doesn’t include features like Application Domains or Code Access Security. The runtime is delivered via NuGet, as part of the ASP.NET Core package.

.NET Core also includes the base class libraries. These libraries are largely the same code as the .NET Framework class libraries, but have been factored (removal of dependencies) to enable to ship a smaller set of libraries. These libraries are shipped as System.* NuGet packages on NuGet.org.

πŸ”— Source: stackoverflow.com

Q2: What is the difference between String and string in C#? ⭐

Answer:

string is an alias in C# for System.String. So technically, there is no difference. It's like int vs. System.Int32.

As far as guidelines, it's generally recommended to use string any time you're referring to an object.

string place = "world";

Likewise, it's generally recommended to use String if you need to refer specifically to the class.

string greet = String.Format("Hello {0}!", place);

πŸ”— Source: blogs.msdn.microsoft.com

Q3: What is the .NET Framework? ⭐

Answer:

The .NET is a Framework, which is a collection of classes of reusable libraries given by Microsoft to be used in other .NET applications and to develop, build and deploy many types of applications on the Windows platform including the following:

  • Console Applications
  • Windows Forms Applications
  • Windows Presentation Foundation (WPF) Applications
  • Web Applications
  • Web Services
  • Windows Services
  • Services-oriented applications using Windows Communications Foundation (WCF)
  • Workflow-enabled applications using Windows Workflow Foundation(WF)

πŸ”— Source: c-sharpcorner.com

Q4: What is .NET Standard? ⭐

Answer:

The .NET Standard is a formal specification of .NET APIs that are intended to be available on all .NET implementations.

πŸ”— Source: docs.microsoft.com

Q5: What is the difference between .NET Core and Mono? ⭐⭐

Answer:

To be simple:

  • Mono is third party implementation of .Net Framework for Linux/Android/iOs
  • .Net Core is Microsoft's own implementation for same.

πŸ”— Source: stackoverflow.com

Q6: What are some characteristics of .NET Core? ⭐⭐

Answer:

  • Flexible deployment: Can be included in your app or installed side-by-side user- or machine-wide.

  • Cross-platform: Runs on Windows, macOS and Linux; can be ported to other OSes. The supported Operating Systems (OS), CPUs and application scenarios will grow over time, provided by Microsoft, other companies, and individuals.

  • Command-line tools: All product scenarios can be exercised at the command-line.

  • Compatible: .NET Core is compatible with .NET Framework, Xamarin and Mono, via the .NET Standard Library.

  • Open source: The .NET Core platform is open source, using MIT and Apache 2 licenses. Documentation is licensed under CC-BY. .NET Core is a .NET Foundation project.

  • Supported by Microsoft: .NET Core is supported by Microsoft, per .NET Core Support

πŸ”— Source: stackoverflow.com

Q7: What's the difference between SDK and Runtime in .NET Core? ⭐⭐

Answer:

  • The SDK is all of the stuff that is needed/makes developing a .NET Core application easier, such as the CLI and a compiler.

  • The runtime is the "virtual machine" that hosts/runs the application and abstracts all the interaction with the base operating system.

πŸ”— Source: stackoverflow.com

Q8: What is the difference between decimal, float and double in .NET? ⭐⭐

Questions Details:

When would someone use one of these?

Answer:

Precision is the main difference.

  • Float - 7 digits (32 bit)
  • Double-15-16 digits (64 bit)
  • Decimal -28-29 significant digits (128 bit)

As for what to use when:

  • For values which are "naturally exact decimals" it's good to use decimal. This is usually suitable for any concepts invented by humans: financial values are the most obvious example, but there are others too. Consider the score given to divers or ice skaters, for example.

  • For values which are more artefacts of nature which can't really be measured exactly anyway, float/double are more appropriate. For example, scientific data would usually be represented in this form. Here, the original values won't be "decimally accurate" to start with, so it's not important for the expected results to maintain the "decimal accuracy". Floating binary point types are much faster to work with than decimals.

πŸ”— Source: blogs.msdn.microsoft.com

Q9: What is an unmanaged resource? ⭐⭐

Answer:

Use that rule of thumb:

  • If you found it in the Microsoft .NET Framework: it's managed.
  • If you went poking around MSDN yourself, it's unmanaged.

Anything you've used P/Invoke calls to get outside of the nice comfy world of everything available to you in the .NET Framwork is unmanaged – and you're now responsible for cleaning it up.

πŸ”— Source: stackoverflow.com

Q10: What is MSIL? ⭐⭐

Answer:

When we compile our .NET code then it is not directly converted to native/binary code; it is first converted into intermediate code known as MSIL code which is then interpreted by the CLR. MSIL is independent of hardware and the operating system. Cross language relationships are possible since MSIL is the same for all .NET languages. MSIL is further converted into native code.

πŸ”— Source: c-sharpcorner.com

Q11: What is a .NET application domain? ⭐⭐

Answer:

It is an isolation layer provided by the .NET runtime. As such, App domains live with in a process (1 process can have many app domains) and have their own virtual address space.

App domains are useful because:

  • They are less expensive than full processes
  • They are multithreaded
  • You can stop one without killing everything in the process
  • Segregation of resources/config/etc
  • Each app domain runs on its own security level

πŸ”— Source: stackoverflow.com

Q12: Name some CLR services? ⭐⭐

Answer:

CLR services

  • Assembly Resolver
  • Assembly Loader
  • Type Checker
  • COM marshalled
  • Debug Manager
  • Thread Support
  • IL to Native compiler
  • Exception Manager
  • Garbage Collector

πŸ”— Source: c-sharpcorner.com

Q13: What is CLR? ⭐⭐

Answer:

The CLR stands for Common Language Runtime and it is an Execution Environment. It works as a layer between Operating Systems and the applications written in .NET languages that conforms to the Common Language Specification (CLS). The main function of Common Language Runtime (CLR) is to convert the Managed Code into native code and then execute the program.

πŸ”— Source: c-sharpcorner.com

Q14: What is CTS? ⭐⭐

Answer:

The Common Type System (CTS) standardizes the data types of all programming languages using .NET under the umbrella of .NET to a common data type for easy and smooth communication among these .NET languages.

CTS is designed as a singly rooted object hierarchy with System.Object as the base type from which all other types are derived. CTS supports two different kinds of types:

  1. Value Types: Contain the values that need to be stored directly on the stack or allocated inline in a structure. They can be built-in (standard primitive types), user-defined (defined in source code) or enumerations (sets of enumerated values that are represented by labels but stored as a numeric type).
  2. Reference Types: Store a reference to the valueβ€˜s memory address and are allocated on the heap. Reference types can be any of the pointer types, interface types or self-describing types (arrays and class types such as user-defined classes, boxed value types and delegates).

πŸ”— Source: c-sharpcorner.com

Q15: What is .NET Standard and why we need to consider it? ⭐⭐

Answer:

  1. .NET Standard solves the code sharing problem for .NET developers across all platforms by bringing all the APIs that you expect and love across the environments that you need: desktop applications, mobile apps & games, and cloud services:
  2. .NET Standard is a set of APIs that all .NET platforms have to implement. This unifies the .NET platforms and prevents future fragmentation.
  3. .NET Standard 2.0 will be implemented by .NET Framework, .NET Core, and Xamarin. For .NET Core, this will add many of the existing APIs that have been requested.
  4. .NET Standard 2.0 includes a compatibility shim for .NET Framework binaries, significantly increasing the set of libraries that you can reference from your .NET Standard libraries.
  5. .NET Standard will replace Portable Class Libraries (PCLs) as the tooling story for building multi-platform .NET libraries.

πŸ”— Source: stackoverflow.com

Q16: What is Kestrel? ⭐⭐⭐

See πŸ‘‰ Answer

Q17: Talk about new .csproj file? ⭐⭐⭐

See πŸ‘‰ Answer

Q18: What about NuGet packages and packages.config? ⭐⭐⭐

See πŸ‘‰ Answer

Q19: What is difference between .NET Core and .NET Framework? ⭐⭐⭐

See πŸ‘‰ Answer

Q20: Explain what is included in .NET Core? ⭐⭐⭐

See πŸ‘‰ Answer

Q21: What is .NET Standard? ⭐⭐⭐

See πŸ‘‰ Answer

Q22: What's the difference between .NET Core, .NET Framework, and Xamarin? ⭐⭐⭐

See πŸ‘‰ Answer

Q23: Explain two types of deployment for .NET Core applications ⭐⭐⭐

See πŸ‘‰ Answer

Q24: What is CoreCLR? ⭐⭐⭐

See πŸ‘‰ Answer

Q25: Is there a way to catch multiple exceptions at once and without code duplication? ⭐⭐⭐

Questions Details:

Consider:

try
{
    WebId = new Guid(queryString["web"]);
}
catch (FormatException)
{
    WebId = Guid.Empty;
}
catch (OverflowException)
{
    WebId = Guid.Empty;
}

Is there a way to catch both exceptions and only call the WebId = Guid.Empty call once?

See πŸ‘‰ Answer

Q26: Why to use of the IDisposable interface? ⭐⭐⭐

See πŸ‘‰ Answer

Q27: Explain the difference between Task and Thread in .NET ⭐⭐⭐

See πŸ‘‰ Answer

Q28: What is FCL? ⭐⭐⭐

See πŸ‘‰ Answer

Q29: What's is BCL? ⭐⭐⭐

See πŸ‘‰ Answer

Q30: What is implicit compilation? ⭐⭐⭐

See πŸ‘‰ Answer

Q31: What is JIT compiler? ⭐⭐⭐

See πŸ‘‰ Answer

Q32: What is Explicit Compilation? ⭐⭐⭐

See πŸ‘‰ Answer

Q33: What are the benefits of explicit compilation? ⭐⭐⭐

See πŸ‘‰ Answer

Q34: What does Common Language Specification (CLS) mean? ⭐⭐⭐

See πŸ‘‰ Answer

Q35: Explain the difference between β€œmanaged” and β€œunmanaged” code? ⭐⭐⭐

See πŸ‘‰ Answer

Q36: What is the difference between .NET Standard and PCL (Portable Class Libraries)? ⭐⭐⭐

See πŸ‘‰ Answer

Q37: What is the difference between Class Library (.NET Standard) and Class Library (.NET Core)? ⭐⭐⭐

See πŸ‘‰ Answer

Q38: When should we use .NET Core and .NET Standard Class Library project types? ⭐⭐⭐

See πŸ‘‰ Answer

Q39: What is the difference between .NET Framework/Core and .NET Standard Class Library project types? ⭐⭐⭐⭐

See πŸ‘‰ Answer

Q40: What's the difference between RyuJIT and Roslyn? ⭐⭐⭐⭐

See πŸ‘‰ Answer

Q41: Explain how does Asynchronous tasks (Async/Await) work in .NET? ⭐⭐⭐⭐

Questions Details:

Consider:

private async Task<bool> TestFunction()
{
  var x = await DoesSomethingExists();
  var y = await DoesSomethingElseExists();
  return y;
}

Does the second await statement get executed right away or after the first await returns?

See πŸ‘‰ Answer

Q42: What are benefits of using JIT? ⭐⭐⭐⭐

See πŸ‘‰ Answer

Q43: Why does .NET use a JIT compiler instead of just compiling the code once on the target machine? ⭐⭐⭐⭐

See πŸ‘‰ Answer

Q44: What is the difference between CIL and MSIL (IL)? ⭐⭐⭐⭐

See πŸ‘‰ Answer

Q45: What is the difference between AppDomain, Assembly, Process, and a Thread? ⭐⭐⭐⭐

See πŸ‘‰ Answer

Q46: Why does .NET Standard library exist? ⭐⭐⭐⭐

See πŸ‘‰ Answer

Q47: How to choose the target version of .NET Standard library? ⭐⭐⭐⭐

See πŸ‘‰ Answer

Q48: Explain Finalize vs Dispose usage? ⭐⭐⭐⭐⭐

See πŸ‘‰ Answer

Q49: What is the difference between Node.js async model and async/await in .NET? ⭐⭐⭐⭐⭐

See πŸ‘‰ Answer

Q50: How many types of JIT Compilations do you know? ⭐⭐⭐⭐⭐

See πŸ‘‰ Answer

Q51: Could you name the difference between .Net Core, Portable, Standard, Compact, UWP, and PCL? ⭐⭐⭐⭐⭐

See πŸ‘‰ Answer

Releases

No releases published

Packages

No packages published