Sunday, 4 December 2016

IQS

1) State management Techniques.
2) Caching technique.
3) Asp.net page life cycle
4) Http Handlers and Http Modulers
5) how to Update interface with new methods
6) How to implement thread concepts
7) What is best practice to increase application performance.
8) Advantages and Disadvantages of Indexes in sql server
9) How to implement Singleton design pattern.
9) What is High level architecture of your Project.
10) Explain Joins in sql.

11)SOLID Principles in OOPS.

State management Techniques.

Types of state management  

There are two types of state management techniques: client side and server side.

Client side

  1. Hidden Field
  2. View State
  3. Cookies
  4. Query Strings

Server side

  1. Session
  2. Application

HTTP Handler

HTTP Handler is the process which runs in response to a HTTP request. So whenever user requests a file it is processed by the handler based on the extension. So, custom http handlers are created when you need to special handling based on the file name extension. Let's consider an example to create RSS for a site. So, create a handler that generates RSS-formatted XML. Now bind the .rss extension to the custom handler.

HTTP Modules
HTTP Modules are plugged into the life cycle of a request. So when a request is processed it is passed through all the modules in the pipeline of the request. So generally http modules are used for:
Security: For authenticating a request before the request is handled.
Statistics and Logging: Since modules are called for every request they can be used for gathering statistics and for logging information.
Custom header:  Since response can be modified, one can add custom header information to the response.


Default Access modifiers in C#?


An enum has default modifier as public

A class has default modifiers as Internal . It can declare members (methods etc) with following access modifiers:
public
internal
private
protected internal

An interface has default modifier as public

A struct has default modifier as Internal and it can declare its members (methods etc) with following access modifiers:
public
internal
private

Difference between CTE and Temp Table and Table Variable

Temp Table or Table variable or CTE are commonly used for storing data temporarily in SQL Server. In this article, you will learn the differences among these three.


CTE

CTE stands for Common Table expressions. It was introduced with SQL Server 2005. It is a temporary result set and typically it may be a result of complex sub-query. Unlike temporary table its life is limited to the current query. It is defined by using WITH statement. CTE improves readability and ease in maintenance of complex queries and sub-queries. Always begin CTE with semicolon.

WITH RESULT AS
(
Select salary,DENSE_RANK() over (order by salary DESC) as Denserank from Employee)
select top1 salary
from RESULT
where Result.DENSERANK=2  //--Getting second Highest sal if we want 3 Highest sal then put 3
When to use CTE

    This is used to store result of a complex sub query for further use.

    This is also used to create a recursive query.

Temporary Tables

In SQL Server, temporary tables are created at run-time and you can do all the operations which you can do on a normal table. These tables are created inside Tempdb database. Based on the scope and behavior temporary tables are of two types as given below-

 Local Temp Table

    Local temp tables are only available to the SQL Server session or connection (means single user) that created the tables. These are automatically deleted when the session that created the tables has been closed. Local temporary table name is stared with single hash ("#") sign.

        CREATE TABLE #LocalTemp
        (
         UserID int,
         Name varchar(50),
         Address varchar(150)
        )
        GO
        insert into #LocalTemp values ( 1, 'Shailendra','Noida');
        GO
        Select * from #LocalTemp

    The scope of Local temp table exist to the current session of current user means to the current query window. If you will close the current query window or open a new query window and will try to find above created temp table, it will give you the error.


Global Temp Table

    Global temp tables are available to all SQL Server sessions or connections (means all the user). These can be created by any SQL Server connection user and these are automatically deleted when all the SQL Server connections have been closed. Global temporary table name is stared with double hash ("##") sign.

        CREATE TABLE ##GlobalTemp
        (
         UserID int,
         Name varchar(50),
         Address varchar(150)
        )
        GO
        insert into ##GlobalTemp values ( 1, 'Shailendra','Noida');
        GO
        Select * from ##GlobalTemp
        

    Global temporary tables are visible to all SQL Server connections while Local temporary tables are visible to only current SQL Server connection.

Table Variable

This acts like a variable and exists for a particular batch of query execution. It gets dropped once it comes out of batch. This is also created in the Tempdb database but not the memory. This also allows you to create primary key, identity at the time of Table variable declaration but not non-clustered index.

     GO
     DECLARE @TProduct TABLE
     (
     SNo INT IDENTITY(1,1),
     ProductID INT,
     Qty INT
     )
     --Insert data to Table variable @Product
     INSERT INTO @TProduct(ProductID,Qty)
     SELECT DISTINCT ProductID, Qty FROM ProductsSales ORDER BY ProductID ASC
     --Select data
     Select * from @TProduct
    
     --Next batch
     GO
     Select * from @TProduct --gives error in next batch
    

Note:

    Temp Tables are physically created in the Tempdb database. These tables act as the normal table and also can have constraints, index like normal tables.

    CTE is a named temporary result set which is used to manipulate the complex sub-queries data. This exists for the scope of statement. This is created in memory rather than Tempdb database. You cannot create any index on CTE.

    Table Variable acts like a variable and exists for a particular batch of query execution. It gets dropped once it comes out of batch. This is also created in the Tempdb database but not the memory.

Difference between Application Pool (AppPool) and Application Domain (AppDomain) 
  •     Application Domain is an ASP.NET concept which provides isolation for each ASP.NET application. Application Pool is an IIS concept which also provides isolation but at the process level.
  •     Application Domain is available only for ASP.NET applications. Application Pool is available for both ASP.NET and non-ASP.NET applications.
  •     Each ASP.NET application has its own Application Domain. One Application Pool can be shared by more than one applicaton.
  •     You do not have much control on creating an Application Domain for your application. You can configure the Application Pool using the IIS manager.
  •     You can edit and save the web.config file to recreate the Application Domain. You can recycle the Application Pool in the IIS manager.
.

No comments:

Post a Comment