Top .net interview questions for fresher and experienced
Top .net interview questions for fresher and experienced 2023 / 2024 / 2025 / 2026 / 2027 .NET framework is developed by Microsoft, provides an environment to run, debug and deploy code onto web services and applications by using tools and functionalities like libraries, classes, and APIs. This framework uses object-oriented programming.
2023-03-26 18:45:56 - VOP
You can use different languages like C#, Cobol, VB, F#, Perl, etc. for writing .NET framework applications. This Framework supports services, websites, desktop applications, and many more on Windows. It provides functionalities such as generic types, automatic memory management, reflection, concurrency, etc. These functionalities will help to make the development easier and efficiently build high-quality web as well as client applications.
.NET Core is a newer version of the .NET framework and it is a general-purpose, cost-free, open-source development platform developed by Microsoft. .NET Core is a cross-platform framework that runs an application on different operating systems such as Windows, Linux, and macOS operating systems. This framework can be used to develop various kinds of applications like mobile, web, IoT, cloud, microservices, machine learning, game, etc.
Characteristics of .NET Core:
- Free and open-source: .NET Core source code project can be obtained from Github. It is free and licensed under the MIT and Apache licenses.
- Cross-platform: .NET Core is supported by different operating systems like Windows, macOS, and Linux.
- Sharable: A single consistent API model that is written in .NET Standard will be used by .NET Core and is common for all the .NET applications. The same library or API can be used on multiple platforms with different languages.
- Friendly: The .NET Core is compatible with .NET Framework, Mono, and Xamarin, through .NET Standard. It also supports working with different Web frameworks and libraries such as Angular, React, and JavaScript.
- Fast: .NET Core 3.0 is faster compared to the .NET Framework, .NET Core 2.2 and previous versions. It is also much faster than other server-side frameworks like Node.js and Java Servlet.
.NET is a framework for software development. It is just like other software development framework like (J2EE). It provides runtime capabilities and a rich set of pre-built functionality in the form of class library and API's. This .NET framework is an environment to build, deploy and run web services and other applications.
The .NET framework contains three main parts:
- Common Language Runtime
- Framework classes
- ASP.NET
.NET is one of the platforms provided by Microsoft, which is used to build a variety of applications using Windows.
The ability to develop classes, libraries, and APIs and run, debug, and deploy code onto web services and applications form are the key uses of this framework. It supports a lot of languages, and you can work with everything from C# to VB all the way to Perl, and more.
The object-oriented model is championed here in the .NET framework
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:
<form asp-controller="Home" asp-action="add" method="post">
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.