Anda di halaman 1dari 3

Questions to be asked by Jobs Team member (Dot Net 2-4 year experience)

Page |1

1. What are HTML helpers in MVC?


HTML helpers help you to render HTML controls in the view. For instance if you
want to display a HTML textbox on the view , below is the HTML helper code.

<%= Html.TextBox("LastName") %>

For checkbox below is the HTML helper code. In this way we have HTML helper
methods for every HTML control that exists.

<%= Html.CheckBox("Married") %>

2. What is routing in MVC?


Routing helps you to define a URL structure and map the URL with the controller.

For instance lets say we want that when a user types


http://localhost/View/ViewCustomer/, it goes to the Customer Controller and
invokes the DisplayCustomer action. This is defined by adding an entry in to
the routes collection using the maproute function. Below is the underlined code
which shows how the URL structure and mapping with controller and action is
defined.

Hide Copy Code


routes.MapRoute(
"View", // Route name
"View/ViewCustomer/{id}", // URL with parameters
new { controller = "Customer", action = "DisplayCustomer",
id = UrlParameter.Optional }); // Parameter defaults

3. Where is the route mapping code written?

The route mapping code is written in "RouteConfig.cs" file and registered using
"global.asax" application start event.

4. Ca e ap ultiple URLs to the sa e actio ?

Yes, you can, you just need to make two entries with different key names and
specify the same controller and action.

5. What is difference between TempData and ViewData ?

TempData maintains data for the complete request while ViewData maintains
data only from Controller to the view.

Confidential: Dot Net Questions- www.chetu.com


V04242017
Created by Prashant Kumar (TA)
Questions to be asked by Jobs Team member (Dot Net 2-4 year experience)
Page |2

6. Does Te pData p ese e data i the ext e uest also?

TempData is available through out for the current request and in the subsequent
request its available depending on whether TempData is read or not.

So if TempData is once read it will not be available in the subsequent request.

7. What are the different types of action filters?


Authorization filters
Action filters
Result filters
Exception filters

8. What does information assemblyinfo.cs file consists.


AssemblyInfo.cs file contains details about the assembly
name, version info and security info. And various details
including company, description and trademark etc.

9. What is boxing and unboxing?


Boxing is the process of converting a value type to the type object or to any
interface type implemented by this value type. When the CLR boxes a value type,
it wraps the value inside a System.Object and stores it on the managed
heap. Unboxing extracts the value type from the object.

10. What is serialization?


Serialization (C# and Visual Basic) Serialization is the process of converting
an object into a stream of bytes in order to store the object or transmit it to
memory, a database, or a file. Its main purpose is to save the state of an object
in order to be able to recreate it when needed.

11. What is Access modifiers in C#?


Total 5 type in C#

Public: Access is not restricted.


Protected: Access is limited to the containing class or types derived from the
containing class.
Internal: Access is limited to the current assembly.
Protected internal: Access is limited to the current assembly or types derived
from the containing class.
Private: Access is limited to the containing type.

Confidential: Dot Net Questions- www.chetu.com


V04242017
Created by Prashant Kumar (TA)
Questions to be asked by Jobs Team member (Dot Net 2-4 year experience)
Page |3

12. What is an index and types of indexes?


Index is created on a column in tables. It helps in providing fast access to data
based on the values stored in the column.
E.g.: If an index is created on primary key of a table and then search for a row
based on primary key value then SQL Server first finds that value in the index
and then uses the index to locate the row in the table instead of performing a
complete table scan.

Types of indexes:
Clustered: Stores the actual row at the leaf level of the index.
No clustered: Stores only the values from the indexed column and row
locators that point to the actual row at leaf level instead of the actual row itself.

13. Difference between inline query and stored procedure


Query and stored procedure do the same thing but the difference is that a query
should be compiled every time the query is executed, while the stored procedure
is in compiled form when executed first time. I f we use stored procedure we can
avoid recompilation of the query.

By using stored procedures we can separate all the queries from the Business
logic code.
Therefore we can create a separate layer.
But while writing inline queries, all the queries have to be written (mixed up) with
the business logic code. This create problem while debugging.

14. Diff between primary key and unique key


Primary Key:
Can be only one in a table

It never allows null values

Primary Key is a unique key identifier and cannot be null


Unique Key:
Can be more than one unique key in one table

Unique key can have null values(only single null is allowed)

It can be a candidate key

Unique key can be null and may not be unique

Confidential: Dot Net Questions- www.chetu.com


V04242017
Created by Prashant Kumar (TA)

Anda mungkin juga menyukai