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 :

Wednesday, February 17, 2021

Learn some important concepts in C#.

 
In this article we are going to learn some important concepts like IL, JIT...

What is IL?:

  • IL code stands for intermediate code.
  • When this program will run at user system, this run time IL code is converted into machine code by JIT (just-in-time) compiler.
  • JIT Compiler converted IL Code into Machine Code.
  • IL code also known as Common intermediate language code or Microsoft intermediate language code.
  • In Microsoft visual studio supports too many language. In same different user have different machine configuration and different operating system whose unknown to visual studio. That is the main problem. 
  • To avoid this problem Microsoft Creates a code that is called as IL Code.
  • It’s called as IL code or half compiled code, it’s creates at compile time.

What is JIT ?

  • JIT stands for just-in-time compiler.
  •  It converts the MSIL code to CPU native code as it is needed during code execution.
  • It is called just-in-time since it converts the MSIL code to CPU native code; when it is required within code execution otherwise it will not do nothing with that MSIL code.
There are three types of JIT:

1.Pre-JIT Compiler (Compiles entire code into native code completely).
2.Econo JIT Compiler (Compiles code part by part freeing when required).
3.Normal JIT Compiler (It compiles only those methods that are called at runtime).

Strongly Typed:
  • general: C# is used in a strongly typed manner, meaning: a variable is declared of a specific Type either: string, int, a user-defined type, etc and cannot, later, be assigned a value of a different type.
  • C#  is strongly typed because the compiler will detect and flag these errors at compilation time.

Conversion:

  • The process of converting the value of one data type (integer, string, float, etc.) to another data type is called type.
  • Example:


   

       
For more understanding watch below video :


Thank you!!!!!







Saturday, February 6, 2021

Learn Angular CLI Day- 13

Now we are going to learn the Angular CLI.


What is Angular CLI:



  • The Angular CLI is a command-line interface tool that you use to initialize, develop, scaffold, and maintain Angular applications directly from a command shell.
  • Angular CLI is the official tool for initializing and working with Angular projects. 
  • It saves you from the hassle of complex configurations and build tools like TypeScript Webpack, and so on.

Installing Angular CLI:

  • Major versions of Angular CLI follow the supported major version of Angular, but minor versions can be released separately.
  • Install the CLI using the npm package manager:

  • To create, build, and serve a new, basic Angular project on a development server, go to the parent directory of your new workspace use the following commands:
         ng new my-first-project

         cd my-first-project   

         ng serve


Why is angular CLI used?

  • The Angular CLI is used for much more than just creating an Angular project.
  •  It can be used to create components, services, pipes, directives and more. 
  • Also it helps in building, serving, testing etc. CLI itself is quite something to learn about, it makes Angular development workflow much easier and faster.


Ng new:

  • The Angular CLI makes it easy to create an application that already works, right out of the box. It already follows our best practices.
  • Creates a new workspace and an initial Angular application.
Syntax:

ng new <name> [options]
ng n <name> [options]


Ng Serve:

  • ng serve command builds and serve the application. It rebuilds the application if changes occur. Here project is the name of the application as defined in angular.
  • Easily test your app locally while developing.
Syntax:

ng serve <project> [options]
ng s <project> [options]



Floder Structure:





Configuration
:





Thank you!!!!















Friday, January 8, 2021

Learn Angular Day-12


Now we are going to learn the angular starting with basic introduction :

What is Angular:



  • Angular is a platform and framework for building single-page client applications using HTML and TypeScript. 
  • Angular is written in TypeScript. 
  • It implements core and optional functionality as a set of TypeScript libraries that you import into your apps.


Features of Angular:





Below are some of the powerful features available with Angular:
  • Less code:
Plenty of scripts is necessary just to design an application when performing DOM manipulation. But the very minimal amount of code is enough for DOM manipulation if using Angular.

  • Model View Controller:
The angular framework is constructed on a well-known idea called Model-View-Controller (MVC).
  • Unit Testing:
We have an excellent test framework known as Karma designed by the Google development team. This is very much helpful for performing designing unit tests for Angular JS applications.
  • Data Model Binding:
While binding data to the HTML controls, special code is not required. Simply by adding very few snippets of code is possible to bind data, which is done through Angular.
  • Desktop Apps:
Using Angular, you can easily create applications that are desktop-installed across various operating systems such as Windows, Mac, and Linux.

  • Virtual Scrolling:
To load and unload items from DOM, Virtual Scrolling in Angular is principally used. This process is completely based on visible parts of lists.
 Click Here – To Become an Angular


Why angular:

  • Angular not only provides us the tools but also provide various design patterns. It can easily understandable.
  • It is just like JS but a better version of it. We don't need to learn a completely new language.
  • It is a one framework for multiple platforms like web, mobile, desktop etc.
  • Angular is thoroughly tested i.e it supports both unit as well as end-to-end testing.





Thank you....








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...