Overblog Follow this blog
Administration Create my blog
October 29 2010 6 29 /10 /October /2010 15:21

Six Sigma Interview Questions
Get Interview tutorials and videos on .NET 3.5, 4.0, Six,Sigma,ASP.NET  SQL Server, CAS, Security, WCF, SharePoint, Azure, OOPS and many more on www.questpond.com

 

Six Sigma

Introduction

I know many will not like my interview questions article. Some may think its bad for various reasons and some may think its good for quick revision. Again I repeat you do not get jobs by reading interview question and answers , but yes it definitely serves as a quick reference. So looking at the good part I continue my Interview questions and answers series. This time I will be writing from process point of view. Six sigma is a getting good recognition in the market and I am sure many professionals are asked questions on the same. So below is a quick revision which will give you a decent understanding of Six sigma from interview point of view.

 You can visit my website www.questpond.com for many such interview questions.

 

Project Management interview questions

(B) What is six sigma?


Sigma is a statistical measure of variation in a process. We say a process has achieved six sigma if the quality is 3.4 DPMO (Defect per Million opportunities). It’s a problem solving methodology that can be applied to a process to eliminate the root cause of defects and costs associated with the same.

Figure: - Six Sigma.


(I) Can you explain the different methodology for execution and design process in SIX sigma?


The main focus of SIX sigma is on reducing defects and variations in the processes.DMAIC and DMADV are the models used in most SIX sigma initiatives. DMADV is model for designing process while DMAIC is for improving the process.

DMADV model has the below five steps:-

• Define: - Determine the project goals and the requirements of customers (external and internal).
• Measure: - Assess customer needs and specifications.
• Analyze: - Examine process options to meet customer requirements.
• Design: - Develop the process to meet the customer requirements.
• Verify: - Check the design to ensure that it’s meeting customer requirements

DMAIC model has the below five steps:-

• Define the projects, the goals, and the deliverables to customers (internal and external). Describe and quantify both the defect and the expected improvement.
• Measure the current performance of the process. Validate data to make sure it is credible and set the baselines.
• Analyze and determine the root cause(s) of the defects. Narrow the causal factors to the vital few.
• Improve the process to eliminate defects. Optimize the vital few and their interrelationships.
• Control the performance of the process. Lock down the gains.




Figure: - Methodology in SIX Sigma

 

Figure: - DMAIC and DMADV


(I) What does executive leaders, champions, Master Black belt, green belts and black belts mean?


SIX sigma is not only about techniques, tools and statistics, but the main thing depends upon people. In SIX sigma there five key players:-

• Executive leaders
• Champions
• Master black belt
• Black belts
• Green belts
Let’s try to understand all the role of players step by step.

 

Executive leaders: - They are the main person who actually decides that we need to do SIX sigma. They promote it throughout organization and ensure commitment of the organization in SIX sigma. Executive leaders are the guys who are mainly either CEO or from the board of directors. So in short they are the guys who fund the SIX sigma initiative. They should believe that SIX sigma will improve the organization process and that they will succeed. They should be determined that they ensure resources get proper training on SIX sigma, understand how it will benefit the organization and track the metrics.

Champions: - Champion is a normally a senior manager of the company. He promotes SIX sigma mainly between the business users. He understand SIX sigma thoroughly , serves as a coach and mentor , selects project , decides objectives , dedicates resource to black belts and removes obstacles which come across black belt players. Historically Champions always fight for a cause. In SIX sigma they fight to remove black belt hurdles.

Master Black-Belt: - This role requires highest level of technical capability in SIX sigma. Normally organizations that are just starting up with SIX sigma will not have the same. So normally outsiders are recruited for the same. The main role of Master Black belt is to train, mentor and guide. He helps the executive leaders in selecting candidates, right project, teach the basic and train resources. They regularly meet with black belt and green belt training and mentor them.

Black-Belt: - Black belt leads a team on a selected project which has to be show cased for SIX sigma. They are mainly responsible to find out variations and see how these variations can be minimized. Mast black belt basically selects a project and train resources, but black belt are the guys who actually implement it. Black belt normally works in projects as team leads or project manager. They are central to SIX sigma as they are actually implementing SIX sigma in the organization.

Green Belt: - Green belt assist black belt in their functional areas. They are mainly in projects and work part time on SIX sigma implementation. They apply SIX sigma methodologies to solve problems and improve process at the bottom level. They have just enough knowledge of SIX sigma and they help to define the base of SIX sigma implementation in the organization. They assist black belt in SIX sigma implementation actually.

Figure: - SIX key players


(I) What are the different kinds of variations used in six sigma?


Variation is the basis of six sigma. It defines how much changes are happening in an output of a process. So if a process is improved then this should reduce variations. In six sigma we identify variations in the process, control them and reduce or eliminate defects. Now let’s understand how we can measure variations.

There are four basic ways of measuring variations Mean, Median, Mode and Range. Let’s understand each of these variations in more depth for better analysis.

Figure: - Different variations in Six sigma
 

Mean: - In mean the variations are measured and compared using math’s averaging techniques. For instance you can see the below figure which shows two weekly measures of how many computers are manufactured. So for that we have tracked two weeks one we have named as Week 1 and the other as Week 2. So to calculate variation by using mean we calculate the mean of week1 and week2. You can see from the calculations below we have got 5.083 for week and 2.85 for week2. So we have a variation of 2.23.


Figure: - Measuring variations by using Mean


Median: - Median value is a mid point in our range of data. Mid point can be found out using by finding the difference between highest and lowest value then divide it by two and finally add the lowest value to the same. For instance for the below figure in week1 we have 4 as the lowest value and 7 as the highest value. So first we subtract the lowest value from the highest value i.e. 7 -4. Then we divide it by two and add the lowest value. So for week1 the median is 5.5 and for week2 the median is 2.9. So the variation is 5.5 – 2.9.

 

Figure: - Median for calculating variations


Range: - Range is nothing but spread of value for a particular data range. In short it is the difference between highest and lowest values in particular data range. For instance you can see for recorded computer data of two week we have found out the range values by subtracting the highest value from the lowest.


Figure: - Range for calculating variations


Mode: - Mode is nothing but the most occurred values in a data range. For instance in our computer manufacturing data range 4 is the most occurred value in Week1 and 3 is the most occurred value in week 2. So the variation is 1 between these data ranges.

Figure: - Mode for calculating variations



(A) Can you explain the concept of standard deviation?


The most accurate method of quantifying variation is by using standard deviation. It indicates the degree of variation in a set of measurement or a process by measuring the average spread of data around the mean. It’s but complicated than the deviation process discussed in the previous question, but it does give accurate information.

Note: - To understand standard deviation we will be going through a bit of maths so please co-operate and keep your head cool. In the below steps we will go step by step and understand how we can implement standard deviation.

Below is the formula for Standard deviation. “σ“ symbol stands for standard deviation. X is the observed values; X (with the top bar) is the arithmetic mean and n is the number of observations. The formulae must be looking complicated by but let’s break up in to steps and understand it better.

 

Figure: - Standard deviation formulae


The first step is to calculate the mean. This can be calculated by adding all the observed values and dividing the same by the number of observed values.



Figure: - Step 1 Standard deviation


The second step is to subtract the average from each observation, square them and then sum them. Because we square them we will not get negative values. Below figure indicates the same in very detail manner.



Figure: - Step 2 Standard deviation



In the third step we divide the same with the number of observations as shown the figure.

 

Figure: - Step 3 Standard deviation


In the final step we take the square root which gives the standard deviation.

 

Figure: - Step 4 standard deviation


Note: - Below are some questions which we have not answered and left it as an exercise to the readers. We will definitely try to cover the same in the coming second edition.


(B) Can you explain the concept of fish bone/ Ishikawa diagram?


There are situations where we need to analyze what caused the failure or problem in a project. Fish bone or Ishikawa diagram is one of the important concept which can help you list down your root cause of the problem. Fish bone was conceptualized by Ishikawa, so in the honor of its inventor this concept was named as Ishikawa diagram. Inputs to conduct a fish bone diagram comes from discussion and brain storming with people who were involved in the project. Below figure shows how the structure of the Ishikawa diagram is.
Below is a sample fish bone diagram. The main bone is the problem which we need to address and to know what caused the failure. For instance the below fish bone is constructed to know what caused the project failure. To know this cause we have taken four main bones as inputs Finance, Process, People and Tools. For instance on the people front there are many resignations à this was caused because there was no job satisfaction à this was caused because the project was a maintenance project. In the same way causes are analyzed on the Tools front also. In tools à No tools were used in the project à because no resource had enough knowledge about the same à this happened because of lack of planning. In process front the process was adhoc àthis was because of tight dead lines à this was caused because marketing people over promised and did not negotiate properly with the end customer.

Now once the diagram is drawn the end bones of the fish bone signify the main cause of project failure. From the below diagram here’s a list:-

• No training was provided for the resources regarding tool.
• Marketing people over promised with customer which lead to tight dead lines.
• Resources resigned because it’s a maintenance project.

Figure: - Fish bone / Ishikawa diagram
 

(B) What is Pareto principle?


Pareto principle also paraphrased as 80/20 principle is simple effective problem tackling way in management. It says that 20% of your problems lead to other 80 % of problems. So rather than concentrating on the 80% of problem if you concentrate on 20% of problems you can save lot of trouble. So in Pareto you analyze the problems and only concentrate on 20% of your vital problems.

If you look at the above fish bone diagram we have discussed all the root problem is due to only three reasons:-
• No tools are used.
• No process is defines.
• Many resignations.

So if we tackle these problems we can solve all the other problems.

(A) Can you explain QFD?

(A) Can you explain FMEA?

(A) Can you explain X bar charts?

(A) Can you explain Flow charting and brain storming?

Other Interview question PDF's

Repost 0
Published by questpond.over-blog.com
write a comment
October 29 2010 6 29 /10 /October /2010 14:59

Asp.Net Interview Question Part 1
Get Interview tutorials and videos on .NET 3.5, 4.0, Pessimistic, Optimistic, Locking, SQL Server, CAS, Security, WCF, SharePoint, Azure, OOPS and many more on www.questpond.com

 

ASP. NET


(B) What’ is the sequence in which ASP.NET events are processed?

(B) In which event are the controls fully loaded?

(B) How does ASP.NET maintain state in between subsequent request?

(A) What is event bubbling?

(B) How do we assign page specific attributes?

(A) How do we ensure view state is not tampered?

(B) What is the use of @ Register directives?

(B) What is the use of Smart Navigation property?

(B) What is AppSetting Section in “Web.Config” file?

(B) Where is View State information stored?

(I) what is the use of @ Output Cache directive in ASP.NET.

(B) How can we create custom controls in ASP.NET?

(B) How many types of validation controls are provided by ASP.NET?

(B) Can you explain “AutoPostBack”?

(B) How can you enable automatic paging in Data Grid?

(B) What is the use of “GLOBAL.ASAX” file?

(B) What is the difference between “Web.config” and “Machine.Config”?

(B) What is a SESSION and APPLICATION object?

 

 

Introduction

In this section we will touch base on one of important concepts in ASP. Net. You can download my .NET Interview Question PDF from http://www.questpond.com/SampleDotNetInterviewQuestionBook.zip .

I have also put all these design patterns in a video format and uploaded on http://www.questpond.com/FreeDesign1.htm . You can visit http://www.questpond.com and download the complete architecture interview questions PDF which covers SOA , UML , Design patterns , Togaf , OOPs etc.

Happy job hunting......

(B) What’ is the sequence in which ASP.NET events are processed?

Following is the sequence in which the events occur:-
• Page_Init.
• Page Load.
• Control events
• Page- Unload event.
Page_init event only occurs when first time the page is started, but Page Load occurs in subsequent request of the page.

(B) In which event are the controls fully loaded?


Page load event guarantees that all controls are fully loaded. Controls are also accessed in Page_Init events but you will see that view state is not fully loaded during this event.5
(B) How can we identify that the Page is Post Back?
Page object has an “IsPostBack” property, which can be checked to know that is the page posted back.

(B) How does ASP.NET maintain state in between subsequent request?


Refer caching chapter.

(A) What is event bubbling?


Server controls like Data grid, Data List, and Repeater can have other child controls inside them. Example Data Grid can have combo box inside data grid. These child control do not raise there events by themselves, rather they pass the event to the container parent (which can be a data grid, data list, repeater), which passed to the page as “ItemCommand” event. As the child control send events to parent it is termed as event bubbling.

(B) How do we assign page specific attributes?

Page attributes are specified using the @Page directive.

(A) How do we ensure view state is not tampered?


Using the @Page directive and setting ‘EnableViewStateMac’ property to True.

(B) What is the use of @ Register directives?


@Register directive informs the compiler of any custom server control added to the page.

(B) What is the use of Smart Navigation property?


It’s a feature provided by ASP. NET to prevent flickering and redrawing when the page is posted back.

Note:- This is only supported for IE browser. Project is who have browser compatibility as requirements have to think some other ways of avoiding flickering.

(B) What is AppSetting Section in “Web.Config” file?


Web.config file defines configuration for a web project. Using “AppSetting” section, we can define user-defined values. Example below defined is “Connection String” section, which will be used through out the project for database connection.

<Configuration>
<appSettings>
<add key="ConnectionString" value="server=xyz;pwd=www;database=testing" />
</appSettings>

(B) Where is View State information stored?


In HTML Hidden Fields.

(I) what is the use of @ Output Cache directive in ASP.NET.


It is used for caching. See more for Caching chapter.

(B) How can we create custom controls in ASP.NET?


User controls are created using .ASCX in ASP.NET. After .ASCX file is created you need to two things in order that the ASCX can be used in project:.


• Register the ASCX control in page using the <percentage@ Register directive.Example


<%@ Register tag prefix="Accounting" Tag name="footer" Src="Footer.ascx" %>


• Now to use the above accounting footer in page you can use the below directive.


<Accounting: footer runat="server" />

(B) How many types of validation controls are provided by ASP.NET?


There are six main types of validation controls:-

RequiredFieldValidator

It checks whether the control have any value. It is used when you want the control should not be empty.

RangeValidator

It checks if the value in validated control is in that specific range. Example TxtCustomerCode should not be more than eight lengths.

CompareValidator

It checks that the value in controls should match some specific value. Example Textbox TxtPie should be equal to 3.14.

RegularExpressionValidator

When we want the control, value should match with a specific regular expression.

CustomValidator

It is used to define User Defined validation.
Validation Summary
It displays summary of all current validation errors on an ASP.NET page.

Note: - It is rare that some one will ask step by step all the validation controls. Rather they will ask for what type of validation which validator will be used. Example in one of the interviews i was asked how will you display summary of all errors in the validation control...just uttered one word Validation summary.

(B) Can you explain “AutoPostBack”?


If we want the control to automatically post back in case of any event, we will need to check this attribute as true. Example on a Combo Box change we need to send the event immediately to the server side then set the “AutoPostBack” attribute to true.

(B) How can you enable automatic paging in Data Grid?


Following are the points to be done in order to enable paging in Data grid:-
• Set the “Allow Paging” to true.
• In PageIndexChanged event set the current page index clicked.

