This section includes 7 InterviewSolutions, each offering curated multiple-choice questions to sharpen your Current Affairs knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
Write a program to calculate the addition of two numbers. |
|
Answer» The steps are as follows: 1. You need to create a new ASP.NET Core Project “CalculateSum”. Open Visual Studio 2015, GOTO File–> New–> Project. SELECT the option Web in Left Pane and go for the option ASP.NET Core Web Application (.NET Core) under the central pane. Edit the project name as “CalculateSum” and click on OK. 2. In the TEMPLATE window, select Web Application and set the Authentication into “No Authentication” and click on OK. 3. Open “Solution Explorer” and right-click on the folder “Home” (It is Under Views), then click on Add New Item. You need to select MVC View Page Template under ASP.NET Section and rename it as “addition.cshtml” and then click on the Add button. 4. Open addition.cshtml and write the following code: @{ ViewBag.Title = "Addition Page";}<h1>Welcome to Addition Page</h1><form asp-controller="Home" asp-action="add" method="post"> <span>Enter First Number : </span> <input id="TEXT1" type="text" name="txtFirstNum" /> <br /><br /> <span>Enter Second Number : </span> <input id="Text2" type="text" name="txtSecondNum" /> <br /><br /> <input id="Submit1" type="submit" value="Add" /></form><h2>@ViewBag.Result</h2>Here, we have created a simple form that is having two text boxes and a single Add Button. The text boxes are named as txtFirstNum and txtSecondNum. On the controller page, we can access these textboxes using: This form will indicate all the submissions will be moved to HomeController and the method add action will be executed. 5. Open the HomeController.cs and write the following code onto it: using System;using Microsoft.AspNetCore.Mvc;namespace CalculateSum.Controllers{ public class HomeController : Controller { public IActionResult Index() { return View(); } public IActionResult About() { ViewData["Message"] = "Application description page."; return View(); } public IActionResult Contact() { ViewData["Message"] = "Contact page."; return View(); } public IActionResult Error() { return View(); } public IActionResult addition() { return View(); } [HttpPost] public IActionResult add() { int number1 = Convert.ToInt32(HttpContext.Request.Form["txtFirstNum"].ToString()); int number2 = Convert.ToInt32(HttpContext.Request.Form["txtSecondNum"].ToString()); int res = number1 + number2; ViewBag.Result = res.ToString(); return View("addition"); } }}In this program, we have added two IAction Methods addition() and add(). Addition() method will return the addition view page and add() method obtains input from the browser, processes it, and results will be kept in ViewBag.Result and then returned to the browser. Now, press Ctrl+F5 for running your program. This will launch an ASP.NET Core WEBSITE into the browser. Add /Home/addition at the end of the link and then hit on enter. The output format is given below: ConclusionThe .NET is a full-stack software development framework, which is essentially used to build large enterprise-scale and scalable software applications. The .NET framework has wide scope in the market. It is a flexible and user-friendly framework, that goes well along with other technologies. The .NET Core was developed in response to the surge in Java popularity. The .NET Core is normally used in low-risk projects. Some of the .NET components can be used in .NET core applications (but not the other way around). This article mainly concentrates on the framework concepts of .Net and .NET Core. We are sure that it would give you sufficient information and a fair knowledge of the common questions that will be asked during an interview. Useful Resources: .Net Developer: Career Guide ASP. NET Interview C# Interview |
|
| 2. |
How can you differentiate ASP.NET Core from .NET Core? |
|
Answer» .NET CORE is a RUNTIME and is used for the EXECUTION of an application that is built for it. Whereas ASP.NET Core is a collection of libraries that will form a framework for developing web applications. ASP.NET Core libraries can be used on .NET Core as well as on the “Full .NET Framework”. An application using the tools and libraries of ASP.NET Core is NORMALLY referred to as “ASP.NET Core Application”, which in theory doesn’t say whether it is built for .NET Framework or .NET Core. So an application of “ASP.NET Core” can be considered as a “.NET Core Application” or a “.NET Framework Application”. |
|
| 3. |
What is Xamarin? |
Answer»
|
|
| 4. |
What is Docker? |
Answer»
|
|
| 5. |
What is .NET Core SDK? |
|
Answer» .NET Core SDK is a set of tools and libraries that ALLOWS the developer to CREATE a .NET application and library for .NET 5 (also .NET Core) and later versions. It includes the .NET CLI for building applications, .NET libraries and runtime for the purpose of building and running apps, and the dotnet.exe(dotnet executable) that runs CLI COMMANDS and runs an application. Here's the LINK to download. |
|
| 6. |
What is CoreRT? |
Answer»
|
|
| 7. |
In what situations .NET Core and .NET Standard Class Library project types will be used? |
|
Answer» .NET Core library is used if there is a requirement to increase the SURFACE area of the .NET API which your library will ACCESS, and permit only applications of .NET Core to be compatible with your library if you are okay with it. .NET Standard library will be used in case you need to increase the COUNT of applications that are compatible with your library and reduce surface area(a piece of code that a user can INTERACT with) of the .NET API which your library can access if you are okay with it. |
|
| 8. |
What is MEF? |
|
Answer» The MEF(Managed Extensibility Framework) is a library that is USEFUL for developing extensible and lightweight applications. It permits application DEVELOPERS for using extensions without the need for configuration. It also allows extension developers for easier CODE encapsulation and thus avoiding FRAGILE hard dependencies. MEF will let you reuse the extensions within applications, as well as across the applications. It is an INTEGRAL part of the .NET Framework 4. It improves the maintainability, flexibility, and testability of large applications. |
|
| 9. |
Explain Explicit Compilation (Ahead Of Time compilation). |
Answer»
Benefits of AOT Compilation:
|
|
| 10. |
Differentiate .NET Core vs .NET framework. |
||||||||||||||||||||||||||||||
Answer»
|
|||||||||||||||||||||||||||||||
| 11. |
What is middleware in .NET core? |
Answer»
Here, there are three middlewares are associated with an ASP.NET Core web application. They can be either middleware provided by the framework, added through NuGet, or your own custom middleware. The HTTP request will be added or modified by each middleware and control will be optionally passed to the next middleware and a FINAL response will be generated on the execution of all middleware components. |
|
| 12. |
Explain about .NET Core Components. |
|
Answer» The .NET Core Framework is composed of the following components:
|
|
| 13. |
What are Universal Windows Platform(UWP) Apps in .Net Core? |
|
Answer» Universal Windows Platform(UWP) is one of the methods used to create client applications for Windows. UWP apps will make use of WinRT APIs for providing POWERFUL UI as WELL as features of advanced asynchronous that are ideal for devices with internet connections. Features of UWP apps:
|
|
| 14. |
What is MSBuild in the .NET Core? |
|
Answer» MSBuild is the free and OPEN-source development platform for Visual Studio and Microsoft. It is a build tool that is helpful in automating the software product creation process, ALONG with source code compilation, packaging, testing, deployment, and documentation creation. Using MSBuild, we can build Visual Studio PROJECTS and solutions without the need of installing the Visual Studio IDE. In the Universal Windows Platform(UWP) app, if you open the folder named project, you will get to see both files namely project.json and *.csproj. But if you open our previous CONSOLE APPLICATION in .NET Core, you will get to see project.json and *.xproj files. |
|
| 15. |
Whether ‘debug’ and ‘trace’ are the same? |
|
Answer» No. The Trace class is USED for debugging as well as for certain build releases. It gives execution plan and PROCESS timing details. While debug is used mainly for debugging. Debug means GOING through the program code FLOW during execution time. Debug and trace ALLOW for monitoring of the application for errors and exceptions without VS.NET IDE. |
|
| 16. |
What is Transfer-encoding? |
|
Answer» Transfer-encoding is USED for transferring the payload body(information part of the data sent in the HTTP message body) to the user. It is a hop-by-hop header, that is APPLIED not to a resource itself, but to a message between two nodes. Each multi-node connection segment can make USE of various Transfer-encoding values. Transfer-encoding is SET to “Chunked” SPECIFYING that Hypertext Transfer Protocol’s mechanism of Chunked encoding data transfer is initiated in which data will be sent in a form of a series of “chunks”. This is helpful when the amount of data sent to the client is larger and the total size of the response will not be known until the completion of request processing. |
|
| 17. |
Give the differences between .NET Core and Mono? |
||||||||||
Answer»
|
|||||||||||
| 18. |
Explain about types of Common Type System(CTS). |
|
Answer» Common TYPE System(CTS) standardizes all the datatypes that can be used by different programming languages under the .NET framework. CTS has two TYPES. They are:
|
|
| 19. |
What is the use of generating SQL scripts in the .NET core? |
|
Answer» It’s useful to generate a SQL script, WHENEVER you are trying to debug or DEPLOY your migrations to a PRODUCTION database. The SQL script can be used in the FUTURE for REVIEWING the accuracy of data and tuned to fit the production database requirement. |
|
| 20. |
What is the IGCToCLR interface? |
|
Answer» IGCToCLR interface will be PASSED as an argument to the InitializeGarbageCollector() function and it is USED for runtime COMMUNICATION. It CONSISTS of a lot of built-in methods such as RestartEE(), SuspendEE(), etc. |
|
| 21. |
What is CoreFx? |
|
Answer» COREFX is the set of CLASS library implementations for .NET Core. It includes collection TYPES, CONSOLE, file systems, XML, JSON, ASYNC, etc. It is platform-neutral code, which means it can be shared across all platforms. Platform-neutral code is implemented in the form of a single portable assembly that can be used on all platforms. |
|
| 22. |
What is Zero Garbage Collectors? |
|
Answer» Zero GARBAGE Collectors allows you for object allocation as this is required by the Execution Engine. Created objects will not get deleted automatically and theoretically, no longer required memory is never reclaimed. There are TWO main USES of Zero Garbage Collectors. They are:
|
|
| 23. |
What is the purpose of webHostBuilder()? |
|
Answer» WEBHOSTBUILDER function is used for HTTP pipeline creation through webHostBuilder.Use() chaining all at once with WebHostBuilder.BUILD() by using the BUILDER pattern. This function is provided by Microsoft.AspNet.HOSTING namespace. The Build() method’s purpose is building necessary services and a Microsoft.AspNetCore.Hosting.IWebHost for hosting a web application. |
|
| 24. |
What is CoreCLR? |
|
Answer» CoreCLR is the run-time execution engine provided by the .NET Core. It consists of a JIT COMPILER, garbage collector, low-level classes, and primitive data types. .NET Core is a modular implementation of .NET, and can be used as the base stack for large scenario types, ranging from console utilities to WEB applications in the cloud. Here, various programming languages will be compiled by respective compilers(Roslyn can compile both C# and VB code as it includes C# and VB compilers) and Common Intermediate Language(CIL) code will be generated. When the application execution BEGINS, this CIL code is compiled into native machine code by using a JIT compiler included within CoreCLR. This CoreCLR is supported by many OPERATING systems such as Windows, Linux, etc. |
|
| 25. |
What are C# and F#? |
|
Answer» C# is a general-purpose and object-oriented programming language from Microsoft that runs on the .NET platform. It is designed for CLI(Common Language Infrastructure), which has executable code and a RUNTIME environment that allows for the usage of different high-level languages on various computer platforms and architectures. It is mainly used for DEVELOPING web applications, desktop applications, mobile applications, database applications, games, etc. F# is an open-source, functional-first, object-oriented and, cross-platform programming language that runs on a .NET platform and is used for writing robust, SUCCINCT, and performant code. We can say that F# is data-oriented because here code involves transforming data with functions. It is mainly used in MAKING scientific models, artificial intelligence research work, mathematical problem SOLVING, financial modelling, GUI games, CPU design, compiler programming, etc. |
|
| 26. |
What is Dot NET Core used for? |
Answer»
|
|
| 27. |
What is .NET core? |
|
Answer» .NET Core can be SAID as the newer version of the .NET Framework. It is a cost-free, general-purpose, open-source application development PLATFORM provided by Microsoft. It is a cross-platform framework because it runs on various operating systems such as Windows, LINUX, and macOS. This Framework can be used to develop applications LIKE mobile, web, IoT, machine learning, game, cloud, microservices, etc. It consists of important features like a cross-platform, sharable library, etc., that are necessary for running a basic .NET Core application. The remaining features are supplied in the form of NuGet packages, that can be added to your application according to your needs. Like this we can say, the .NET Core will boost up the performance of an application, decreases the memory footprint, and becomes easier for maintenance of an application. It follows the modular approach, so instead of the entire .NET Framework installation, your application can install or use only what is required. |
|