Top 40 Jenkins Interview Questions And Answers For Freshers/Experienced
If you are looking for a career in software development, then Jenkins is definitely worth exploring. This widely used …
You are looking for a job in ASP.NET Core, but you don’t know where to begin. It’s important that you know what the hiring managers look for when hiring for ASP.NET Core developer. So, to help you out, here are a few ASP.NET Core Interview Questions to prepare for an upcoming job interview. Here, we have given questions for all levels i.e. freshers, intermediate, experienced to ace the job interview after preparing from these ASP.NET Core Interview Questions & Answers.
About ASP.NET Core: ASP.NET Core is a web application framework developed by Microsoft. It was first released in June 2016. ASP.NET Core is a modular and lightweight web application platform. It can be used to develop different kinds of websites including simple ones such as single-page applications and dynamic ones like portal websites.
2. What are the features ASP.NET Core offers?
3. Tell me the benefits of ASP.NET Core over ASP.NET?
4. Explain Host in ASP.NET Core?
6. Is ASP.NET Core application is able to work with full .NET 4.x Framework?
7. Explain startup class in ASP.NET core?
8. Tell me the use of ConfigureServices process of startup class?
9. Explain the way to use Configure method of the startup class?
10. Explain the Web Host and Generic Host.
11. Explain Options Pattern in ASP.NET Core?
12. Tell me the way to use numerous environments in ASP.NET Core?
13. How does Routing work in ASP.NET Core?
14. What do you understand by Session and State management in ASP.NET Core?
15. Can Docker containers run ASP.NET applications?
17. Which do you think is more suitable for beginners, .NET Core or .NET MVC?
18. What are some of the things that you like and dislike about the new framework?
19. Which would you choose to go in a client-server application? ASP.NET Core or .NET MVC?
20. How does ASP.NET Core perform static files?
21. Describe Response Caching or caching in ASP.NET Core.
23. Explain Distributed caching?
28. Describe strongly-typed views.
29. What's the use of Map.Use() when adding middleware to the ASP.NET Core pipeline?
30. How to allow Session in ASP.NET Core?
31. Name different JSON files available in ASP.NET Core?
32. Tell me the way to disable Tag Helper at element level?
33. Explain Razor Pages in ASP.NET Core?
34. Tell me the way of automatic model binding in Razor pages?
35. Explain Startup.cs file in ASP.NET Core?
36. What is the purpose of the Program class?
37. Explain the role of the wwwroot folder?
38. What is the purpose of the appsettings.json file?
41. What’s the HTTPContext object? How can you access it within a Controller?
43. Can ASP.NET Core work with the .NET framework?
44. Differentiate between SDK and Runtime in .NET Core?
45. What are the advantages of using explicit compilation?
46. What are service lifetimes in .NET Core?
2. What are the features ASP.NET Core offers?
3. Tell me the benefits of ASP.NET Core over ASP.NET?
4. Explain Host in ASP.NET Core?
6. Is ASP.NET Core application is able to work with full .NET 4.x Framework?
7. Explain startup class in ASP.NET core?
It is the entrance point of the ASP.NET Core application and each .NET Core application has this class. This startup class includes the application configuration-related items. It isn't mandatory that the class name must be "Startup", we can organize the startup class in the Program class. public class Program { public static void Main(string[] args) { CreateWebHostBuilder(args).Build().Run(); } public static IWebHostBuilder CreateWebHostBuilder(string[] args) => WebHost.CreateDefaultBuilder(args) .UseStartup<TestClass>(); }
8. Tell me the use of ConfigureServices process of startup class?
9. Explain the way to use Configure method of the startup class?
10. Explain the Web Host and Generic Host.
The host sets up the server, demand pipeline and is accountable for app startup and lifetime administration. There are two hosts: ASP.NET Core Web Host .NET Generic Host ASP.NET Core Web host is utilized for backward compatibility. .NET Generic Host is recommended to use whereas ASP.NET Core template creates a .NET Generic Host on app startup. // Host creation public class Program { public static void Main(string[] args) { CreateWebHostBuilder(args).Build().Run(); } public static IWebHostBuilder CreateWebHostBuilder(string[] args) => WebHost.CreateDefaultBuilder(args) .UseStartup(); }
11. Explain Options Pattern in ASP.NET Core?
12. Tell me the way to use numerous environments in ASP.NET Core?
13. How does Routing work in ASP.NET Core?
It manages incoming HTTP requests for the application. Routing sees a similar executable endpoint for coming requests. These endpoints are recorded when the application starts. The matching process takes help from values from the incoming request URL to execute the requests. You can configure the routing in the middleware pipeline of configuring technique in the startup class. app.UseRouting(); // It adds route matching to middlware pipeline // It adds endpoints execution to middleware pipeline app.UseEndpoints(endpoints => { endpoints.MapGet("/", async context => { await context.Response.WriteAsync("Hello World!"); }); });
14. What do you understand by Session and State management in ASP.NET Core?
15. Can Docker containers run ASP.NET applications?
16. Can you provide a quick example of how to use an ASP.NET Core application with your personal website or blog?
A personal blog is just about the simplest scenario to show off without too much modification. ASP.NET Core gives some great powers over content to your application, like directly configuring ViewBag from an environment variable with a web.config property name and setting up middleware as plugins on different controllers with easily-remembered names; however, it’s not that hard either if you prefer modifying by hand things in the many configuration files manually (or prefer Visual Studio ). First, create an ASP.NET Core application:
1 2 3 4 5 6 $ dotnet new myweb –name MyWeb -t should be obvious which we convert to a personal website with the app namespace and call TresCredenius because I like writing acronyms for all of our websites…
Figure out where you need to put your site on your file system. For this set up, we will put our project under the “““C:\fake”” web url. This can be achieved by modifying the WebApi RouteHandler in Startup class:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 using Microsoft.
17. Which do you think is more suitable for beginners, .NET Core or .NET MVC?
18. What are some of the things that you like and dislike about the new framework?
19. Which would you choose to go in a client-server application? ASP.NET Core or .NET MVC?
20. How does ASP.NET Core perform static files?
Static files such as CSS, images, JavaScript, HTML files are served directly from your ASP.NET Core web application. The ASP.NET Core template provides the root directory and the wwwroot folder which have all the static files. UseStaticFiles() is called in the Startup.configure to add the static file served to the client. Configuration allows the static files to be served outside of this webroot folder. You can serve files outside of this webroot folder by configuring Static File Middleware as follows. app.UseStaticFiles(new StaticFileOptions { FileProvider = new PhysicalFileProvider( Path.Combine(env.ContentRootPath, "MyStaticFiles")), // MyStaticFiles is new folder RequestPath = "/StaticFiles" // this is requested path by client }); // now you can use your file as below <img src="/StaticFiles/images/profile.jpg" class="img" alt="A red rose" /> // profile.jpg is image inside MyStaticFiles/images folder
21. Describe Response Caching or caching in ASP.NET Core.
Caching can significantly improve performance by reducing the number of calls to data sources. It makes the scalability much better. An effective way of improving scalability is through response caching. Caching copy data and stores it instead of fetching it from the actual source.
The ResponseCache element sets the caching headers for response caching. ResponseCache can be used to set additional properties on a response.
Know the Interview Criteria of these MNCs!!!
It stores the data in RAM on the web server, making it a faster and more efficient way of caching than other solutions.
Applications that run on multiple servers need to ensure the session data is sticky and stored in-memory to help it run faster. A sticky session is a PHP function or class that is designed to redirect subsequent client requests to the same server. The class itself is an in-memory object; this means that all the data stored within is stored in memory. An in-memory cache can keep any object but distributed cache only stores byte[].
This allows you to add your implementation of IMemoryCache by using dependency injection with ASP.NET Core dependency injection mechanism in a constructor.
23. Explain Distributed caching?
Applications running on a web farm should have their session state saved in a shared database. The application should make the session sticky. Non-sticky sessions could cause caching inconsistencies between servers. Distributing caches can help alleviate some of the problems with consistent memory management. Caching in a distributed environment has certain advantages.
Distributed caching service provided by any constructor of the IDistributedCache interface allows simply creating a cache via Dependency Injection.
ViewModel is used to pass complicated data from controller to view. The data of ViewModel is prepared from various models and passed to view to display that data. For example, a complicated data model can be passed by using a ViewModel pattern .
Class Author{
public int Id {get;set;}
public Book Book {get;set;}
}
Class Book{
public string Name {get;set;}
public string PublisherName {get;set;}
}
This Author and Book data can be viewed when creating BookViewModel inside a controller.
ViewModel is used to pass complicated data from controller to view. The data of ViewModel is prepared from various models and passed to view to display that data. For example, a complicated data model can be passed by using a ViewModel pattern .
Class Author{
public int Id {get;set;}
public Book Book {get;set;}
}
Class Book{
public string Name {get;set;}
public string PublisherName {get;set;}
}
This Author and Book data can be viewed when creating BookViewModel inside a controller.
28. Describe strongly-typed views.
29. What's the use of Map.Use() when adding middleware to the ASP.NET Core pipeline?
This node is used to branch pipelines. This node branches the ASP.NET Core pipeline on the basis of request path matching. When the request path starts with the given path, the middleware on to that branch will perform.
public void Configure(IApplicationBuilder app)
{
app.Map("/path1”, Middleware1);
app.Map("/path2”, Middleware2);
}
30. How to allow Session in ASP.NET Core?
Microsoft ASP.NET Core provides a Session middleware for the session. The ASP.NET Core application must be configured to use the Session middleware. The csproj file must have the add Session middleware to the ASP.NET Core request pipeline. public class Startup { public void ConfigureServices(IServiceCollection services) { …. …. services.AddSession(); services.AddMvc(); } public void Configure(IApplicationBuilder app, IHostingEnvironment env) { …. …. app.UseSession(); …. …. } }
31. Name different JSON files available in ASP.NET Core?
32. Tell me the way to disable Tag Helper at element level?
You can disable Tag Helper from the element level by adding the HTML comment character ("!"). To open and close an Html tag, this character must be used. Example
<!span asp-validation-for="phone” class="divPhone"></!span>
33. Explain Razor Pages in ASP.NET Core?
This is a new feature in ASP.NET Core 2.0 that follows the page-centric development model used in previous versions of ASP.NET. Net Web Forms. It offers all the features of ASP .NET Core. Example
@page
Razor pages start with the @page directive, which handles a request directly without going through the controller. When Razor pages were initially introduced as a concept, the Razor pages could have a code**-**behind files considered to be a .cs file in disguise. A class inherited from the PageModel class contains the logic of the Razor pages.
34. Tell me the way of automatic model binding in Razor pages?
Razor pages let you bind properties as you post data with the BindProperty attribute. By default, it only binds the properties to non-GET verbs. We need to set SupportsGet to true in order to enable binding to property. Example: public class Test1Model : PageModel { [BindProperty] public string Name { get; set; } }
35. Explain Startup.cs file in ASP.NET Core?
36. What is the purpose of the Program class?
Program.cs file is the starting point of any ASP.NET project. For a Windows application, the entry point method is defined in Program.cs. This file has the signature of a static void Main() function.
This class configures the web host that will serve the requests. The host is responsible for application startup and lifetime management, including graceful shutdown.
In this case, you must have a server and a request processing pipeline, because the server can also manage logging, configuration, and dependency injection.
37. Explain the role of the wwwroot folder?
38. What is the purpose of the appsettings.json file?
Appsettings.json contains all the configuration options for your application, which allows you to configure your application's behavior. For example: { "Logging": { "LogLevel": { "Default": "Information", "Microsoft": "Warning", "Microsoft.Hosting.Lifetime": "Information" } }, "ConnectionStrings": { "AppConnection": "" }, "AWS": { "Profile": "local-test-profile", "Region": "us-west-2" }, "AllowedHosts": "*" }
In the world of the Internet, the Internet Information Services (IIS) server is a common program used by organizations that offer Internet hosting services. IIS was developed and released in 1998 by Microsoft. IIS allows you to add multiple web servers to your network with less maintenance than using a single server.
As a reverse proxy, it accepts requests from clients and forwards them to an application server. A reverse proxy improves security, reliability, and performance.
IIS is highly configurable. It will run only on any Windows OS version including Windows 95, 98, ME, NT, 2000, and later, starting with Windows XP
Kestrel is a free, cross-platform ASP.NET Core web server designed for the development and deployment of websites and services. ASP.NET Core is small and lightweight when compared with IIS. Kestrel is a web server that runs on Linux operating system.
However, Kestrel can serve an ASP.NET Core application on its own, but it’s recommended to use it with a reverse proxy server like IIS, Nginx, or Apache to provide better performance, security, and reliability.
41. What’s the HTTPContext object? How can you access it within a Controller?
The HttpContext class encapsulates HTTP-specific information for a single HTTP request. This information is used by ControllerBase.HttpContext to make decisions for example: public class HomeController : Controller { public IActionResult About() { var pathBase = HttpContext.Request.PathBase; ... return View(); } }
A cookie is a small piece of data that is sent to the browser each time a website is visited by a user. It can contain information such as login IDs, passwords, and other personal information. Cookies are stored on the browser. Most browsers use a cookie format that consists of an alphanumeric key and a value, often, it is simply the name of the website visited by the user.
Write a cookie in ASP.NET Core:
Response.Cookies.Append(key, value);
Delete a cookie in ASP.NET Core
Response.Cookies.Delete(somekey);
43. Can ASP.NET Core work with the .NET framework?
Yes. You may be surprised to learn that ASP.NET Core works with the .NET framework and Microsoft officially supports that as well.
ASP.NET Core works with:
44. Differentiate between SDK and Runtime in .NET Core?
The SDK is all the things you need for developing a .NET Core application. It includes the CLI and a compiler.
The runtime provides a virtual machine on which the application runs, and abstracts all the interactions with the operating system.
45. What are the advantages of using explicit compilation?
46. What are service lifetimes in .NET Core?
.Net Core introduces a design pattern named Dependency Injection (DI) by using an implementation of IoC(Inversion of Control) that provides an easy way to get hold of services by the business logic. Dependencies also demand that its life cycle must be well defined. There is a range of life cycles for instances of a service. The various states of an instance of the service are controlled by the conditions of its life cycle.
There are three types of support lifetimes for .NET Core:
If you are looking for a career in software development, then Jenkins is definitely worth exploring. This widely used …
In this post, we will cover a few Linux interview questions and their answers. So, let’s get started. In this …