Note: - The answers are very short, if you have implemented practically its just a revision. If you are fresher, just make sample code using Datagrid and try to implement this functionality.

(B) What is the use of “GLOBAL.ASAX” file?


It allows to execute ASP.NET application level events and setting application-level variables.

(B) What is the difference between “Web.config” and “Machine.Config”?


“Web.config” files apply settings to each web application, while “Machine.config” file apply settings to all ASP.NET applications.

(B) What is a SESSION and APPLICATION object?


Session object store information between HTTP requests for a particular user, while application object are global across users.

Other Interview question PDF's

.NET Interview Question PDF

Project Management interview questions

Download Networking Interview Questions

Download Software Testing Interview Questions

Download Sql Server Interview Questions

Download C# and ASP .Net Projects

Download Java Interview Questions

Download Software Architecture Interview Questions

Download Excel Question and Answers

 

 

Repost 0
Published by questpond.over-blog.com
write a comment
October 28 2010 5 28 /10 /October /2010 16:36

Ado Dot Net Interview Question Part 1
Get Interview tutorials and videos on .NET 3.5, 4.0, Pessimistic, Optimistic, Locking, SQL Server, CAS, Security, WCF, SharePoint, Azure, OOPS and many more on www.questpond.com


(B) What is the namespace in which .NET has the data functionality class?

(B) Can you give an overview of ADO.NET architecture?

(B) What are the two fundamental objects in ADO.NET?

(B) What is difference between dataset and data reader?

(I) What are major difference between classic ADO and ADO.NET?

(B) What is the use of connection object?

(B) What is the use of command objects?

(B)What is the use of data adapter?

(B)What are basic methods of Data adapter?

(B) What is Dataset object?

(B) What are the various objects in Dataset?

(B) How can we connect to Microsoft Access, FoxPro, and Oracle etc?

(B) How do we connect to SQL SERVER, which namespace do we use?

Introduction

In this section we will touch base on one of important concepts in .Net Caching. You can download my .NET Interview Question PDF from http://www.questpond.com/SampleDotNetInterviewQuestionBook.zip .

I have also put all these design patterns in a video format and uploaded on http://www.questpond.com/FreeDesign1.htm . You can visit http://www.questpond.com and download the complete architecture interview questions PDF which covers SOA , UML , Design patterns , Togaf , OOPs etc.

Happy job hunting......

(B) What is the namespace in which .NET has the data functionality class?

Following are the namespaces provided by .NET for data management:-

 System. Data  


This contains the basic objects used for accessing and storing relational data, such as DataSet, DataTable, and Data Relation. Each of these is independent of the type of data source and the way we connect to it.


System.Data.OleDB



It contains the objects that we use to connect to a data source via an OLE-DB provider, such as OleDbConnection, OleDbCommand, etc. These objects inherit from the common base classes, and so have the same properties, methods, and events as the SqlClient equivalents.

System.Data.SqlClient:



This contains the objects that we use to connect to a data source via the Tabular Data Stream (TDS) interface of Microsoft SQL Server (only). This can generally provide better performance as it removes some of the intermediate layers required by an OLE-DB connection.

System.XML



This Contains the basic objects required to create, read, store, write, and manipulate XML documents according to W3C recommendations.

(B) Can you give an overview of ADO.NET architecture?


The most important section in ADO.NET architecture is “Data Provider”. Data Provider provides access to data source (SQL SERVER, ACCESS, ORACLE).In short it provides object to achieve functionalities like opening and closing connection, retrieve data, and update data. In the below figure, you can see the four main sections of a data provider:-

• Connection
• Command object (This is the responsible object to use stored procedures)
• Data Adapter (This object acts as a bridge between data store and dataset)
• Data reader (This object reads data from data store in forward only mode).
• Dataset object represents disconnected and cached data. If you see the diagram, it is not in direct connection with the data store (SQL SERVER,

ORACLE etc) rather it talks with Data adapter, who is responsible for filling the dataset. Dataset can have one or more Data table and relations.

Figure: - 9.1 ADO.NET Architecture


• Data View” object is used to sort and filter data in Data table.



Note:- This is one of the favorite questions in .NET. Just paste the picture in your mind and during interview try to refer that image.

(B) What are the two fundamental objects in ADO.NET?


Data reader and Dataset are the two fundamental objects in ADO.NET.


(B) What is difference between dataset and data reader?


Following are some major differences between dataset and data reader:-
• Data Reader provides forward-only and read-only access to data, while the Dataset object can hold more than one table (in other words more than one row set) from the same data source as well as the relationships between them.
• Dataset is a disconnected architecture while data reader is connected architecture.
• Dataset can persist contents while data reader cannot persist contents, they are forward only.


(I) What are major difference between classic ADO and ADO.NET?


Following are some major differences between both :-
• In ADO we have recordset and in ADO.NET we have dataset.• In recordset we can only have one table. If we want to accommodate more than one tables we need to do inner join and fill the recordset. Dataset can have multiple tables.
• All data persist in XML as compared to classic ADO where data persisted in Binary format also.

(B) What is the use of connection object?


They are used to connect a data to a Command object.
• An OleDbConnection object is used with an OLE-DB provider
• A SqlConnection object uses Tabular Data Services (TDS) with MS SQL Server

(B) What is the use of command objects?


They are used to connect connection object to Data reader or dataset. Following are the methods provided by command object:-

• ExecuteNonQuery: -

Executes the command defined in the Command Text property against the connection defined in the Connection property for a query that does not return any row (an UPDATE, DELETE, or INSERT). Returns an Integer indicating the number of rows affected by the query.

• ExecuteReader: -

Executes the command defined in the Command Text property against the connection defined in the Connection property. Returns a "reader" object that is connected to the resulting row set within the database, allowing the rows to be retrieved.

• ExecuteScalar: -

