Asp.net
1) Session management
2) What is a round trip?
The trip of a Web page from the client to the server and then back to the
client is known as a round trip. In ASP.NET Response.Redirect()
causes a round trip.
3) What is a Global.asax file?
The Global.asax file has been derived from the HttpApplication class. The
Global.asax file is used to add application-level logic and processing. It does
neither handles any UI related processing, nor it does support individual
requests. It basically controls the following events.
Application_Start
Application_End
Session_Start
Session_End
4) What are various page events in ASP.NET?
Following are the page level events in ASP.NET.
PreInit: This is the
first event of a page used to set values such as a master page.
Init: This event fires
after each control have been initialized. You can use this event to change the
initialized value of controls.
InitComplete: This event
is raised after all initializations of a page and its controls have been
completed.
PreLoad: This event fires before view state has been loaded for a page
and its controls and before page postback processing. This event is
useful when you need to write code after the page is initialized.
Load(PageLoad): Page
load event is generally used to check postback and then sets control properties
appropriately. After this event, the load event of child control is called.
ControlEvents(Postback):
This event is called when a page or its controls causes postback such as
ButtonClick event, SelectedIndexChanged event, CheckedChanged events etc.
LoadComplete: At this event, all controls are loaded even after
additional processing can be done here.
PreRender: This event is
taking place before view state is saved also it allows final changes to the
page or its control.
SaveStateComplete: Any
changes to the page’s controls at this point are ignored here. This event is
useful if you need to write processing that requires the view state to be set.
Render: In real it is not
an event this is actually a method of a page object and its controls. At this
point, controls are rendered in client-side HTML ,
DHTML, and scripts for the browser.
Unload: This event is
used to clean up code you can use it to manually release resources.
5) What is the difference between User Control
and Custom Control?
6) What are the different modes for the
Session state in ASP.NET?
7) Once we hit the URL how that process is
happened to display page.
C#.net
1) What is the difference between directcast
and ctype?
DirectCast
is used to convert the type of object that requires the run-time type to be the
same as the specified type in DirectCast.Ctype is
used for conversion where the conversion is defined between the expression and
the type.
2) Solid principles
3) Dependency Injection implementation
4) Design patterns
5)
How to
use nullable types in .Net?
Value types can take either their normal
values or a null value. Such types are called nullable types.
Int? someID = null;
If(someID.HasVAlue)
{
}
6) Oops Principles
7) Why cant we create instance for abstract class.
LINQ
1) List out the three main components of LINQ?
Explain what is the extension of the file, when LINQ to SQL is used?
Three main components of LINQ are
Ø
Standard Query Operators
Ø
Language Extensions
Ø
LINQ Providers
2)
Explain
why SELECT clause comes after FROM clause in LINQ?
With other programming language and C#,
LINQ is used, it requires all the variables to be declared first. “FROM” clause
of LINQ query defines the range or conditions to select records. So, FROM
clause must appear before SELECT in LINQ.
Array sorting
List<int> numbers = new List<int>()
{
1, 7, 2, 61, 14
};
List<int>
sortedNumbers = numbers.OrderBy(number => number).ToList();
foreach
(int number in sortedNumbers)
Console.WriteLine(number);
3) Explain what is the difference between
Skip() and SkipWhile() extension method?
Ø
Skip() : It will take an integer argument and
from the given IEnumerable it skips the top n numbers
Ø
SkipWhile (): It will continue to skip the
elements as far as the input condition is true. It will return all remaining
elements if the condition is false
4)
Mention
what is the role of DataContext classes in LINQ?
DataContext class acts as a bridge between
SQL Server database and the LINQ to SQL. For accessing the database and also
for changing the data in the database, it contains connections string and the
functions.
5)
Explain
what is the purpose of LINQ providers in LINQ?
LINQ providers are set of classes that take
an LINQ query which generates method that executes an equivalent query against
a particular data source
SQL
1) SQL server merge
Suppose, you have two
table called source and target tables, and you need to update the target table
based on the values matched from the source table. There are three cases:
Ø The source table has some rows that do not exist in the target
table. In this case, you need to insert rows that are in the source table into the target table.
Ø The target table has some rows that do not exist in the source
table. In this case, you need to delete rows from the target table.
Ø The source table has some rows with the same keys as the rows in
the target table. However, these rows have different values in the non-key
columns. In this case, you need to update the rows in the target table with the values coming from
the source table.
2)
Joins – Cross outer join
3)
What are the properties of the transaction?
Properties of the transaction are known as
ACID properties. These are:
Atomicity: Ensures the
completeness of all transactions performed. Checks whether every transaction is
completed successfully or not. If not, then the transaction is aborted at the
failure point and the previous transaction is rolled back to its initial state
as changes are undone.
Consistency: Ensures that all
changes made through successful transactions are reflected properly on the database.
Isolation: Ensures that all
transactions are performed independently and changes made by one transaction
are not reflected on others.
Durability: Ensures that the
changes made in the database with committed transactions persist as it is even
after a system failure.
4)
How to give Query tuning or performance
5)
Cursors
6)
Indexes
7)
Triggers and types
8)
What is Normalization? How many Normalization forms are there?
Answer: Normalization
is used to organize the data in such a manner that data redundancy will never
occur in the database and avoid insert, update and delete anomalies.
There are 5 forms of
Normalization:
First Normal Form (1NF):
It removes all duplicate columns from the table. It creates a table for related
data and identifies unique column values.
Second Normal Form (2NF):
Follows 1NF and creates and places data subsets in an individual table and
defines the relationship between tables using the primary key.
Third Normal Form (3NF):
Follows 2NF and removes those columns which are not related through the primary
key.
Fourth Normal Form (4NF):
Follows 3NF and does not define multi-valued dependencies. 4NF is also known as
BCNF.
Web API
1)
What are the various return types in
ASP.Net Web API?
Answer: Following are the various return types in ASP.Net Web API
1. HttpResponseMessage
2. IHttpActionResult
3. Void
4. Other Type – string, int, or other entity types.
2)
What
is ASP.Net Web API routing?
Answer: Routing in ASP.Net Web API is the process that will decide which
action and which controller should be called.
There are following ways to implement routing in Web API.
1. Convention based routing
2. Attribute based routing
3)
CORS
issue in Web API?
Answer: CORS will stand for Cross-Origin Resource Sharing. CORS will
resolve the same-origin restriction for JavaScript. The same Origin means that
a JavaScript will only make AJAX call for the web pages within the same origin.
We must install CORS nuget package using
Package Manager Console to enable CORS in Web API.
Open WebAPIConfig.cs file
add config.EnableCors();
Add EnableCors attribute to the Controller
class and define the origin.
[EnableCors(origins: “”, headers: “*”,
methods: “*”)].
4)
Do we
return View from ASP.Net Web API?
Answer: No, it will not be possible in Web API as Web API will create
HTTP based service. It is available in MVC application
5)
Explain
oData with ASP.Net Web API.
Answer: OData is stand for Open Data Protocol, it will be a Rest-based
data access protocol. OData will provide a way for querying and manipulating
data using CRUD operation. ASP.Net Web API will support OData V3 and V4.
For using OData in ASP.Net Web API, We
required the OData package by running below command in Package Manager Console.
Install-Package Microsoft.AspNet.Odata
6)
Explain
media Formatters in Web API 2
Answer: Web API will handle JSON and XML formats which is based on the
Accept and Content-Type header values.
The Media-Type Formatters are classes which will be responsible for serializing
request/response data therefore that web API will understand the request data
format and send data in the format that client expects.
Technically MediaTypeFormatter is an abstract class from which
JsonMediaTypeFormatter and XmlMediaTypeFormatter classes inherit from.
JsonMediaTypeFormatter which will handle JSON and XmlMediaTypeFormatter handles
XML.
7)
Can the
HTTP request will be mapped to action method without using the HTTP attribute ?
Answer: There are actually two ways to map the HTTP request for action
method.One of the ways is to use the attribute on the action method .There is
another way is to just name method starting with the HTTP verb.For example if
we required to define a GET method we can define it as:
public void GetEmployee(int id)
{
StudentRepository.Get(id);
}
The above method will be automatically mapped with the GET request since it can
start with GET.
8)
What is
the disadvantage of “Other Return Types” in Web API?
Answer: The main disadvantage of this approach is that we will not
directly return an error code such as 404 error.