Basics Flashcards

1
Q

What is ASP.NET MVC Core ?

A

ASP.NET MVC Core is an open source, cross platform framework to develop web applications. When you develop web applications using ASP.NET Core it can run on windows, Linux and mac.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Can you explain the difference between MVC core vs MVC 5 vs Webforms?

A

Now there are like 10 to 12 differences and if we try say all of them during interviews its not going to work. Always remember let the interviewer speak more and you as a candidate should speak to the point. I have listed below all 12 points but would recommend to start with the first 4 points which are highlighted.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Can you explain MVC Architecture?

A

MVC is an architecture pattern where we
divide project in to three layers.

The first layer is the view which has things

like Color, UI positioning, CSS, input

controls, buttons and so on.

Second layer is Model which is a simple

class which has business validations.

Controller binds the model and the view.

So the first hit comes to the controller, it

loads the model and binds the model data to

the view.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Where do we store configuration in ASP.NET Core ?

A

Configuration data is stored in a json file called as Appsettings.json .

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How can we read configuration file in ASP.NET Core ?

A

To read configuration from appsettings.json you need to use “IConfiguration” interface

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is dependency injection?

A
Dependency injection is practice of providing dependent objects for a class from outside rather than the
class creating it. So, in simple words the object creation process is isolated from the caller. This helps
to create a proper decoupled system.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Why do we need dependency injection?

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How to implement dependency injection?

A

To implement DI we need to add the service in “ConfigureServices” method which is in Startup.cs file.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Explain the concept of middleware?

A

Middleware helps to add pre-processing logic before the request is sent to the controller

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How to implement middleware in MVC Core ?

A

Middlewares are added in “Configure” method of Startup.cs file.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Explain the importance of Startup.cs file in ASP.NET Core ?

A

Startup.cs file helps to configure Dependency injection and Middle wares.
Explain the

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Explain the various way of doing DI in MVC?

A

This is an easy topic to understand but very difficult to explain to interviewer in simple words. So, I
would suggest to go through the below explanation, understand it and create your simple one liner.

There are three ways of doing DI:

Scoped, Transient and Singleton.

  • *Transient**: - Creates new instances, every single time service is injected.
  • *Scoped**: - Creates new instances, once per request made to server.
  • *Singleton**: - Instantiates one global object for all requests coming to server from any user.

The below image shows the same visually. In transient for every dependency injection new instance
will be injected. For example, in the below image for “obj” and “obj1” fresh new instances will be
injected for every request.
In case of scoped for every request same instance will be injected for every dependency injection. So
“obj” and “obj1” will have same instance injected.
In case of singleton one big global instance created. For all request , for all Dependency injection same
instance will be injected.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What are the various ways of doing session management in ASP.Net Core ?

A
  • Session variables
  • Tempdata
  • ViewData / ViewBag
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

ConfigureServices vs Configure method ?

A

In ConfigureServices we add the objects to be dependency injected while in Configure method we
specify middlewares

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Explain Razor pages ?

A

Razor is a view engine in which you can write both C# and HTML code. C# code is rendered at the
server side.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

How can we pass model data to the view ?

A

You can pass by using viewdata or using strongly typed views.

17
Q

What is a strongly typed view ?

A

Strongly typed views are Razor views where we get intellisense for the model used in the view.

18
Q

Explain the concept of viewModel ?

A

View Model represents the data to be displayed on the view.

19
Q

Explain kestrel web server ?

A
20
Q

Why kestrel web server when we have IIS ?

A
21
Q

Explain concept of reverse proxy ?

A

Reverse proxy is a concept where the server acts like a mediator. Kestrel works on reverse proxy
concept it takes the request from the main web server like IIS / Apache and forwards its to MVC
application and vice-versa.

22
Q

What are cookies ?

A
23
Q

What is the need session management ?

A
24
Q

What are the various ways of doing Session management in ASP.NET ?

A
25
Q
A