Executes the command defined in the Command Text property against the connection defined in the Connection property. Returns only single value (effectively the first column of the first row of the resulting row set any other returned columns and rows are discarded. It is fast and efficient when only a "singleton" value is required

(B)What is the use of data adapter?


These objects connect one or more Command objects to a Dataset object. They provide logic that would get data from the data store and populates the tables in the Dataset, or pushes the changes in the Dataset back into the data store.
• An OleDbDataAdapter object is used with an OLE-DB provider
• A SqlDataAdapter object uses Tabular Data Services with MS SQL Server.

(B)What are basic methods of Data adapter?


There are three most commonly used methods of Data adapter:-

Fill: -

Executes the Select Command to fill the Dataset object with data from the data source. It an also be used to update (refresh) an existing table in a Dataset with changes made to the data in the original data source if there is a primary key in the table in the Dataset.

FillSchema :-

Uses the SelectCommand to extract just the schema for a table from the data source, and creates an empty table in the DataSet object with all the corresponding constraints.Update:- Calls the respective InsertCommand, UpdateCommand, or DeleteCommand for each inserted, updated,or deleted row in the DataSet so as to update the original data source with the changes made to the content of the DataSet. This is a little like the UpdateBatch method provided by the ADO Recordset object, but in the DataSet it can be used to update more than one table.

(B) What is Dataset object?


The Dataset provides the basis for disconnected storage and manipulation of relational data. We fill it from a data store, work with it while disconnected from that data store, then reconnect and flush changes back to the data store if required.

(B) What are the various objects in Dataset?


Dataset has a collection of Data Table object within the Tables collection. Each Data Table object contains a collection of Data Row objects and a collection of Data Column objects. There are also collections for the primary keys, constraints, and default values used in this table, which is called as constraint collection, and the parent and child relationships between the tables. Finally, there is a Default View object for each table. This is used to create a Data View object based on the table, so that the data can be searched, filtered, or otherwise manipulated while displaying the data.

Note: - Look back again to the main diagram for ADO.NET architecture for visualizing this answer in pictorial form.

(B) How can we connect to Microsoft Access, FoxPro, and Oracle etc?


Microsoft provides System.Data.OleDb namespace to communicate with databases like success , Oracle etc. In short, any OLE DB-Compliant database can be connected using System.Data.OldDb namespace.

Note :- Small sample of OLEDB is provided in “WindowsAppOleDb” which uses “Nwind.mdb” in bin directory to display data in Listbox.


Private Sub loadData()
Dim strPath As String
strPath = AppDomain.CurrentDomain.BaseDirectory
Dim objOLEDBCon As New OleDbConnection(“Provider=Microsoft.Jet.OLEDB.4.0;Data Source =” & strPath & “Nwind.mdb”)
Dim objOLEDBCommand As OleDbCommand
Dim objOLEDBReader As OleDbDataReader
Try

objOLEDBCommand = New OleDbCommand(“Select FirstName from Employees”)
objOLEDBCon.Open()
objOLEDBCommand.Connection = objOLEDBCon

objOLEDBReader = objOLEDBCommand.ExecuteReader()
Do While objOLEDBReader.Read()
lstNorthwinds.Items.Add(objOLEDBReader.GetString(0))
Loop
Catch ex As Exception
Throw ex
Finally
objOLEDBCon.Close()
End Try

End Sub



The main heart is the “Load data ()” method which actually loads the data in list box.

Note:- This source code has the connectionstring hard coded in the program itself which is not a good programming practice. For windows application the best place to store connectionstring is “App.config”. Also note that “AppDomain.CurrentDomain.BaseDirectory” function gives the current path of the running exe which is “BIN” and the MDB file is in that directory. Also note that the final block which executes irrespective that there is error or not. Thus ensuring that all the connection to the datastore is freed. Its best practice to put all clean up statements in finally block thus ensuring that the resources are deallocated properly.

(B) How do we connect to SQL SERVER, which namespace do we use?


Below is the code, after the code we will try to understand the same in a more detailed manner. For this sample, we will also need a SQL Table setup, which I have imported, using the DTS wizard.

Private Sub LoadData()
‘ note :- with and end with makes your code more readable
Dim strConnectionString As String
Dim objConnection As New SqlConnection
Dim objCommand As New SqlCommand
Dim objReader As SqlDataReader
Try
‘ this gets the connectionstring from the app.config file.
‘ note if this gives error see where the MDB file is stored in your pc and point to thastrConnectionString = AppSettings.Item(“ConnectionString”)
‘ take the connectiostring and initialize the connection object
With objConnection
.ConnectionString = strConnectionString
.Open()
End With
objCommand = New SqlCommand(“Select FirstName from Employees”)
With objCommand
.Connection = objConnection
objReader = .ExecuteReader()
End With
‘ looping through the reader to fill the list box
Do While objReader.Read()
lstData.Items.Add(objReader.Item(“FirstName”))
Loop
Catch ex As Exception
Throw ex
Finally
objConnection.Close()
End Try


<appSettings>
<add key=”Connectionstring” value=”Server=ERMBOM1-IT2;User ID=sa;Database=Employees”/>
</appSettings>

Note:- The above code is provided in CD in folder WindowsAppSqlClient”. Comments in the code do explain a lot but we will again iterate through the whole code later. “LoadData” is the main method which loads the data from SQL SERVER. Before running this code you have to install SQL SERVER in your machine. As we are dealing with SQLCLIENT we need to setup database in SQL SERVER. For this sample I have imported access “Nwind.mdb” in “SampleAccessDatabase” folder in CD in to SQlSERVER. Depending on computer you will also have to change the connectionstring in Web.config file.

For setting up the sample SQL table, we can use the DTS import wizard to import the table. See the below figure which is using data source as Microsoft Access. While importing the database author had, give the database name as “Employees”.

Figure: - 9.2 Loading “Nwind.mdb” in SQL SERVER for the sample

Figure :- 9.3 Load only the Employee table.

To make it simple we will only import the employee table as that is the only thing needed in our sample code.

Figure: - 9.4 View of loaded Employee table



Now from interview point of view definitely you are not going to say the whole source code, which is given in the book. Interviewer expects only the broader answer of what are the steps needed to connect to SQL SERVER. For fundamental sake author has explained the whole source code. In short, you have to explain the “Load Data” method in broader way. Following are the steps to connect to SQL SERVER:-

• First imports the namespace “System.Data.SqlClient”.
• Create a connection object as shown in “Load Data” method.

With objConnection
.Connection String = strConnectionString
.Open ()
End With


• Create the command object with the SQL. Also, assign the created connection object to command object and execute the reader.
ObjCommand = New SqlCommand (“Select First Name from Employees”)

With objCommand
.Connection = objConnection
Breeder = .Execute Reader ()
End With

• Finally loop through the reader and fill the list box. If old VB programmers are expecting the move next command it is replaced by Read () which returns true if there is any data to be read. If the .Read () return is false that means that it’s end of data reader and there is no more data to be read.



Do while objReader.Read ()
lstData.Items.Add (objReader.Item (“First Name”))
Loop

• Do not forget to close the connection object.

Note:- In “LoadData” you will see that connectionstring is stored in Web.config file and is loaded using “AppSettings.Item(“ConnectionString”)”. While running this sample live on your database do not forget to change this connectionstring accordingly to your machine name and SQL SERVER or else the source code will not run.

Other Interview question PDF's

.NET Interview Question PDF

Project Management interview questions

Download Networking Interview Questions

Download Software Testing Interview Questions

Download Sql Server Interview Questions

Download C# and ASP .Net Projects

Download Java Interview Questions

Download Software Architecture Interview Questions

Download Excel Question and Answers

 

 

Repost 0
Published by questpond.over-blog.com
write a comment
October 28 2010 5 28 /10 /October /2010 16:19

Caching Interview Questions Part 1
Get Interview tutorials and videos on .NET 3.5, 4.0, Caching, SQL Server, CAS, Security, WCF, SharePoint, Azure, OOPS and many more on www.questpond.com

 


(B) What is an application object?

(I) what is the difference between Cache object and application object?

(I) How can get access to cache object?

(A) What are dependencies in cache and types of dependencies?

(A) Can you show a simple code showing file dependency in cache?

(A) What is Cache Callback in Cache?

(A) What is scavenging?

(B) What are different types of caching using cache object of ASP. NET?

(B) How can you cache different version of same page using ASP. NET cache object?

(A) How will implement Page Fragment Caching?

(B) Can you compare ASP. NET sessions with classic ASP?

(B) Which are the various modes of storing ASP.NET session?

(A) Is Session End event supported in all session modes?

(A) What are the steps to configure State Server Mode?

(A) What are the steps to configure State Server Mode?

(A) What are the steps to configure SQL Server mode?

(A) Where do you specify session state mode in ASP.NET?

(B) What are the other ways you can maintain state?

(B) What are benefits and Limitation of using Hidden fields?

(B) What is View State?

(A) Does the performance for view state vary according to User controls?

(B) What are benefits and Limitation of using View state for state management?

(B) How can you use Hidden frames to cache client data ?

(I) What are benefits and limitations of using Hidden frames?

(I) What are benefits and limitations of using Cookies?

(I) What is Query String and What are benefits and limitations of using Query Strings?

(I) How do we access view state value of this page in the next page ?

(I) Can we post and access view state in another application?

(I) What is SQL Cache Dependency in ASP.NET 2.0?

Introduction

 

In this section we will touch base on one of important concepts in .Net Caching. You can download my .NET Interview Question PDF from http://www.questpond.com/SampleDotNetInterviewQuestionBook.zip .

I have also put all these design patterns in a video format and uploaded on http://www.questpond.com/FreeDesign1.htm . You can visit http://www.questpond.com and download the complete architecture interview questions PDF which covers SOA , UML , Design patterns , Togaf , OOPs etc.

Happy job hunting......

(B) What is an application object?


Application object can be used in situation where we want data to be shared across users globally.

(I) what is the difference between Cache object and application object?


The main difference between the Cache and Application objects is that the Cache object provides cache-specific features, such as dependencies and expiration policies.

(I) How can get access to cache object?


The Cache object is defined in the ‘System.Web.Caching’ namespace. You can get a reference to the Cache object by using the Cache property of the Http Context class in the ‘System.Web’ namespace or by using the Cache property of the Page object.

(A) What are dependencies in cache and types of dependencies?


When you add an item to the cache, you can define dependency relationships that can force that item to be removed from the cache under specific activities of dependencies. Example if the cache object is dependent on file and when the file data changes you want the cache object to be update. Following are the supported dependency:-
• File dependency: - Allows you to invalidate a specific cache item when a disk based file or files change.
• Time-based expiration: - Allows you to invalidate a specific cache item depending on predefined time.
• Key dependency:- Allows you to invalidate a specific cache item depending when another cached item changes.

(A) Can you show a simple code showing file dependency in cache?

Partial Class Default_aspx

Public Sub display Announcement()
Dim announcement As String

If Cache(“announcement”) Is Nothing Then
Dim file As New _
System.IO.StreamReader _
(Server.MapPath(“announcement.txt”))
announcement = file.ReadToEnd
file. Close()
Dim depends As New _
System.Web.Caching.CacheDependency _
(Server.MapPath(“announcement.txt”))
Cache.Insert(“announcement”, announcement, depends)
End If
Response.Write(CType(Cache(“announcement”), String))
End Sub

Private Sub Page_Init(ByVal sender As Object, By Val e As System.EventArgs) Handles Me. nit
display Announcement()
End Sub
End Class

Note:- Above source code can be obtained from CD in “CacheSample” folder.”Announcement.txt” is in the same folder which you can play around to see the results.

 Above given method display Announcement() displays banner text from Announcement.txt file which is lying in application path of the web directory. Above method, first checks whether the Cache object is nothing, if the cache object is nothing then it moves further to load the cache data from the file. Whenever the file data changes the cache object is removed and set to nothing.

(A) What is Cache Callback in Cache?


Cache object is dependent on its dependencies example file based, time based etc...Cache items remove the object when cache dependencies change.ASP.NET provides capability to execute a callback method when that item is removed from cache.

(A) What is scavenging?


When server running your ASP. NET application runs low on memory resources, items are removed from cache depending on cache item priority. Cache item priority is set when you add item to cache. By setting the cache item priority controls, the items scavenging are removed according to priority.

(B) What are different types of caching using cache object of ASP. NET?


You can use two types of output caching to cache information that is to be transmitted to and displayed in a Web browser:
• Page Output Caching
Page output caching adds the response of page to cache object. Later when page is requested page is displayed from cache rather than creating the page object and displaying it. Page output caching is good if the site is fairly static.
• Page Fragment Caching
If parts of the page are changing, you can wrap the static sections as user controls and cache the user controls using page fragment caching.

(B) How can you cache different version of same page using ASP. NET cache object?


Output cache functionality is achieved by using “OutputCache” attribute on ASP. NET page header. Below is the syntax

<%@ Output Cache Duration="20" Location="Server" Vary By Param="state" Vary By Custom="minor version" Vary By Header="Accept-Language"%>

 • Vary By Param: - Caches different version depending on input parameters send through HTTP POST/GET.
• Vary By Header: - Caches different version depending on the contents of the page header.
• Vary By Custom: -Lets you customize the way the cache handles page variations by declaring the attribute and overriding the Get Vary By Custom String handler.
• Vary By Control: -Caches different versions of a user control based on the value of properties of ASP objects in the control.

(A) How will implement Page Fragment Caching?


Page fragment caching involves the caching of a fragment of the page, rather than the entire page. When portions of the page are need to be dynamically created for each user request this is best method as compared to page caching. You can wrap Web Forms user control and cache the control so that these portions of the page do not need to be recreated each time.

(B) Can you compare ASP. NET sessions with classic ASP?


ASP. NET session caches per user session state. It basically uses “HttpSessionState” class.
Following are the limitations in classic ASP sessions:-
• ASP session state is dependent on IIS process very heavily. So if IIS restarts ASP session variables are also recycled.ASP.NET session can be independent of the hosting environment thus ASP. NET session can be maintained even if IIS reboots.
• ASP session state has no inherent solution to work with Web Farms.ASP.NET session can be stored in state server and SQL SERVER which can support multiple server.
• ASP session only functions when browser supports cookies.ASP.NET session can be used with browser side cookies or independent of it.

(B) Which are the various modes of storing ASP.NET session?


In Proc: - In this mode Session, state is stored in the memory space of the Aspnet_wp.exe process. This is the default setting. If the IIS reboots or web application restarts then session state is lost.
State Server:-In this mode Session state is serialized and stored in a separate process (Aspnet_state.exe); therefore, the state can be stored on a separate computer (a state server).
SQL SERVER: - In this mode Session, state is serialized and stored in a SQL Server database.
Session state can be specified in <session State> element of application configuration file. Using State Server and SQL SERVER session state can be shared across web farms but note this comes at speed cost as ASP. NET needs to serialize and desterilize data over network repeatedly.

(A) Is Session End event supported in all session modes?


Session End event occurs only in “Inproc mode”. “State Server” and “SQL SERVER” do not have Session End event.

(A) What are the steps to configure State Server Mode?


Following are the things to remember so that State Server Mode works properly:-
• State Server mode session data is stored in a different process so you must ensure that your objects are serializable.
• <machine Key> elements in Web.config should be identical across all servers. So this ensures that encryption format is same across all computers.
• IIS meta base (\LM\W3SVC\2) must be identical across all servers in that farm.

(A) What are the steps to configure SQL Server mode?


Following are the things to remember so that SQL SERVER Mode works properly:-
• SQL SERVER mode session data is stored in a different process so you must ensure that your objects are serializable.
• IIS met abase (\LM\W3SVC\2) must be identical across all servers in that farm.
• By default Session objects are stored in “Temped”, you can configure it store outside “TempDB” by running Microsoft provided SQL script.

Note:- “TempDB” database is re-created after SQL SERVER computer reboot.If you want to maintain session state with every reboot best is to run SQL Script and store session objects outside “TempDB” database.

(A) Where do you specify session state mode in ASP.NET?


<sessionState mode=”SQLServer”
stateConnectionString=”tcpip=192.168.1.1:42424"
sqlConnectionString=”data source=192.168.1.1; Integrated Security=SSPI”
cookieless=”false”
timeout=”20"
/>
Above is sample session state mode specified for SQL SERVER.

(B) What are the other ways you can maintain state?


Other than session variables, you can use the following technique to store state:
• Hidden fields
• View state
• Hidden frames
• Cookies
• Query strings

(B) What are benefits and Limitation of using Hidden fields?


Following are the benefits of using Hidden fields:-
• They are simple to implement.
• As data is cached on client side, they work with Web Farms.
• All browsers support hidden field.
• No server resources are required.
Following are limitations of Hidden field:-
• They can be tampered creating a security hole.
• Page performance decreases if you store large data, as the data are stored in pages itself.
• Hidden fields do not support rich structures as HTML hidden fields are only single valued. Then you have to work around with delimiters etc to handle complex structures.
Below is how you will actually implement hidden field in a project

<input id="Hidden Value" type="hidden" value="Initial Value" run at="server" NAME="Hidden Value">

(B) What is View State?


View state is a built-in structure for automatically retaining values amongst the multiple requests for the same page. The view state is internally maintained as a hidden field on the page but is hashed, providing greater security than developer-implemented hidden fields do.

 

(A) Does the performance for view state vary according to User controls?


Performance of view state varies depending on the type of server control to which it is applied. Label, Text Box, Check Box, Radio Button, and Hyper Link are server controls that perform well with View State. Drop Down List, List Box, Data Grid, and Data List suffer from poor performance because of their size and the large amounts of data making roundtrips to the server.

(B) What are benefits and Limitation of using View state for state management?


Following are the benefits of using View state:-
• No server resources are required because state is in a structure in the page code.
• Simplicity.
• States are retained automatically.
• The values in view state are hashed, compressed, and encoded, thus representing a higher state of security than hidden fields.
• View state is good for caching data in Web frame configurations because the data is cached on the client.
Following are limitation of using View state:-
• Page loading and posting performance decreases when large values are stored because view state is stored in the page.
• Although view state stores data in a hashed format, it can still be tampered because it is stored in a hidden field on the page. The information in

the hidden field can also be seen if the page output source is viewed directly, creating a potential security risk.
Below is sample of storing values in view state.

this. View State ["Enter Time"] = Date Time. Now. To String();

(B) How can you use Hidden frames to cache client data ?


This technique is implemented by creating a Hidden frame in page which will contain your data to be cached.
<FRAMESET cols="100%,*,*">
<FRAMESET rows="100%">
<FRAME src="data_of_frame1.html"></FRAMESET>
<FRAME src="data_of_hidden_frame. html">
<FRAME src="data_of_hidden_frame.html" frame border="0" no resize scrolling="yes">
</FRAMESET>

Above is a sample of hidden frames where the first frame “data_of_frame1.html” is visible and the remaining frames are hidden by giving whole col section to first frame. 100 % is allocated to first frame and remaining frames thus remain hidden.

(I) What are benefits and limitations of using Hidden frames?


Following are the benefits of using hidden frames:
• You can cache more than one data field.
• The ability to cache and access data items stored in different hidden forms.
• The ability to access JS crept ® variable values stored in different frames if they come from the same site.
The limitations of using hidden frames are:
• Hidden frames are not supported on all browsers.
• Hidden frames data can be tampered thus creating security hole.

(I) What are benefits and limitations of using Cookies?


Following are benefits of using cookies for state management:-
• No server resources are required as they are stored in client.
• They are light weight and simple to use

Following are limitation of using cookies:-
• Most browsers place a 4096-byte limit on the size of a cookie, although support for 8192-byte cookies is becoming more common in the new

browser and client-device versions available today.
• Some users disable their browser or client device’s ability to receive cookies, thereby limiting the use of cookies.
• Cookies can be tampered and thus creating a security hole.
• Cookies can expire thus leading to inconsistency.
Below is sample code of implementing cookies

Request. Cookies. Add (New Http Cookie (“name”, “user1”))

(I) What is Query String and What are benefits and limitations of using Query Strings?


A query string is information sent to the server appended to the end of a page URL.

Following are the benefits of using query string for state management:-
• No server resources are required. The query string containing in the HTTP requests for a specific URL.
• All browsers support query strings.

Following are limitations of query string:-
• Query string data is directly visible to user thus leading to security problems.-
• Most browsers and client devices impose a 255-character limit on URL length.
Below is a sample “Login” query string passed in URL http://www.querystring.com/login.asp?login=testing.
This query string data can then be requested later by using Request.QueryString(“login”).

(I) What is Absolute and Sliding expiration?


Absolute Expiration allows you to specify the duration of the cache, starting from the time the cache is activated. The following example shows that the cache has a cache dependency specified, as well as an expiration time of one minute.

Cache. Insert ("announcement", announcement, depends, _
DateTime.Now.AddMinutes(1), Nothing)

Sliding Expiration specifies that the cache will expire if a request is not made within a specified duration. Sliding expiration policy is useful whenever you have a large number of items that need to be cached, because this policy enables you to keep only the most frequently accessed items in memory. For example, the following code specifies that the cache will have a sliding duration of one minute. If a request is made 59 seconds after the cache is accessed, the validity of the cache would be reset to another minute:

Cache.Insert("announcement", announcement, depends, _
Date Time. Max Value, _
TimeSpan.FromMinutes(1))

(I) What is cross page posting?


Note :- This is a new feature in ASP. NET 2.0

 By default, button controls in ASP. NET pages post back to the same page that contains the button, where you can write an event handler for the post. In most cases this is the desired behavior, but occasionally you will also want to be able to post to another page in your application. The Server. Transfer method can be used to move between pages, however the URL does not change. Instead, the cross page-posting feature in ASP .NET 2.0 allows you to fire a normal post back to a different page in the application. In the target page, you can then access the values of server controls in the source page that initiated the post back.
To use cross page posting, you can set the PostBackUrl property of a Button, Link Button or Image Button control, which specifies the target page. In the target page, you can then access the Previous Page property to retrieve values from the source page. By default, the Previous Page property is of type Page, so you must access controls using the Find Control method. You can also enable strongly-typed access to the source page by setting the @Previous Page Type directive in the target page to the virtual path or Type name of the source page.
Here is a systematic guide for implementing the cross-page post back using controls that implement the I Button Control interface.
• Create a Web Form and insert a Button control on it using the VS .NET designer.
• Set the button's PostBackUrl property to the Web Form you want to post back. For instance in this case it is "nextpage.aspx"

<asp: Button ID="Button1" run at="server"
PostBackUrl="~/nextpage.aspx" Text="Post to next page" />


When the PostBackUrl property of the I Button Control is set, the ASP .NET framework binds the corresponding HTML element to new JavaScript function named Web Form _Do Post Back With Options. The corresponding HTML rendered by the ASP .NET 2.0 will look like this:

<input type="submit" name="Button1" value="Post to Page 2" on click="java script: Web Form_ Do Post Back With Options (new Web Form_ Post Back Options("Button1", ",false”,"Page2.aspx", false, false))" id="Button1" />

(I) How do we access view state value of this page in the next page ?


View state is page specific; it contains information about controls embedded on the particular page. ASP.NET 2.0 resolves this by embedding a hidden input field name, __POST BACK. This field is embedded only when there is an IButtonControl on the page and its PostBackUrl property is set to a non-null value. This field contains the view state information of the poster page. To access the view state of the poster page, you can use the new Previous Page property of the page:

Page poster = this. Previous Page;

 Then you can find any control from the previous page and read its state:

Label poster Label = poster. find Control ("my Label");
string lbl = poster Label. Text;

This cross-page post back feature also solves the problem of posting a Form to multiple pages, because each control, in theory, can point to different post back URL.

(I) Can we post and access view state in another application?


You can post back to any page and pages in another application, too. However, if you are posting pages to another application, the PreviousPage property will return null. This is a significant restriction, as it means that if you want to use the view state, you are confined, for example, posting to pages in the same virtual directory. Even so, this is a highly acceptable addition to the functionality of ASP.NET.

(I) What is SQL Cache Dependency in ASP.NET 2.0?


SQL cache dependencies is a new feature in ASP.NET 2.0 which can automatically invalidate a cached data object (such as a Dataset) when the related data is modified in the database. So for instance if you have a dataset, which is tied up to, a database tables any changes in the database table will invalidate the cached data object which can be a dataset or a data source.

Other Interview question PDF's

.NET Interview Question PDF

 

Project Management interview questions

Download Networking Interview Questions

