Friday, April 9, 2021

ASP.NET MVC Interview Questions Part-2

 

ASP.NET MVC Interview Questions Part-2




1.How is the URL structure of MVC core ?

  • URL structure of MVC core is controller name with action name.
  • The URL structure of MVC core is  localhost :4200/{ controller} /{action name}.
  • The "localhost:4200" is considered as a controller name.


                                           



2.If the view name is different than action name how to invoke it ?

  • If the view name is different than action name then we have to write view in double quotes("").







3.How do we define navigation using anchor tag ?

  • The navigations can be defined using anchor tag as <a href="/Controller name/Action name"></a>
  • The HTML <a> element (also called the anchor element), containing its href attribute, creates a hyperlink to other web pages, locations within the same page, location to a specified title of another web page, or to an email web page. 
  • The <a> tag defines a hyperlink, which is used to link from one page to another.







4.How to pass model to the view ?

  • The other way of passing the data from Controller to View can be by passing an object of the model class to the View. 
  • Erase the code of ViewData and pass the object of model class in return view. 
  • Example : return View("View Name" , Models (Objects) );







5.How can we change the startup controller name and action name ?

  • In MVC you can change controller and action location in URL by doing some changes in RouteConfig.cs.
  • For Example : In your application if Home is controller name and Index is action name so by default URL created to access it will be :











6.What is routing? 
  • Routing is a pattern matching system.
  • Routing is nothing but user-friendly URL.
  • It is used to move from one page to another  page.
  • It is to define URL structure and you map that URL structure with the method name and action name






6.What is a strongly typed view and how do we create them? 
  • The view which binds to a specific type of ViewModel is called as Strongly Typed View.
  • Strongly Typed View are those views by which we can have intellisence and how to create them you define @model at the top.















For more understanding watch below video :
Thank you!!!!


ASP.NET MVC Interview Questions Part-3


ASP.NET MVC Interview Questions Part-3

    

What is  Dependency Injection?

Dependence injection means injecting the dependent object by some one else rather than creating himself .




How can we read configuration data from appsettings.json?

By using IConfiguration object.

               






What is the need of viewdata?

Viewdata helps us to transfer data from controller to the view.

Example: ViewData["vi"]='' abc''

                                 

                           

                                 


                                


What is the difference between Viewdata and Viewbag?

Viewbag is similar to the Viewdata .

It is used to transfer data from controller to view.

Viewbag is nothing but syntactic sugar over Viewdata.

Typecasting, Null checks are not required.

Example: ViewBag.vi

                  

                       


Viewdata helps us to transfer data from controller to the view.

Typecasting, Null checks are required.

Syntax: ViewData["vi"]=''abc''




For more understanding watch below video :

Learn Concept In Angular Day-14


In this article ,we learn basic Concepts in angular


Two-way Binding::

Two-way data binding in Angular will help users to exchange data from the component to view and from view to the component. It will help users to establish communication bi-directionally. Two-way data binding can be achieved using a ngModel directive in Angular.

                               


           

what is ngModel

 ngModel is a directive which binds input, select and textarea, and stores the required user value in a variable and we can use that variable whenever we require that value. It also is used during validations in a form.

The ng-model directive binds an HTML form element to a variable in the scope.If the variable does not exist in the scope, it will be created.

Syntax

<element ng-model="name"></element>

Supported by <input>, <select>, and <textarea> elements.


Types of Directives:

1.Components — directives with a template.

2.Structural directives — change the DOM layout by adding and removing DOM elements.

3.Attribute directives — change the appearance or behavior of an element, component, or another directive.


Declarative Vs Imperative:




Declarative programming is a programming paradigm … that expresses the logic of a computation without describing its control flow.

Imperative programming is a programming paradigm that uses statements that change a program’s state.


Module:

Typically module is a cohesive group of code which is integrated with the other modules to run your Angular apps. A module exports some classes, function and values from its code. 


 Component: 

Components are like the basic building block in an Angular application. Components are defined using the @component decorator. 


Model:

The model in an MVC-based application is generally responsible for modeling the data used in the view and handling user interactions such as clicking on buttons, scrolling, or causing other changes in the view. 


 For more understanding watch below video :

https://www.youtube.com/watch?v=-jeoyDJDsSM



Thank you!!!!!

Thursday, April 8, 2021

ASP.NET MVC Interview Questions Part-1

 

ASP.NET MVC Interview Questions Part-1

    

What is ASP.NET MVC?

ASP.NET MVC is a web application framework developed by Microsoft that implements the model–view–controller (MVC) pattern. It is no longer in active development. MVC is a design pattern used to decouple user-interface (view), data (model), and application logic (controller). 






Why do we need appsettings.json?

 The appsettings. json file is an application configuration file used to store configuration settings   such as database connections strings, any application scope global variables, etc.




Some default values.




What is JSON?

JavaScript Object Notation (JSON) is a standard text-based format for representing structured data based on JavaScript object syntax. It is commonly used for transmitting data in web applications (e.g., sending some data from the server to the client, so it can be displayed on a web page, or vice versa.For example "version" - "1.1.10".



What kind of things go into wwwroot?

The wwwroot folder is intended to store static files in an ASP.NET Core application. This means CSS, JS, images, icons, Html ,etc.







What does program.cs file do?

 Program.cs is where the application starts. Program.cs class file is entry point of our application and creates an instance of IWebHost which hosts a web application.







What does ConfigureService and Configure method do in Startup.cs?

ConfigureServices provides an dependencies by injecting dependency services.And the Configure methods add those dependencies to middleware.





How is the flow of MVC?

MVC stands for Model, View, and Controller. MVC separates an application into three components - Model, View, and Controller.

Model: Model represents the shape of the data. 

View: View in MVC is a user interface. View display model data to the user and also enables them to modify them. 

Controller: The controller handles the user request. Typically, the user uses the view and raises an HTTP request, which will be handled by the controller. The controller processes the request and returns the appropriate view as a response.

                 



What are Razor views?

Razor is nothing but view engine in which we can write C# code and html together.And the extension of this file is .cshtml.



For more understanding watch below video :

Function in SQL -part 8

  In this blog we are going to understand  Sql function.   FUNCTION: A function is a database object in SQL Server. It accepts only input pa...