Download Software Testing Interview Questions

Download Sql Server Interview Questions

Download C# and ASP .Net Projects

Download Java Interview Questions

Download Software Architecture Interview Questions


 

Repost 0
Published by questpond.over-blog.com
write a comment
October 28 2010 5 28 /10 /October /2010 16:17

Get Interview tutorials and videos on .NET 3.5, 4.0, Pessimistic, Optimistic, Locking, SQL Server, CAS, Security, WCF, SharePoint, Azure, OOPS and many more on www.questpond.com


(I) How do we enable SQL Cache Dependency in ASP.NET 2.0?

(I) What is Post Cache substitution?

(I) Why do we need methods to be static for Post Cache substitution?

 

Introduction

 

In this section we will touch base on one of important concepts in .Net Caching. You can download my .NET Interview Question PDF from SampleDotNetInterviewQuestionBook .

I have also put all these design patterns in a video format and uploaded on http://www.questpond.com/FreeDesign1.htm . You can visit http://www.questpond.com and download the complete architecture interview questions PDF which covers SOA , UML , Design patterns , Togaf , OOPs etc.

Happy job hunting......

(I) How do we enable SQL Cache Dependency in ASP.NET 2.0?


Below are the broader steps to enable a SQL Cache Dependency:-
• Enable notifications for the database.
• Enable notifications for individual tables.
• Enable ASP.NET polling using “web.config” file
• Finally use the Cache dependency object in your ASP.NET code
Enable notifications for the database.
Before you can use SQL Server cache invalidation, you need to enable notifications for the database. This task is performed with the aspnet_regsql.exe command-line utility, which is located in the c:\[WinDir]\Microsoft.NET\Framework\[Version] directory.
aspnet_regsql -ed -E -d Northwind


-ed :- command-line switch
-E: - Use trusted connection
-S: - Specify server name it other than the current computer you are working on
-d: - Database Name


So now, let us try to understand what happens in the database because of “aspnet_regsql.exe”. After we execute the “aspnet_regsql -ed -E -d Northwind” command you will see one new table and four new stored procedures created.

 

 

Figure 5.1: - SQL Cache table created for notification

 

Essentially, when a change takes place, a record is written in this table. The SQL Server polling queries this table for changes.

 

Figure 5.2: - New stored procedures created

 


Just to make brief run of what the stored procedures do.


“AspNet_SqlCacheRegisterTableStoredProcedure” :- This stored procedure sets a table to support notifications. This process works by adding a notification trigger to the table, which will fire when any row is inserted, deleted, or updated.


“AspNet_SqlCacheUnRegisterTableStoredProcedure”:- This stored procedure takes a registered table and removes the notification trigger so that notifications won't be generated.


“AspNet_SqlCacheUpdateChangeIdStoredProcedure”:- The notification trigger calls this stored procedure to update the AspNet_SqlCacheTablesFor ChangeNotification table, thereby indicating that the table has changed.
Asp Net_Sql Cache Query Registered Tables Stored Procedure:- This extracts just the table names from the AspNet_SqlCacheTablesForChangeNotification table. It is used to get a quick look at all the registered tables.
AspNet_SqlCachePollingStoredProcedure:- This will get the list of changes from the AspNet_SqlCacheTablesForChangeNotification table. It is used to perform polling.

 

Enabling notification for individual tables

 
Once the necessary stored procedure and tables are created then we have to notify saying which table needs to be enabled for notifications.
That can be achieved by two ways:-

• aspnet_regsql -et -E -d Northwind -t Products
• Exec spNet_SqlCacheRegisterTableStoredProcedure 'TableName'
Registering tables for notification internally creates triggerfor the tables. For instance, for a “products” table the following trigger is created. So any modifications done to the “Products” table will update the “AspNet_SqlCacheNotification’ table.


CREATE TRIGGER

dbo.[Products_AspNet_SqlCacheNotification_Trigger] ON
[Products]
FOR INSERT, UPDATE, DELETE
AS
BEGIN
SET NOCOUNT ON
EXEC dbo.AspNet_SqlCacheUpdateChangeIdStoredProcedure
N'Products‘
END

 
“AspNet_SqlCacheTablesForChangeNotification” contains a single record for every table you're monitoring. When you make a change in the table (such as inserting, deleting or updating a record), the change Id column is incremented by 1.ASP.NET queries this table repeatedly keeps track of the most recent changed values for every table. When this value changes in a subsequent read, ASP.NET knows that the table has changed.

Figure 5.3: - Entries in the Cache notification table

 

Enable ASP.NET polling using “web.config” file
Now that all our database side is configured in order to get the SQL Cache working in the ASP.NET side we need to do some configuration in the web.config file.
We need to set two attributes in the “web.config” file:-
• Set “Enabled” attribute to true to set the caching on.
• Set the poll time attribute to the number of milliseconds between each poll
Below is the snapshot of the web.config file.

 

 

Figure 5.4:- Web.config file modifications for SQL cache

 

Finally use the Cache dependency object in your ASP.NET code
Now comes the final step to use our cache dependency with programmatic data caching, a data source control, and output caching.
For programmatic data caching, we need to create a new SqlCacheDependency and supply that to the Cache.Insert() method. In the SqlCacheDependency constructor, you supply two strings. The first is the name of the database you defined in the element in the section of the web.config file e.g: Northwind. The second is the name of the linked table e.g: Products.

 

private static void CacheProductsList(List<ClsProductItem> products)
{SqlCacheDependency sqlDependency = new SqlCacheDependency("Northwind", "Products");
HttpContext.Current.Cache.Insert("ProductsList", products, sqlDependency, DateTime.Now.AddDays(1), Cache.NoSlidingExpiration);}
private static List<ClsProductItem> GetCachedProductList()
{return HttpContext.Current.Cache["ProductsList"] as List<ClsProductItem>;}

ClsProductItem is business class, and here we are trying to cache a list of ClsProductItem instead of DataSet or DataTable.
The following method is used by an ObjectDataSource Control to retrieve List of Products

 

public static List<ClsProductItem> GetProductsList(int catId, string sortBy)
{
//Try to Get Products List from the Cache
List<ClsProductItem> products = GetCachedProductList();
if (products == null)
{
//Products List not in the cache, so query the Database layer
ClsProductsDB db = new ClsProductsDB(_connectionString);
DbDataReader reader = null;
products = new List<ClsProductItem>(80);
if (catId > 0)
{
//Return Product List from the Data Layer
reader = db.GetProductsList(catId);
}
else
{
//Return Product List from the Data Layer
reader = db.GetProductsList();
}
//Create List of Products -List if ClsProductItem-
products = BuildProductsList(reader);
reader.Close();

//Add entry to products list in the Cache
CacheProductsList(products);

}
products.Sort(new ClsProductItemComparer(sortBy));

if (sortBy.Contains("DESC")) products.Reverse();
return products;

}

To perform the same trick with output caching, you simply need to set the SqlDependency property with the database dependency name and the table name, separated by a colon:

<%@ OutputCache Duration="600" SqlDependency="Northwind:Products" VaryByParam="none" %>
The same technique works with the SqlDataSource and ObjectDataSource controls:

<asp:SqlDataSource EnableCaching="True" SqlCacheDependency="Northwind:Products" ... />
Note:- ObjectDataSource doesn't support built in caching for Custom types such as the one in our example. It only supports this feature for DataSets and DataTables.

Just to make a sample check run the SQL Server profiler and see that does the SQL actually hit the database after the first run.


(I) What is Post Cache substitution?


Post cache substitution is used when we want to cache the whole page but also need some dynamic region inside that cached page. Some examples like QuoteoftheDay, RandomPhotos, and AdRotator etc. are examples where we can implement Post Cache Substitution.
Post-cache substitution can be achieved by two means:
• Call the new Response.WriteSubstitution method, passing it a reference to the desired substitution method callback.
• Add a <asp:Substitution> control to the page at the desired location, and set its methodName attribute to the name of the callback method.

 

Figure 5.5: - “Writesubstitution” in action

 

You can see we have a static function here “GetDateToString()”. We pass the response substitution callback to the “WriteSubstitution” method. So now, when ASP.NET page framework retrieves the cached page, it automatically triggers your callback method to get the dynamic content. It then inserts your content into the cached HTML of the page. Even if your page has not been cached yet (for example, it's being rendered for the first time), ASP.NET still calls your callback in the same way to get the dynamic content. So you create a method that generates some dynamic content, and by doing so you guarantee that your method is always called, and it’s content is never cached.
Ok the above example was by using “WriteSubstitution” now lets try to see how we can do by using “<asp:substitution>” control. You can get the “<asp:substitution>” control from the editor toolbox.

 

Figure 5.6: - Substitution Control

 

Figure 5.7: - Substitution in Action

 


Below is a sample code that shows how substitution control works. We have ASPX code at the right hand side and class code at the behind code at the left hand side. We need to provide the method name in the “methodname” attribute of the substitution control.

(I) Why do we need methods to be static for Post Cache substitution?


ASP.NET should be able to call this method even when there is not an instance of your page class available. When your page is served from the cache, the page object is not created. Therefore, ASP.NET skips the page life cycle when the page is coming from cache, which means it will not create any control objects or raise any control events. If your dynamic content depends on the values of other controls, you will need to use a different technique, because these control objects will not be available to your callback

Other Interview question PDF's

.NET Interview Question PDF

Project Management interview questions

Download Networking Interview Questions

Download Software Testing Interview Questions

Download Sql Server Interview Questions

Download C# and ASP .Net Projects

Download Java Interview Questions

Download Software Architecture Interview Questions

Download Excel Question and Answers

 

 

Repost 0
Published by questpond.over-blog.com
write a comment
October 27 2010 4 27 /10 /October /2010 21:07

SOA ( Service oriented architecture Interview questions Part 1)
Get Interview tutorials and videos on .NET 3.5, 4.0, Pessimistic, Optimistic, Locking, SQL Server, CAS, Security, WCF, SharePoint, Azure, OOPS and many more on www.questpond.com




(B) What is SOA?

(I) In SOA do we need to build systems from scratch?

(I) Can you explain business layers and plumbing layers in SOA?

(I) what’s the difference between services and components?

(A) Can you describe the complete architecture of SOA?

(I) Can you explain a practical example in SOA?

(I) What are ends, contract, address, and bindings?

(I) Are web-services SOA ?

Introduction

In my previous section we had concentrated on design patterns and UML which is one of the most important fundamentals for architecture interviews. One of the other areas other than both of them which needs to be stronger for architects is understanding of SOA.

Again i repeat do not think you get an architecture position by reading interview questions. But yes there should be some kind of reference which will help you quickly revise what are the definition. Just by reading these answers you get to a position where you are aware of the fundamentals. But if you have not really worked you will surely fail with scenario based questions. So use this as a quick revision rather than a shot cut.

To give you a practical understanding i have put all these design patterns in a video format and uploaded on http://www.questpond.com/FreeDesign1.htm . You can visit http://www.questpond.com and download the complete architecture interview questions PDF which covers SOA , UML , Design patterns , Togaf , OOPs etc.

Happy job hunting......

(B) What is SOA?

SOA stands for service oriented architecture. Before we define SOA lets first define a service. In real world service is what we pay for and we get the intended service. For instance you go to a hotel and order food. Your order first goes to the counter and then it goes to the kitchen where the food is prepared and finally the waiter serves the food.


Figure: - Hotel and services


So in order to order a item from a hotel you need the three logical departments / services to work together (counter, kitchen and waiter).

In the same manner in software world these services are termed as business services. They are self contained and logical. So let’s first define a business service, SOA definition will be just an extension of the same.

Definition of business service: - It’s a logical encapsulation of self contained business functionality.

For instance figure ‘order system’ shows a simple ordering system which is achieved by different services like payment gateway, stock system and delivery system coming together. All the services are self contained and logical. They are like black boxes. In short we do not need to understand the internal details of how the business service works. For the external world it’s just a black box which takes messages and serves accordingly. For instance the ‘payment gateway’ business service takes message ‘check credit’ and gives out output does the customer have credit or not. For the ‘order system’ business service ‘payment gateway’ service is a black box.

Figure: - Order system


Now let’s revise some bullet points of SOA before we arrive to a definition of SOA.

SOA components are loosely coupled. When we say loosely coupled means every service is self contained and exist in alone logically. For instance we take the ‘payment gateway’ service and attach it to a different system.

SOA services are black boxes. In SOA services hide there inner complexities. They only interact using messages and send services depending on those messages. By visualizing services as black boxes services become more loosely coupled.

SOA service should be self defined: - SOA services should be able to define themselves.

SOA Services are maintained in a listing: - SOA services are maintained in a central repository. Applications can search the services in the central repository and use them accordingly.

SOA components can be orchestrated and linked to achieve a particular functionality. SOA services can be used/orchestrated in a plug and play manner. For instance figure ‘Orchestration’ shows two services ‘Security service’ and ‘Order processing service’. You can achieve two types of orchestrations from it one you can check the user first and then process order or vice-versa. Yes you guessed right using SOA we can manage work flow between services in a loosely coupled
fashion.

Figure: - Orchestration

So lets define SOA.

SOA is a architecture for building business applications using loosely coupled services which act like black boxes and can be orchestrated to achieve a specific functionality by linking together.

(I) In SOA do we need to build systems from scratch?


No. If you need to integrate or make an existing system as a business service, you just need to create loosely coupled wrappers which will wrap your custom systems and expose the systems functionality in generic fashion to the external world.

(I) Can you explain business layers and plumbing layers in SOA?


In SOA we can divide any architecture in two layers. The first which has direct relevance to business as it carries out business functions. The second layer is a technical layer which talks about managing computer resources like database, web server etc. This division is needed to identify a service. Consider the figure ‘Simple order system’. It has various components which interact with each other to complete the order system functionality.


Figure: - Simple order System

The simple order system can be divided in to two layers (see figure ‘business and plumbing layer’ one which is business related and second which is more technical related. You can see the plumbing layer consisting of data access layer , AJAX , yes more of technical stuff.

Figure: - Business layer and plumbing layer

(I) what’s the difference between services and components?


Services are logical grouping of components to achieve business functionality. Components are implementation approaches to make a service. The components can be in JAVA, C#, C++ but the services will be exposed in a general format like Web Services.

(A) Can you describe the complete architecture of SOA?


Figure ‘Architecture of SOA’ shows a complete view of a SOA. Please note this architecture diagram is not tied up with implementation of Microsoft, IBM etc. It’s a general architecture. Any vendor who implements SOA needs to fulfill the below SOA components. How they do it is completely their own technological implementation.

Figure: - Architecture of SOA


The main goal of SOA is to connect disparate systems. In order that these disparate system work they should messages to each other. ESB (Enterprise service bus) acts like a reliable post office which guarantees delivery of messages between systems in a loosely coupled manner. ESB is a special layer which delivers messages between applications. In the figure we have shown a huge plump pipe. It’s not hardware or some wire etc. It’s a group of components/software which helps you to send and receive messages between the disparate applications. Do not try to code your own ESB, you can think of buying one from Microsoft, IBM, Oracle, progress etc.

SOA registry is like a reference database of services. It describes what each services do, where are they located and how can they communicate. It’s a central reference of meta-data for services.

SOA workflow allows us to define work flow using the services in SOA registry. We will read more about BPM in the further questions.

Service broker reads the work flow and takes services from the SOA registry and ties them together. Service brokers are normally middleware like EAI (Enterprise application Integration) products. You can get a list of decent EAI from Sun, Microsoft, and IBM etc.

Process manager is nothing but the collection of SOA registry, SOA workflow and service broker.

SOA supervisor is traffic cop ensuring that services do not have issues. It deals mainly with performance issues of the system so that appropriate service levels are met. If any of the services have performance problems it sends messages to the proper infrastructure to fix the issue.

Note: - The above explanation is of general architecture for SOA. Any vendor (Microsoft, IBM, SUN etc) who gives solution for SOA should have the above components in some or other manner. As this is a Software architecture book, we will not be covering specific vendor implementation. We would advise the reader to map the same to their vendor products for better understanding.


(I) Can you explain a practical example in SOA?

 

(I) What are ends, contract, address, and bindings?


These three terminologies on which SOA service stands. Every service must expose one or more ends by which the service can be available to the client. End consists of three important things where, what and how:-

Contract (What)

Contract is an agreement between two or more parties. It defines the protocol how client should communicate with your service. Technically, it describes parameters and return values for a method.

Address (Where)

An Address indicates where we can find this service. Address is a URL, which points to the location of the service.

Binding (How)

Bindings determine how this end can be accessed. It determines how communications is done. For instance, you expose your service, which can be accessed using SOAP over HTTP or BINARY over TCP. So for each of these communications medium two bindings will be created.

Below figure, show the three main components of end. You can see the stock ticker is the service class, which has an end hosted on www.soa.com with HTTP and TCP binding support and using Stock Ticker interface type.

Figure: - Endpoint Architecture


Note: - You can also remember the end point by ABC where A stands for Address, B for bindings and C for Contract.


(I) Are web-services SOA ?


SOA is a thinking, it’s an architectural concept and web service is one of the technical approach to complete it. Web services are the preferred standards to achieve SOA.

• In SOA we need the services to be loosely coupled. A web service communicates using SOAP protocol which is XML based which is very loosely coupled. It answers the what part of the service.
• SOA services should be able to describe themselves.WSDL describes how we can access the service.
• SOA services are located in a directory.UDDI describes where we can get the web service. This nothing but implementation of SOA registry.

 

Other Interview question PDF's

.NET Interview Question PDF

Project Management interview questions

Download Networking Interview Questions

Download Software Testing Interview Questions

Download Sql Server Interview Questions

Download C# and ASP .Net Projects

Download Java Interview Questions

Download Software Architecture Interview Questions



 

 

Article Source

Repost 0
Published by questpond.over-blog.com
write a comment
October 27 2010 4 27 /10 /October /2010 14:49

Introduction and Goal

In this article, we will try to understand the 4 important steps to consume web services directly in Ajax. In this sample, we will create a simple customer combo box as shown in the figure below. This customer combo box will be filled by calling the web service methods directly of the customer web service.

Here’s my small gift for all my .NET friends, a complete 400 pages FAQ Ebook which covers various .NET technologies like Azure, WCF, WWF, Silverlight, WPF, SharePoint and a lot more.  

Video Tutorial

This whole article is also demonstrated in video format which you can view from here.

Introduction

Normally consumption of web services happens as shown in the below figure. The browser Ajax controls calls the ASP.NET code and the ASP.NET code consumes the web service. But there are scenarios where you would like to call the web services directly from the Ajax JavaScript functions rather than calling via the behind code. This article will demonstrate how we can achieve the same.

Step 1: Create your Customer Class 

The first step is to create the customer class as shown below. So our customer class has 4 properties on customer id, first name, address and designation.

 public class Customers { // private properties private int _intCustomerID; private string _strFirstName; private string _strAddress; private string _strDesignation; // Public property and public int CustomerID { get { return _intCustomerID; } set { _intCustomerID = value; } } public string FirstName { get { return _strFirstName; } set { _strFirstName = value; } } 

Step 2: Create your Web Service

The next step is we need to create the web service which exposes the customer class to our UI. Below is a simple web service which has encapsulated customer collection. In the constructor, we are loading some dummy data into the list of customers as shown in the below code snippet:

 [System.Web.Script.Services.ScriptService] public class Customer : System.Web.Services.WebService { // Customer collection List<Customers> listcust = new List<Customers>(); public Customer () { //Load some dummy data in to customer collection. listcust.Clear(); Customers cust = new Customers(); cust.CustomerID = 1; cust.FirstName = "Taha"; cust.Address = "Live in India"; cust.Designation = "Software Developer"; listcust.Add(cust); cust = new Customers(); cust.CustomerID = 2; cust.FirstName = "Shyam"; cust.Address = "Live in Austrailia"; cust.Designation = "Web Designer"; listcust.Add(cust); cust = new Customers(); cust.CustomerID = 3; cust.FirstName = "Khadak"; cust.Address = "Live in London"; cust.Designation = "Architect"; listcust.Add(cust); } // This function exposes all customers to the end client’ [WebMethod] public List<Customers> LoadCustomers() { return listcust; } // This function helps us to get customer object based in ID [WebMethod] public Customers LoadSingleCustomers(int _customerid) { return (Customers)listcust[_customerid-1]; } 

We are also exposing two functions through the web service, one which gives out a list of customers and another which gives out individual customer data based on customer id.

Step 3: Reference your Web Service using the asp:servicereference

Using the ‘asp:ServiceReference’, we will then point the path to the ASMX file as shown in the below code snippet. This will generate the JavaScript proxy which can be used to call the customer object.

 <asp:ScriptManager ID="ScriptManager1" runat="server"> <Services> <asp:ServiceReference Path="Customer.asmx" /> </Services> </asp:ScriptManager> 

Step 4: Call the Webservice and the JavaScript Code

Once you have defined the proxy, you can now call the ‘Customer’ proxy directly to make method calls.

 function LoadAll() { Customer.LoadCustomers(LoadCustomerToSelectOption, ErrorHandler, TimeOutHandler); } 

When you call the JavaScript proxy object, we need to provide three functions; the first function (‘LoadCustomerToSelectOption’) will be called when the web service finishes and returns data. The data will be returned in the fill variable which will then be looped and added to the customer combo box.

 function LoadCustomerToSelectOption(Fill) { var select = document.getElementById("cmbCustomers"); for (var i = 0; i < Fill.length; i++) { var value = new Option(Fill[i].FirstName, Fill[i].CustomerID); select.options.add(value); } } 

There are two more functions which are attached; one which handles error and the other which handles time out. Below are the code snippets for the same:

 function ErrorHandler(result) { var msg = result.get_exceptionType() + "\r\n"; msg += result.get_message() + "\r\n"; msg += result.get_stackTrace(); alert(msg); } function TimeOutHandler(result) { alert("Timeout :" + result); } 

History

  • 20th February, 2010: Initial post

Article Source

Repost 0
Published by questpond.over-blog.com
write a comment
October 26 2010 3 26 /10 /October /2010 16:27

6 ways of doing locking in .NET (Pessimistic and optimistic)
Get Interview tutorials and videos on .NET 3.5, 4.0,Pessimistic,optimistic,locking,SQL Server,CAS, Security, WCF, SharePoint, Azure, OOPSand many more on www.questpond.com

Introduction

Why do we need locking?

How can we solve concurrency problems?

What kind of confusion is caused because of concurrency?

So how can we solve the above problems?

What is Optimistic locking?

How does optimistic lock work?

What are the different solutions by which we can implement optimistic locking?

Solution number 1:- Datasets

Solution number 2:- Use timestamp data type

Solution number 3:- Check old values and new values

But it looks like by using optimistic locking concurrency problems are not really solved?

What is pessimistic locking?

How can we do pessimistic locking?

What kind of locks can be acquired by using pessimistic locking?

The update lock is confusing can you explain in detail?

So what are the different types of isolation levels and when should be used when?

How can we specify Isolation?

Which transaction isolation level solves which problems from Concurrency?

Solution 4:- Can we see how dirty reads are solved using Read Committed?

So is Read uncommitted opposite of Read Committed?

Solution 5:- Can we see how lost update and non-repeatable read are solved using repeatable read?

Solution 6:- How are Phantom row problems addressed using Serializable Isolation level?

In what scenarios should we use optimistic and pessimistic locking?

What is a dead lock and how does shared lock avoid the same?

What are Lock hints?

 

Introduction

This article talks about 6 ways of doing locking in .NET. It starts with concurrency problems and then discusses about 3 ways of doing optimistic locking. As optimistic locking does not solve the concurrency issues from roots, it introduces pessimistic locking. It then moves ahead to explain how isolation levels can help us implement pessimistic locking. Each isolation level is explained with sample demonstration to make concepts clearer.
This is a small Ebook for all my .NET friends which covers topics like WCF,WPF,WWF,Ajax,Core .NET,SQL, Entity framework, Design patterns , Agile etc you can download the same from SampleDotNetTrainingBook 

 

or else you can catch me on my daily free trainings

  
Why do we need locking?

In multi-user environment it’s possible that multiple users can update the same record at the same time causing confusion between users. This issue is termed as concurrency.

How can we solve concurrency problems?

Concurrency problems can be solved by implementing proper “Locking strategy”. Locks prevent action on a resource to be performed when some other resource is already performing some action on it.

What kind of confusion is caused because of concurrency?

There are 4 kinds of major problems caused because of concurrency, below table shows the details of the same.

Problems Short description Explanation
Dirty reads "Dirty Read" occurs when one transaction is reading a record, which is part of a half, finished work of other transaction. • User A and user B are seeing value as “5”.
• User B changes the value “5” to “2”.
• User A is still seeing the value as “5”….Dirty read has happened.
Unrepeatable read In every data read if you get different values then it’s an “Unrepeatable Read” problem. • User A is seeing value as “5”.
• User B changes the value”5” to “2”.
• User A refreshes see values “5”, he is surprised….unrepeatable read has happened.
Phantom rows If “UPDATE” and “DELETE” SQL statements does not affect the data then it can be “Phantom Rows” problem. • User A updates all value “5’ to “2”.
• User B inserts a new record with value “2”.
• User A selects all record with value “2’ if all the values have changed, he is surprised to still find value “2” records…..Phantom rows have been inserted.
Lost updates "Lost Updates" are scenario where one updates which is successfully written to database is overwritten with other updates of other transaction. • User A updates all value form “5” to “2”.
• User B comes and updates all “2” values to “5”.
• User A has lost all his updates.

So how can we solve the above problems?

By using optimistic or pessimistic locking, the further coming article discusses the same.

What is Optimistic locking?

As the name suggests “optimistic” it assumes that multiple transaction will work without affecting each other. In other words no locks are enforced while doing optimistic locking. The transaction just veriafies that no other transaction has modified the data. In case of modification the transaction is rolled back.

How does optimistic lock work?

You can implement optimistic locking by numerous ways but the fundamental to implement optimistic locking remains same. It’s a 5 step process as shown below:-

• Record the current timestamp.

• Start changing the values.

• Before updating check whether anyone else has changed the values by checking the old time stamp and new time stamp.

• If it’s not equal rollbacks or else commit.

What are the different solutions by which we can implement optimistic locking?

There are 3 primary ways by which we can implement optimistic locking in .NET:-

Datasets: - Dataset by default implement optimistic locking. They do a check of old values and new values before updating.

Timestamp Data type: - Create a timestamp data type in your table and while updating check if old timestamp is equal to new timestamp.

Check old and new value: - Fetch the values, do the changes and while doing the final updates check if the old value and current values in database are equal. If they are not equal then rollback or else commits the values.

Solution number 1:- Datasets

As said in the previous section dataset handles optimistic concurrency by itself. Below is a simple snapshot where we held the debug point on Adapter’s update function and then changed the value from the SQL Server. When we ran the “update” function by removing the break point it threw “Concurrency” exception error as shown below.

If you run the profiler at the back end you can see it fires the update statement checking of the current values and the old values are same.

 exec sp_executesql N'UPDATE [tbl_items] SET [AuthorName] = @p1 WHERE (([Id] = @p2) AND ((@p3 = 1 AND [ItemName] IS NULL) OR ([ItemName] = @p4)) AND ((@p5 = 1 AND [Type] IS NULL) OR ([Type] = @p6)) AND ((@p7 = 1 AND [AuthorName] IS NULL) OR ([AuthorName] = @p8)) AND ((@p9 = 1 AND [Vendor] IS NULL) OR ([Vendor] = @p10)))',N'@p1 nvarchar(11),@p2 int,@p3 int,@p4 nvarchar(4),@p5 int,@p6 int,@p7 int,@p8 nvarchar(18),@p9 int,@p10 nvarchar(2)',@p1=N'this is new',@p2=2,@p3=0,@p4=N'1001',@p5=0,@p6=3,@p7=0,@p8=N'This is Old Author',@p9=0,@p10=N'kk' 

In this scenario we were trying to change the field value “AuthorName” to “This is new” but while updating it makes a check with the
 old value “This is old author”. Below is the downsized code snippet of the above SQL which shows the comparison with old value.

 ,@p8=N'This is Old Author' 

Solution number 2:- Use timestamp data type

The other way of doing optimistic locking is by using ‘TimeStamp’ data type of SQL Server. Time stamp automatically generates
a unique binary number every time you update the SQL Server data. Time stamp data types are for versioning your record updates.

To implement optimistic locking we first fetch the old ‘TimeStamp’ value and when we are trying to update we check if the old time
stamp is equal to the current time stamp as shown in the below code snippet.

 update tbl_items set itemname=@itemname where CurrentTimestamp=@OldTimeStamp 

We then check if any updates has happened, in case updates has not happened then we raise a serious error ‘16’ using SQL Server ‘raiserror’
as shown in the below code snippet.

 if(@@rowcount=0) begin raiserror('Hello some else changed the value',16,10) end 

If any concurrency violation takes place you should see the error propagated when you call ‘ExecuteNonQuery’ to the client side as
shown in the below figure.

Solution number 3:- Check old values and new values

Many times we would like to check concurrency on only certain fields and omit fields like identity etc. For those kind of scenarios
we can check the old value and the new value of the updated fields as shown in the below code snippet.

 update tbl_items set itemname=@itemname where itemname=@OldItemNameValue 

But it looks like by using optimistic locking concurrency problems are not really solved?

Yes, you said right. By using optimistic locking you only detect the concurrency problem. To solve concurrency issues from the roots
itself we need to use pessimistic locking. Optimistic is like prevention while pessimistic locking is actually the cure.

What is pessimistic locking?

 

Pessimistic locking assumes that concurrency / collision issues will happen so a lock is placed on the records and then data is updated.

How can we do pessimistic locking?

We can do pessimistic locking by specifying “IsolationLevel” in SQL Server stored procedures, ADO.NET level or by using transaction scope object.

What kind of locks can be acquired by using pessimistic locking?

There are 4 kinds of locks you can acquire Shared, Exclusive, Update and intent. The first two are actual locks while the other two
are hybrid locks and marker.

  When to use? Reads Allowed Writes Allowed
Shared lock When you want only to read and you do not want any other transactions to do update. Yes No
Exclusive When you want to modify data and you do not want anyone to read the transaction, neither you want anyone to update. No No
Update lock This is a hybrid lock. This lock is used when you want to do update operation which passes through multiple phases before the actual update happens. It first starts with shared lock in the read phase and then on the actual update it acquires an exclusive lock.    
  Read phase Yes No
  Manipulating phase Yes No
  Update phas No No
Intent Lock ( Demand locks) Intent lock is for lock hierarchy. This lock is used when you want to lock resources down in the hierarchy. For example a shared intent lock on a table means shared locks are placed on pages and rows with the table. NA NA
Schema locks When you are changing table structure. No No
Bulk update locks Used when you are doing bulk updates Table level No Table level No

 

The update lock is confusing can you explain in detail?

The other locks are pretty straight forward; the update lock is confusing because of its hybrid nature. Many times before we update we read the record. So during read the lock is shared and while actually updating we would like to have an exclusive lock. Update locks are more of transient locks.

 

So what are the different types of isolation levels and when should be used when?

There are 4 kinds of transaction isolation level, below is a simple table which shows when to use them and what locks they put.

Isolation Level Read Update Insert
Read Uncommitted Reads data which is yet not committed. Allowed Allowed
Read Committed ( Default) Reads data which is committed. Allowed Allowed
Repeatable Read Reads data which is committed. Not Allowed Allowed
Serializable Reads data which is committed. Not Allowed Not Allowed

How can we specify Isolation?

Isolation levels are features of RDBMS software, in other words they fundamental really belong to SQL Server and not to Ado.NET, EF or LINQ. Said and done that you can always set the transaction isolation level from any of these components.

Middle tier

In middle tier you can specify isolation level using transaction scope object.

 TransactionOptions TransOpt = New TransactionOptions(); TransOpt.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted; using(TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, TransOptions)) { } 

ADO.NET

You can also specify transaction isolation level using “SqlTransaction” object in ADO.NET.

 SqlTransaction objtransaction = objConnection.BeginTransaction(System.Data.IsolationLevel.Serializable); 

SQL Server

You can also specify isolation level in TSQL using ‘SET TRANSACATION ISOLATION LEVEL’ as shown in the below code snippet.

 SET TRANSACTION ISOLATION LEVEL READ COMMITTED; 

Which transaction isolation level solves which problems from Concurrency?

Below is a chart which shows which transaction isolation level solves which problems of concurrency.

  Read committed(S) Repeatable read(I)    Serializable Read Uncommitted
Dirty reads

        Solves

        Solves     Solves             X
Lost updates             X         Solves     Solves             X
Non repeatable reads             X         Solves     Solves             X
Phantom rows             X               X     Solves             X

Solution 4:- Can we see how dirty reads are solved using Read Committed?

Some important Key points about read committed:-

• It’s the default transaction isolation level for SQL Server.

• Its reads only committed data. In other words any uncommitted data is not read and blocked until the commit happens. Below figure explains the same in more detail. You can see the update

If you want the see above things practically do the following:-

• Open 2 Query windows fire an update transaction but do not commit.

• In the second window try firing select query it will show a blocked query as shown in the below figure.

So is Read uncommitted opposite of Read Committed?

Yes, read uncommitted is opposite to read committed. When you set the transaction isolation level to read uncommitted, uncommitted data is also read.
Some important key points for read committed:-

• Uncommitted is see so dirty read possible.

• No locks held.

• Useful when locking is not important and more important is concurrency and throughput.

If you want to test the same, fire the below SQL statement which is doing an update and roll back. The roll back happens after 20 seconds halt. Within that time if you fire a select query you will get the uncommitted data and after 20 seconds you will see the old data this committed data is rolled back.

 set transaction isolation level read uncommitted Begin Tran Update customer set CustomerName='Changed' where CustomerCode='1001' WAITFOR DELAY '000:00:20' rollback tran 
 set transaction isolation level read uncommitted select * from Customer where CustomerCode='1001' 

Solution 5:- Can we see how lost update and non-repeatable read are solved using repeatable read?

By setting isolation level to repeatable read no one can read and update the data. Some key points about repeatable read isolation level are as follows:-

• Only committed data is read when repeatable transaction isolation level is set for select queries.

• When you select a record using repeatable read no one other transaction can update the record. , but selects are possible.

• If repeatable transaction is set in update query, until the transaction finishes no one can read or update the same.

• When select and update query is set to repeatable read other transaction can insert new records. In other words phantom rows are possible.

If you want to test this isolation level, fire the below syntax and try firing select and update queries they will be blocked and after 50 seconds you should see the data.

 set transaction isolation level repeatable read Begin Tran Update customer set CustomerName='Changed' where CustomerCode='1001' WAITFOR DELAY '000:00:50' rollback tran 

If you fire the below select query in repeatable read mode you will not be able to update for 50 seconds until the transaction finishes.

 set transaction isolation level repeatable read begin tran select * from Customer where CustomerCode='1001' WAITFOR DELAY '000:00:50' commit tran 

One important note you can add new records of customer code 1001, in other words phantom rows are possible.

Solution 6:- How are Phantom row problems addressed using Serializable Isolation level?

This is the highest level of isolation level; in this other transactions cannot update, select and insert records.
Some key points for serializable transaction are:-

• No other transaction can insert, update, delete or select when isolation level is serializable.

• Lot of blockings but all concurrency issues are solved.

 set transaction isolation level serializable begin tran select * from Customer where CustomerCode='1001' WAITFOR DELAY '000:00:50' commit tran 

In what scenarios should we use optimistic and pessimistic locking?

Working…

What is a dead lock and how does shared lock avoid the same?

Still working…

What are Lock hints?

Still working…

 

Repost 0
Published by questpond.over-blog.com
write a comment
October 26 2010 3 26 /10 /October /2010 14:48

CAS (Code access security) & .NET 4.0 Security model FAQ (With Full Video demonstration)
Get Interview tutorials and videos on .NET 3.5, 4.0, CAS, Security, WCF, SharePoint, Azure, OOPSand many more on www.questpond.com


 

Introduction 

What is CAS?
What is evidence in CAS?

What is a permission and permission set?

What is code group?

So how does CAS work on runtime?

Can we see a quick demo of CAS?

What is CASPOL.exe?

When I open a .NET 4.0 DLL/Assembly using CASPOL it throws an error?

Can you throw some more light on the security transparent model?

A demo of security transparent model can really make things clear?

What is the concept of sandboxing?

Security transparent is good when we control the code what about external DLL?

But why this change, what was the problem with CAS?

So how can we give code access after .NET 4.0 and later?

What if I still want to use CAS in .NET 4.0?

References

Introduction

Many developers understand the concept of CAS (Code access security) but very few know how to implement the same. This article will discuss and demonstrate practically all those aspects of CAS which you have ready only in theory till today.

This article first starts with the basic concepts of CAS like evidence, permission, code groups and caspol.exe. It then moves ahead to demonstrate how CAS can be implemented in real world. This article further talks about ground up changes made in .NET 4.0 for CAS. In those regards it discusses about security transparent model and sandboxing.

Bet me this article is your last chance to see CAS in actual action....enjoy.

This is a small Ebook for all my .NET friends which covers topics like WCF, WPF, WWF, AJAX, Core .NET, SQL etc you can download the same from SampleDotNetTrainingBook 

 

or else you can catch me on my daily free trainings

 
What is CAS?

Code Access security is a security model which grants or denies permission to your assembly depending on evidences like from where the code has emerged, who the publisher is? , strong names etc.

What is evidence in CAS?

When you want to execute any code in your environment you would first like to know from where the code came from. Depending from where it came from, you would then would like to give him access rights. For instance a code compiled from your own computer would have greater rights than code downloaded from the internet.

In order to know the same we need to probe the assembly / exe / dll and get evidences like who is the publisher of the code , from which site has this code from , from which zone has it come from ( internet , intranet etc) etc.


What is a permission and permission set?

Once you have gathered the evidences about the code you would like to assign permission to the code. There are various permissions which you can assign to the code like Can the code create a file, can we write to registry, can the code execute reflection, can the code open file dialog box etc.

These permissions are collect permission sets and those permission sets are allocated to the code.

What is code group?

Code groups are nothing but categories of code. These categories are defined by permissions and evidence values. When .NET code runs it’s assigned to a code group by the evidences which are collected during runtime.

For instance there are various default code groups like My computer zone , internet zone , intranet zone etc.

My computer zone code group is allocated to code who evidence says that they are assemblies which are installed on the computer and they have permission set ‘internet’ which has various permissions like file dialog , execute , user interface , printing etc.

 

So how does CAS work on runtime?

When the assembly runs following steps takes place:-

• Evidences are gathered about the assembly. In other words from where did this assembly come?
• Depending on evidences the assembly is assigned to a code group. In other words what rights does the assembly depending on the evidence gathered.
• Depending on code group the assembly is allocated security rights.
• Using the security rights the assembly is run with in those rights.


 

Can we see a quick demo of CAS?

If you want to allocate rights to an assembly we need to install the .NET configuration tool and click on trust assembly menu as shown in the below figure.

Once you trust the assembly you can adjust the trust to full trust or none.

Please do see the below complete video which explains how we can assign permission, permission set,
 code group and evidence to an exe or an assembly.

 

 

What is CASPOL.exe?

It’s the core exe which is responsible to assign permission to the assembly. The .NET configuration tool is just a cover which sits on the top of caspol.exe to ease our work. CASPOL.exe commands are cryptic so the .NET configuration tool is more user friendly. In case you are interested in using caspol.exe you can go to visual studio command prompt and type caspol.exe with necessary parameters.


When I open a .NET 4.0 DLL/Assembly using CASPOL it throws an error?

If you try to open a .NET 4.0 DLL in configuration wizard you will get an error as shown below.

CAS is completely deprecated in .NET 4.0, there are two big changes:-

• Granting of permission is no more dependent on the .NET CAS, it’s now the job of the host. So the host who runs the .NET DLL will define what kind of rights will the assembly have. NET Framework 4.0 comes with CAS a disabled which means all applications started via Windows Explorer or the command prompt run with full trust. Hosted .NET applications, those running inside Internet Explorer or ASP.NET, will run at the trust level granted by their host, being partially trusted.

• Security transparent model is introduced which divides a .NET code in to 3 categories Security critical, Security transparent and security safe critical.

Can you throw some more light on the security transparent model?

The security transparent model puts code in to separate boxes as per the risk associated. If you know that code can do something wrong you can box that code as ‘Security transparent’ and if you have a code which you trust you can box them in to ‘Security critical’.

By putting the above compartments you have ensured that the unsecured code (Security transparent) cannot call the secured code (Security critical). When you mark a code as security transparent, these types of code cannot call security critical code.

If for some reason the transparent code wants to call security critical code it can go via the bridge security safe critical code.

A demo of security transparent model can really make things clear?

Below is a simple video where we have created a simple code marked it as security critical and then we tried calling the same from security transparent code and we get an error.

 

What is the concept of sandboxing?

The next question answers the same.

Security transparent is good when we control the code what about external DLL?

The security transparent code is good when we control the code but what if get assembly which is a third party. In those situations you can use the concept of sandboxing. One of the important points to note is that CAS is deprecated and not removed completely.

So if you have third party DLL you can create your own appdomain and assign permission sets so that your 3rd party DLL runs under a control environment. Below is a simple code snippet which shows how we can do things. The below code snippet, creates an application domain, allocates permissions for execution and user interface display only.

We then try to do something funny like popping up a file brows dialog box and we end up with error as shown in the below figure.

Step1:- Create appdomain with two permission execution and UI display using permission set class.

 PermissionSet permset = new PermissionSet(PermissionState.None); permset.AddPermission(new SecurityPermission(SecurityPermissionFlag.Execution)); permset.AddPermission(new UIPermission(UIPermissionWindow.AllWindows)); 


Step 2:- Apply the above defined permission set to the newly created application domain as shown in the below code snippet.

 AppDomainSetup objSetup = new AppDomainSetup(); objSetup.ApplicationBase = AppDomain.CurrentDomain.SetupInformation.ApplicationBase; AppDomain domain = AppDomain.CreateDomain("New domain name", AppDomain.CurrentDomain.Evidence, objSetup, permset); 


Step 3:- Create the instance and try calling the ‘ShowDialog’ function.

 Interface1 i1 = (ClassLibrary1.Class1)domain.CreateInstanceAndUnwrap("ClassLibrary1", "ClassLibrary1.Class1"); i1.ShowDialog(); 

If you try to execute the open dialog it will pop up an error as shown in the below code.

 

But why this change, what was the problem with CAS?


• First thing CAS was not easy, all those cryptic steps of creating code groups, and permission sets etc eats your energy completely.

• If you have to move the assembly to a different computer you need to do the whole rework again.

• The worst part CAS does not work on unmanaged code. I am dead sure it’s always possible you will download exe which is not written in .NET.


So how can we give code access after .NET 4.0 and later?

The best way to restrict code access is by putting restriction at the operating system level. Windows SRP (Software restriction policy) helps to achieve the same.
• Log on with an Administrator account.
• Type gpedit.msc into the Run or Search box on your Start menu, click OK, and Group Policy will open.
• Go down to Computer Configuration > Windows Settings > Security Settings.
• Right-click on "Software Restriction Policies" and create new policies.

 

What if I still want to use CAS in .NET 4.0?


“<NetFx40_LegacySecurityPolicy>” configuration element lets you specify that a process or library uses CAS policy. When you activate this element, the policy and evidence overloads will work as they did in older versions of the .NET framework.

 <configuration> <runtime> <NetFx40_LegacySecurityPolicy enabled="true"/> </runtime> </configuration> 


http://blogs.rev-net.com/ddewinter/2010/03/02/tip-20-opting-out-of-security-changes-in-net-4-in-asp-net-and-custom-appdomains/

 

References

MSDN link to CAS http://msdn.microsoft.com/en-us/library/930b76w0(VS.90).aspx

What’s new in .NET 4.0 security http://www.simple-talk.com/dotnet/.net-framework/whats-new-in-code-access-security-in-.net-framework-4.0---part-i/

CAS in .NET nice simple article http://www.devx.com/vb2themax/article/19886/1954

Nice Q and A article explaining CAS http://justindeveloper.wordpress.com/2010/02/09/application-security-for-developers/

5 reasons why you would use sandboxing http://blogs.msdn.com/b/shawnfa/archive/2006/04/19/579066.aspx

Legacy CAS policy in .NET 4.0 backward compatibility http://blogs.rev-net.com/ddewinter/2010/03/02/tip-20-opting-out-of-security-changes-in-net-4-in-asp-net-and-custom-appdomains/

 

Repost 0
Published by questpond.over-blog.com
write a comment

Important .NET and C# interview questions and answers

.Net interview questions: - Explain why it is not preferred to use finalize for clean up?

.Net interview questions: - Show the five levels in CMMI?

.NET interview questions and answers: – Which is the best place to store connection string in .NET projects?

C# interview questions and answers: – Explain the use of Icomparable in c#?

C# interview questions: - How can we check which rows have changed since dataset was loaded?

C# interview questions and answers: - Can you write a simple c# code to display Fibonacci series?

.NET interview questions and answers: - What is difference betweenIcomparable VS Icomparer ?

C# and .NET interview question: -What is short circuiting in C#?

C# and .NET interview question: - What are symmetric and asymmetric algorithms?

Important c# and .NET interview question on object pooling and Gridview events?

.NETinterview questions and answers: – Will the finally run in this code?

How to prepare for c# and .NETinterviews?

C# and .NET Interview questions: - What is Thread.Join () in threading?

.NET Interview questions and answers: -What is serialization and deserialization in .NET?

C# and .NET interview question: - What is hashing?

c# and .NET interview question:- what connects dataset and data source ?

.Net interview questions and answers: - What is the difference between “Web.config” and “Machine.Config”?

.NET interview questions and answers: - What is TPL?

.NET Interview questions and answers: -What are different access modifiers?

.NET and c# Interview Question and answers: – If we want to update interface with new methods, what is the best practice?

 MVC ( Model view controller) interview questions and answers      

ASP.NET Application and Page Life Cycle 

12 Important FAQ’s on VSTS Testing (Unit testing, load testing, automated testing, database testing and code coverage) 

 6 important use of Partial/Mock testing

6 important uses of Delegates and Events

7 Simple Steps to Run Your First Azure Blob Program

8 Steps to Create Workflows using SharePoint Designer

Azure FAQ Part 1

C# Code Reviews using StyleCop – Detailed Article

Four real world uses of Partial classes and Partial methods

SharePoint Quick Start FAQ Part 1

SharePoint Quick Start FAQ Part 6 – Workflows, Workflows and Workflows

SharePoint Workflow Basics

 

 

 

 

MVC Interview questions videos

Viewdata,viewbag,tempdata

 

MVC asynch controllers

What is View Model in ASP.NET MVC?



ADO.NET interview questions videos



Explain ADO.NET Connection pooling

 

 

Windows Phone Application Questions Videos

 

How to create a simple windows phone application ?

 

 

MVC Interview questions and answers Article

 

(Model view controller)MVC Interview questions and answers

MVC interview questions with answers video: – What is Web API how to implement the same?

ASP.Net MVC  4 interview questions with answers: - What is Bundling and minification in Model view controller ?

MVC interview questions with answers :- Is it possible to return values instead of Actionresults?

MVC interview questions with answers :- What are the actionresults available in MVC?

MVC interview questions with answers:-Html.PartialvsHtml.RenderPartialvsHtml.RenderPage in MVC

MVC ASP.NET INTERVIEW QUESTIONS WITH ANSWERS :- WHAT IS THE DIFFERENCE BETWEEN VIEWSTATE VS VIEWDATA ?

MVC vs ASP.NET ( MVC Interview question with answers )?

How can we detect that a MVC controller is called by POST or GET ? ( ASP.NET MVC Interview questions with answers)

What are the different ways by which you will get Form Data in controller? ( MVC Interview questions with answers)

What is the difference between Presenter and Controller in MVC?(MVC interview questions with answers)

Learn MVC (Model view controller) Step by Step in 7 days – Day 4

MVC Interview questions and answers PDF

MVC interview questions with answers

ActionResult vs. View() vs. ViewResult :- MVC interview questions with answers

Explain Areas in MVC?( MVC interview questions with answers)

Can you explain the purpose of ViewModel in MVC?( ASP.NET MVC Interview questions with answers)

ASP.NET MVC interview questions: - What are Filters in MVC?

What are areas in MVC?( MVC Interview questions with answers)

Explain the concept of View Model in MVC?

Exception Handling in MVC

Explain MVC application life cycle?


100 MVC Interview question PDF download released , Enjoy


Learn Microsoft Business intelligence step by step – Day 1


Can you create TempBag just like ViewBag?( MVC Interview questions)


MVC Unit Testing Unleashed

MVC and .NET learning tutorials for components of MVC and how do you perform unit testing in MVC?

Explain MVC model binders ? ( ASP.NET MVC interview questions)

Explain the difference between layout and master pages ? (MVC Razor interview questions)

Advantages of ViewModel in MVC(Model View Controller)

Difference Between ViewResult() and ActionResult() in MVC ?

What is the difference between each version of MVC 2, 3, 4, 5 and 6? (MVC Interview Questions)

Learn ASP.NET MVC 5 Step by Step in 30 days – Day 1

Can we overload MVC controller action methods ? (MVC Polymorphism) 

Can we overload Actions / Controllers in MVC? (MVC Interview questions)

 


WCF Interview questions videos

 

overloading in WCF

WCF fault exceptions ?

 

 

 

 

WPF Interview question with answers videos

 

Why WPF and compare WPF with Winforms ?

 

 

C# Interview Questions & Answers Article

 

12 Important FAQ’s on VSTS Testing (Unit testing, load testing, automated testing, database testing and code coverage)

6 important use of Partial/Mock testing

6 important uses of Delegates and Events

7 Simple Steps to Run Your First Azure Blob Program

8 Steps to Create Workflows using SharePoint Designer

Azure FAQ Part 1

C# Code Reviews using StyleCop – Detailed Article

Four real world uses of Partial classes and Partial methods

SharePoint Quick Start FAQ Part 1

SharePoint Quick Start FAQ Part 6 – Workflows, Workflows and Workflows

SharePoint Workflow Basics

C# (Csharp) interview questions and answers: – What are indexers in .NET?

C# OOP interview questions and answers: - I do not want to implement all the interface methods?

C# design pattern (UNIT of Work Design Pattern)

C# design pattern interview questions – What is Dependency injection ?

C# interview questions and answers: - What is the difference between “==” and .Equals()?

How questions are asked in c# interviews?

C# design pattern interview question: - DI vs IOC

8 important C# Interview questions on IL code, JIT, CLR, CTS, CLS and CAS

What is the difference between Reflection and Dynamic in C#?

C# and .NET interview question: – When should we use Structure as compared to classes
?

C# REST interview questions with answers asked in Polaris Hydrebad

c# threading interview questions :- Parallel.ForEach vs Task.Factory.StartNew

C# circular dependency interview questions with answers.

C# Design pattern interview questions with answers: - How Singleton is different from Static class?

C# and .NET interview questions with answers: - How can we mark a method as deprecated?

C# INTERVIEW QUESTIONS WITH ANSWERS: - HOW TO ASSIGN MULTILINE STRING IN VISUAL STUDIO?

What is cyclomatic complexity (C# testing interview questions with answers)?

Define code coverage? (C# unit testing interview questions with answers)

Can you talk about Abstraction and Encapsulation in detail ? ( .NET, c# and OOP interview questions with answers )

Can you explain a practical example of virtual and Override? ( C# OOP interview questions with answers )

Can you explain class and object in real time scenario? ( C# and .NET OOP Interview questions with answers)

What is code digger ? ( C# visual studio interview questions with answers)

C# Lazy loading interview questions with answers

What is eager loading in c# ( C# eager loading interview questions with answers)?

Can you explain the term concurrency? (C# Interview questions with answers)

10 important C# Constructor and destructor interview questions

3 important c# Partial class interview questions with answers

Change Functionality without changing function( C# Architecture interview question with answers)?

What is ENUM and what are the benefits of using it (ENUM C# Interview Question 1)?

How can we loop through ENUM values( C# ENUM Interview questions with answers)?

What is the difference between Connection Timeout and Command Timeout?( C# ADO.NET Interview questions with answers)

How you differentiate Shadowing with Overriding? (C# overriding interview questions)

C# date and time interview question with answers

Explain the difference between early binding and late binding? ( C# interview questions with answers)

How can we restrict types in generics ?( C# generic interview questions)

What are generics, Delegates and Generic delegates ( C# interview questions)?

How can we convert JSON string in to c# object?(  C# JSON interview questions)

C# and .NET interview questions asked in TCSwalkin.

C# and .NET interview questions on Coalescing operator.

String vs string ( C# interview questions with answers)

Explain SOLID principles (C# Architecture interview questions)?

C# and .NET interview questions around Read only and Constant

C# Architecture interview questions with answers

C# Mock testing interview questions and answers: – What is Mock testing and how can we implement Mocking?

Write a simple regex for email validation? (C# interview questions with answers)


C#.NET interview questions: - What is the use of “Yield” keyword? Mention atleast one practical scenario where it can be used?

C#.NET interview questions: - What is the difference between Build Vs Rebuild Vs Clean solution menu? What is the difference “Rebuild” and if you do “Clean” + “Build”?

C# and .NET interview questions around JIT and NGEN


What is the difference between throw vs throw ex ?( C# Interview questions with answers)

C#/.NET interview questions: - What are the steps included to get a collection of records from database in C#?


Learn C# in Hindi video tutorials


QuestPond’s real life examples on Extension methods and nullable types in C#.NET


Why Microsoft has partial classes and Java does not?

 

 

 

WCF INTERVIEW QUESTIONS AND ANSWERS ARTICLE

 

 

WCF INTERVIEW QUESTIONS AND ANSWERS: - WHAT IS THE DIFFERENCE BETWEEN SERVICE ENDPOINT AND CLIENT ENDPOINT

 

WCF INTERVIEW QUESTIONS WITH ANSWERS: - WCF REST VS. WEB API

 

WCF INTERVIEW QUESTIONS WITH ANSWERS :- CAN WE HAVE METHOD OVERLOADING WHILE DEFINING WCF SERVICE OPERATIONS ?

 

WCF INTERVIEW QUESTIONS WITH ANSWERS :- WHAT IS DATACONTRACTSERIALIZER AND HOW IT’S DIFFERENT FROM XMLSERIALIZER 

What is SOA and what is WCF? ( WCF interview questions with answers)

Six important WCF interview questions with answers

6 important WCF Instancing interview questions with answers

WCF Service metadata interview questions with answers

7 WCF SOA interview questions with answers

What are the various ways of consuming WCF services?(WCF C# interview questions with answers)

What is the difference between Serialization and Encoding in WCF?( WCF interview questions with answers)

Why returning dataset or data table from WCF service is not a good practice?(WCF service interview questions with answers)

WCF transaction interview questions: - How transaction works in WCF?

WCF Transaction interview questions.

.NET WCF(Windows Communication Foundation) interview questions: - Distinguish between Web Services and Remoting | WCF and Web services

WCF interview questions: - What exactly do you mean by Single in WCF instancing? How to set and what is by default set value of instance context mode?

Explain WCF Duplex services? ( WCF Interview questions)

QuestPond: Interview Questions and Answers on learning WCF

WCF Interview Questions: - What are the different ways of doing WCF concurrency and WCF instancing?

QuestPond: Interview Questions and Answers on learning WCF (Windows Communication Foundation)

QuestPond: Interview Questions and Answers on learning WCF (Windows Communication Foundation)

QuestPond: Interview Questions and Answers on WCF(Windows Communication Foundation)

QuestPond: Interview Questions and Answers on learning WCF (Windows Communication Foundation)

QuestPond’s Interview Questions & Answers on learning data contract serializer and XML serializer

QuestPond’s Interview Questions & Answers on learning serialization events

QuestPond’s Interview Questions & Answers on learning WCF(Windows Communication Foundation)

QuestPond’s Interview Questions & Answers on WCF(Windows Communication Foundation)


QuestPond’s Interview Questions & Answers on WCF(Windows Communication Foundation)

QuestPond’s Interview Questions & Answers on WCF (Windows Communication Foundation)


QuestPond’s Interview Questions & Answers on WCF (Windows Communication Foundation)

 

 

 

WPF Interview Questions And Answers Article

 

 

6 IMPORTANT WPF AND SILVERLIGHT MULTI-THREADING INTERVIEW QUESTIONS WITH ANSWERS

 

C# WPF INTERVIEW QUESTIONS::- WHAT ARE DEPENDENCY PROPERTIES ?

 

WPF INTERVIEW QUESTIONS WITH ANSWERS: – WHAT ARE WPF CONVERTERS?

 

WPF INTERVIEW QUESTIONS ON EVENTS (TUNNELING, BUBBLING AND DIRECT)

 

What are the advantages of using WPF ( WPF interview questions with answers)?

 

Explain WPF bindings?( .Net WPF Binding interview questions)

 

WPF Interview questions with answers :-What is XAML in WPF and why do we need it?

 

What are the different kinds of controls in WPF?(C# WPF Interview questions with answers)

 

Can you explain the complete WPF object hierarchy?(WPF Interview questions with answers)

How does “UpdateSourceTrigger” affect bindings?( C# WPF interview questions with answers)

WPF Interview questions :- Which are the different namespaces and classes in WPF ?

What are resources in WPF? (C# WPF Interview questions with answers)

Explain multi binding and multivalue converters? (.NET WPF  Interview questions with answers)

Explain the difference between static and dynamicresource? (.NET WPF interview questions)

18 important WPF interview questions asked in WPF interviews.

.NET WPF(Windows Presentation Foundation) interview questions: - What is WPF? What are the advantages of WPF over Winforms?

Explain WPF relative binding / relative resource? (.NET WPF Interview questions with answers)

Explain Ancestor relative source binding in WPF ? ( WPF Interview questions with answers)

Explain the need of binding and commands?(WPF Interview questions)

Can you explain WPF command with an example? ( WPF Interview questions with answers)

Explain the need of “INotifyPropertyChanged” interface? ( C# WPF Interview questions with answers)

What is MVVM? (WPF MVVM Interview questions)

What is the importance of command and bindings in MVVM pattern? ( WPF MVVM Interview questions)

What is the difference between MVVM and 3 layer architecture? ( WPF  MVVM Interview questions with answers)

Explain delegate command? (WPF MVVM interview questions)

WPF Interview questions with answers

Explain WPF styles?(C# WPF Interview questions with answers)

Explain Multitrigger concept in WPF?( C# WPF Interview questions with answers)

How are WPF observable collections different from simple .NET collections? (.NET WPF Interview questions)

What is the difference between control templates and data templates? ( .NET WPF Interview questions)

What are various ways of doing alignment in WPF?( WPF Interview questions with answers)

 

Algorithm Interview Questions


Algorithm interview questions and answers: – Can you write code for bubble sort algorithm?

Algorithm interview questions and answers: – What is inserted sort algorithm?

SQL INTERVIEW QUESTIONS & ANSWERS ARTICLE

 

SQL Server Interview Questions & Answers Article

SQL Server interview questions and answers: - What is HID data type in SQL Server ?

SQL Server interview questions with answers: – How to get the top record without using max, top and order by keyword?

SQL Server interview questions with answers :- If you wish to store financial values which SQL Server data type is more suitable ?

SQL Server interview questions and answers: – What is the difference between Candidate Key, Primary Key, and Alternate Key

SQL Server interview questions with answers :- What are Indexes in Sql Server?

How to sort interactively using SSRS? (SQL Server reporting services interview questions)

How to do conditional formatting in SSRS? (SQL Server reporting services interview questions with answers)

WHAT IS NORMALIZATION AND EXPLAIN 1NF 2NF AND 3NF IN SIMPLE WORDS? SQL SERVER INTERVIEW QUESTIONS WITH ANSWERS

What is the difference between Stored Procedures and Function (SQL Server interview question with answers)?

 

When you will use inner join and when you will use outer join? SQL Server interview questions with answers

 

Do you know anything about Temporary procedures in SQL?( SQL Server interview questions with answers)

 

4 SQL Server interview questions with answers on TempTb

 

Are full outer join and Cross join are same? ( SQL Server interview questions with answers)

 

Delete duplicate records: - SQL Server interview questions with answers

 

4 most asked  SQL queries during SQL Serverinterview’s

 

How Temporary tables are different from normal tables and what are its types ?( SQL Server interview questions with answers)

 

SQL Server interview Questions on JOIN’s

 

SQL Server interview questions: - How can you increase SQL performance?

 

SQL Server interview questions: - What problem you face if locking is not implemented?

 

Can we insert NULL’s in to UNIQUE key ? ( SQL Server  interview questions with answers)

 

Explain Normalization?(SQL Server Interview questions with answers)

Temp variablesVS Temp tables(SQL Server interview questions)

 


 




.NET INTERVIEW QUESTIONS & ANSWERS ARTICLE

 

.NET interview questions and answers: - How to reverse a string in .NET ( DotNet)?

.NET interview questions and answers: - What is the use of Click Once?

.NET interview questions and answers: - Will the below codes create new instances?

C# and .NET interview questions with answers – What is Nuget?

Dependency injection (DI) VS Inversion of Control (IOC)

.NET interview questions with answers: - What is the difference between Reflection and Dynamic?

Five Great .NET Framework 4.5 Features

ASP.NET MVC 4 interview questions with answers: - What is the use of “AllowHTML” and “ValidateInput” attributes?

.NET interview questions 6th edition (Sixth edition) - By Shivprasad Koirala

.NET interview questions with answers: – Can we use events without delegates ?

.Net Interview question Edition 6 is available now.

.NET interview questions with answers: – What’s the difference between catch with parameter and catch without parameter?

.NET interview questions : - What is the use and difference between “IS” and “AS” keyword?

.NET interview questions with answers: - Build solution VS Rebuild solution VS Clean solution

HTML 5 interview questions with answers for LocalStorage and SessionStorage

.NET 4.0 interview questions with answers: – What are code contracts?

What are portable class libraries? ( .NET interview questions with answers)

How to loop through ENUM using C# (.NET interview questions with answers)?

What are transactions in C#? (.NET interview questions with answers)

What are ACID Properties( .NET Interview questions with answers)?

.NET interview questions: – What are the areas that need to be concentrated for senior(9+ years experience)persons in .NET technologies?

.NET interview questions: - Explain real time scenarios in Factory Pattern, Abstract Pattern, Singleton, WCF and REST services

What is the difference between IS A and Can a Relationship?( .NET Interview questions with answers)

What is the use of ENUM Flags(.NET Enum Interview question 2)?

What is the difference between .Net,C#, Asp.net, Asp.net Web Forms and Asp.net MVC and MVC?( C# and ASP.NET Interview questions)

ADO.NET interview questions: - Explain in detail the fundamental of connection pooling?

.NET interview questions: – Can you explain generics in .NET?

What are Properties and methods ? ( .NET OOP Interview questions with answers)

What’s the first step you take for implementing any of Design Pattern?( .NET  Design pattern interview questions with answers)

.NET interview questions: - What are different types of JIT?

ADO.NET Interview Question: - What are the major differences between classic ADO and ADO.NET?

.NET interview questions: – What is the difference between Reflection and Dynamic?

What is the Use of interfaces?( .NET Interview questions with answers)

.NET interview questions: - What role did you play in your project and company?

Visual studio 2012 Fakes

.NET interview questions: - So how can we clean unmanaged objects and also maintain performance?

ADO.NET Interview Questions: - What are basic methods of Data adapter?

.NET interview questions: - What are system level exceptions and application level exceptions?

.NET interview questions: - What is UML and which are the important diagrams?

.NET interview questions: - What is time out support in regex (regular expression)?

.NET interview questions: - How can we improve performance of .NET?

.NET interview questions: - Can you explain the concept of “Short Circuiting”?

.NET interview questions: - Can you explain Forms authentication in detail?

What is the difference between VAR and Dynamic keyword? ( .NET Interview questions with answers)

.NET interview questions: - What are similarities and difference between Class and structure?

Can you compare String.IsNullOrEmpty vs String.IsNullOrWhiteSpace ? ( .Net Interview questions with answers)

.NET interview questions: - Distinguish between Reflection and Dynamic?

.NET interview questions: - In which scenarios we can use serialization and when to use what binary serialization or XML serialization?

.NET interview questions: - Are there any readymade objects in .NET by which we can implement Lazy loading?

.NET interview questions: - What are different access modifiers?

ADO.NET interview questions: - Explain in detail the fundamental of connection pooling how to enable and disable connection pooling?

ADO.NET interview questions: - What is the namespace in which .NET has the data functionality class?

ADO.NET interview questions: - What are the different components in ADO.NET?

ADO.NET interview questions: - Show difference between “Optimistic” and “Pessimistic” locking and how many ways are there to implement optimistic locking in ADO.NET?

.NET interview questions: - Does code contract only do dynamic checks?

ADO.NET interview questions: - How can we fire a simple SQL Statement using ADO.NET?

.NET interview questions: - What basic steps are needed to display a simple report in crystal?

ADO.NET interview questions: - What are basic methods of Data adapter and mention the use of data adapter?

.NET interview questions: - What is UML? How many types of diagrams are there in UML?

.Net Interview Questions - What is MVC, MVP and MVVM pattern?

.NET interview questions: - How can you define a property read only for external world and writable in the same assembly?

Explain the implicit and explicit conversion of data types with examples?( .NET interview questions on data type)

.NET interview questions: - What is Reflection its implementation and practical uses?

What is downcasting and upcasting? (.NET interview questions with answers)

.NET interview questions: - How to decide on the design consideration to take a Data grid, data list or repeater?

.NET interview questions: - If we want to update interface with new methods, what is the best practice?

.NET interview questions: - How does selection sort algorithm works?

XML(.NET) interview questions: - What is XML?

.NET Interview questions: - If a validation is very complex what will you do?

.NET interview questions: - How can we stop the class from further inheriting?

XML (.NET) Interview questions :- Explain simple Walk through of XmlReader.

.NET interview questions : - How can we improve performance of .NET and show the difference between .NET 1.X, 2.0, 3.0, 3.5 and 4.0?

How to convert string to ENUM value ?( .NET interview questions with answers)

.NET architecture interview questions series: - What is mean by modeling language?

.NET architecture interview questions : - What are benefits and Limitation of using Viewstate, hidden frames and Cookies?

.NET interview questions: - What is GAC (Global Assembly Cache)?

.NET interview questions: - Explain Nuget?

.NET Testing interview questions: - What is the difference between Unit testing, Assembly testing and Regression testing?


.NET interview questions: - What is Code Access Security (CAS) and how does it work? Is CAS supported in .NET 4.0?


.NET interview questions: - What are the advantages /disadvantages of lazy loading?


.NET interview questions: - What is the use of DEBUG directive?


.NET testing interview questions: - What is Mock testing and how to implement it?


.NET interview questions: - What is the difference between DEBUG and Release?


.NET testing interview questions: - How can we UNIT test private methods using VSTS? Is it good to practice to UNIT test Private methods?


Explain 3 layer architecture ( .NET Interview questions)?


.NET interview questions : - What is a delegate and how can we create a delegate? What is a multicast delegate?


ADO.NET interview questions: - How to add/remove row is in “Data Table” object of “Dataset”? How to load multiple tables in a Dataset & adding relation between tables in a Dataset?


What is the difference between Array, ArrayList and List?( .Net Interview questions)

.NET interview questions: - How to implement DTC in .NET?
.NET interview questions: - What is an Interface and what are abstract classes

.NET interview questions: - Interface vs. abstract class

.NET interview questions: - How to implement practically Lazy loading in .NET?


.NET interview questions: - How can we handle exceptions in .NET? What if we do not catch the exception?

.NET interview questions based on Projects.


.NET interview questions: - What is shadowing? What is the difference between Shadowing and Overriding?

.NET interview questions: - All about Design Patterns in .NET


.NET interview questions: - How can we improve performance of .NET/ASP.NET/SQL Server?

.NET interview questions: - What benefits does sealed keyword provide?


.NET Architecture UML interview question


.NET interview questions: - How to maintain performance and can clean unmanaged objects?


.NET interview questions: - Explain ENUM and its benefits? What is the use of Flagsin ENUM?

.NET interview questions: - How to create a windows service using .NET?

.NET interview questions: - Explain in details about Indexer and can we have static indexer in C#?

.NET interview questions: - What is the difference between arraylist and list? Are Arraylist faster or Arrays?

.NET interview questions: - What is Native Image Generator (Ngen.exe)? Does NGEN.EXE always improve performance?

.NET OOPS interview questions: - What is OOP? What are different properties provided by Object-oriented systems?

.NET OOPS interview questions: - How abstract with only abstract method is it different from interfaces? Also mention best practice to update interface with new methods?

.NET interview questions: - What is the difference between delegate and events? Can we have return type, access modifiers and shared events?

.NET interview questions: - What is Manifest? Where is the version information stored of an assembly? Is versioning applicable to private assemblies?

.NET Generics interview questions: - Explain Generics and concept of Generic Collection in .NET?

How to learn .NET: - In parent-child relationship which constructor will fire first and in which instances you will declare a constructor private?

Basics of .NET and learning tutorials on CTS and CLS


Online resource to learn .NET on Reflection and Dynamic

Online guide to learn .NET for Object initializer in C#?

QuestPond for Freshers on IL code, JIT, CLR, CTS, CLS and CAS

QuestPond: Interview Questions and Answers on AJAX and how does it help?



ASP.NET Interview Questions & Answers Article










MVC Interview Questions And Answers Article

 

(MODEL VIEW CONTROLLER)MVC INTERVIEW QUESTIONS AND ANSWERS

 

MVC INTERVIEW QUESTIONS WITH ANSWERS VIDEO: – WHAT IS WEB API HOW TO IMPLEMENT THE SAME?

 

ASP.NET MVC  4 INTERVIEW QUESTIONS WITH ANSWERS: - WHAT IS BUNDLING AND MINIFICATION IN MODEL VIEW CONTROLLER ?

 

MVC INTERVIEW QUESTIONS WITH ANSWERS :- IS IT POSSIBLE TO RETURN VALUES INSTEAD OF ACTIONRESULTS?

 

MVC INTERVIEW QUESTIONS WITH ANSWERS :- WHAT ARE THE ACTIONRESULTS AVAILABLE IN MVC?

 

MVC INTERVIEW QUESTIONS WITH ANSWERS:-HTML.PARTIALVSHTML.RENDERPARTIALVSHTML.RENDERPAGE IN MVC

MVC VS ASP.NET ( MVC INTERVIEW QUESTION WITH ANSWERS )?

 

HOW CAN WE DETECT THAT A MVC CONTROLLER IS CALLED BY POST OR GET ? ( ASP.NET MVC INTERVIEW QUESTIONS WITH ANSWERS)

 

WHAT ARE THE DIFFERENT WAYS BY WHICH YOU WILL GET FORM DATA IN CONTROLLER? ( MVC INTERVIEW QUESTIONS WITH ANSWERS)

 

WHAT IS THE DIFFERENCE BETWEEN PRESENTER AND CONTROLLER IN MVC?(MVC INTERVIEW QUESTIONS WITH ANSWERS)

 

LEARN MVC (MODEL VIEW CONTROLLER) STEP BY STEP IN 7 DAYS – DAY 4

 

MVC Interview questions and answers PDF

 

MVC interview questions with answers

 

ActionResult vs. View() vs. ViewResult :- MVC interview questions with answers

Explain Areas in MVC?( MVC interview questions with answers)

 

Can you explain the purpose of ViewModel in MVC?( ASP.NET MVC Interview questions with answers)

ASP.NET MVC interview questions: - What are Filters in MVC?

What are areas in MVC?( MVC Interview questions with answers)

Explain the concept of View Model in MVC? 

Exception Handling in MVC

Explain MVC application life cycle?

100 MVC Interview question PDF download released , Enjoy

How can we use two (multiple) models with a single view?(MVC Interview questions)

MVC HTML.Form vs Ajax.Form – MVC interview questions with answers

Learn Microsoft Business intelligence step by step – Day 1

Can you create TempBag just like ViewBag?( MVC Interview questions)

MVC Unit Testing Unleashed

MVC and .NET learning tutorials for components of MVC and how do you perform unit testing in MVC?

Explain MVC model binders ? ( ASP.NET MVC interview questions)

Explain the difference between layout and master pages ? (MVC Razor interview questions) 


ENTITY FRAMEWORK INTERVIEW QUESTIONS ARTICLE


Windows Workflow Foundation(WWF) interview questions with answers Article

XML Interview Questions With Answers Article


Explain XML,DTD and XSL?(XML interview questions with answers)

HTML 5 Interview questions With Answers Article

HTML 5 interview questions with answers for LocalStorage and SessionStorage

 

How is the page structure of HTML 5 different from HTML 4?( HTML 5 Interview questions with answers)

 

What is datalist in HTML 5 ( ASP.NET HTML interview questions)?

 

What are the different new form element types in HTML 5?( ASP.NET HTML 5 interview questions with answers)

 

What is output element in HTML 5?( ASP.NET HTML 5 interview questions)

 

What is the difference between Canvas and SVG graphics?(ASP.NET HTML 5 interview questions with answers)

 

ASP.NET HTML 5 interview questions on SVG and Canvas

ASP.NET HTML5 interview questions with answers

What are web workers and why do we need them ?( ASP.NET HTML interview questions with answers)

 

Why do we need HTML 5 server-sent events? (ASP.NET HTML interview questions)

How can we add and remove data from local storage?(ASP.NET HTML 5 interview questions)

What is local storage concept in HTML 5? ( ASP.NET HTML 5 interview questions)

What is the difference between local storage and cookies? ( ASP.NET HTML 5 interview questions)

What is WebSQL?( ASP.Net HTML 5 interview questions)

 

What is session storage and how can you create one?( ASP.Net HTML 5 interview questions with answers)

 

What is application cache in HTML5?( ASP.NET HTML 5 interview questions with answers)

ASP.NET HTML 5 Application cache interview questions with answers

 

Explain the term cascading in style sheet ? ( CSS Interview questions)

What is difference between DIV vs SPAN in HTML ?( ASP.Net Interview questions)

HTML 5 Canvas Interview questions: - Canvas in HTML 5.

QuestPond’s interview questions and answers on HTML 5

 

Learn HTML 5 in 3 days – Day 1

 

 

 

Dotnetspider Questions And Answers Article

 

 

What is downcasting and upcasting ? ( .NET interview questions with videos)

 

What is the difference between String vs string? ( C# interview questions) ?

 

 

JAVASCRIPT INTERVIEW QUESTIONS WITH ANSWERS ARTICLE

 


3 IMPORTANT JAVASCRIPT IMPORTANT INTERVIEW QUESTION WITH ANSWERS