Wednesday, December 29, 2010

22 important.net interview questions on ATLAS-AJAX

22 important.net interview questions on ATLAS-AJAX

This section will cover the most asked questions related to ATLAS-AJAX during .net interview by the interviewer so have a look on the following and do revise it when ever you go for the .net interview
Normally the .net interviewer starts with.....

What problem does Ajax solve?
What is Ajax?
What is the fundamental behind Ajax?
What is JSON?
How do we use XMLHttpRequest object in JavaScript?
How do we do asynchronous processing using Ajax?
What are the various states in XMLHttpRequest and how do we check the
same?

How can we get response text?
How can we send request to the server using the XMLHttpRequest component?
How do we pass parameters to the server?
How can we create a class in JavaScript using Atlas?
How do we do inheritance-using Atlas?
How do we define interfaces using Atlas?
How do we reference HTML controls using Atlas?
Can you explain Scriptmanager control in Ajax?
Can you explain Enablepartialrendering and UpdatePanel control in Ajax?
Can you explain the concept of triggers in ‘UpdatePanel’ control?
Can you explain the ‘UpdateProgress’ component?
How can you do validations in Ajax?
How do we do exception handling in Ajax?
How do we consume web service in Atlas?
How can we consume data directly in web services?

So friends answering to above question on ATLAS-AJAX of .net interview questions helped me to clear topic on ATLAS-AJAX in front of the interviewer.

Tuesday, December 28, 2010

20 important SQL Server interview questions - Part 2

20 important SQL Server interview questions - Part 2


This section will cover the most asked SQL Server interview questions by the interviewer so have a look on the following and do revise it when ever you go for the SQL Server interview
Normally SQL Server interview starts with.....


If locking is not implemented, what issues can occur?
What are different transaction levels in SQL SERVER?
What are the different locks in SQL SERVER?
Can we suggest locking hints to SQL SERVER?
What is LOCK escalation?
What are the different ways of moving data between databases in SQL
Server?

What are advantages of SQL 2000 over SQl 7.0?
What is the difference between a HAVING CLAUSE and a WHERE CLAUSE?
What is the difference between UNION and UNION ALL SQL syntax?
How can you raise custom errors from stored procedure?
What is ACID fundamental?
What are transactions in SQL SERVER?
What is DBCC?
What is the purpose of Replication?
What are the different types of replication supported by SQL SERVER?
What is BCP utility in SQL SERVER?
What are the different types of triggers in SQl SERVER?
If we have multiple AFTER Triggers on table how can we define the sequence
of the triggers?

What is SQL injection?
What is the difference between Stored Procedure (SP) and User Defined
Function (UDF)?


So friends answering to above question on SQL Server interview questions helped me to clear in front of the interviewer.

Monday, December 27, 2010

18 important SQL Server interview questions - Part1

18 importantSQL Server interview questions - Part1



This section will cover the most asked SQL Server interview questions by the interviewer so have a look on the following and do revise it when ever you go for the SQL Server interview

Normally SQL Server interview starts with.....

What is normalization?
What are different types of normalization?
What is denormalization?
What is a candidate key?
What are the different types of joins?
What is the difference between them?
What are indexes?
What is the difference between clustered and nonclustered indexes?
How can you increase SQL performance?
What is the use of OLAP?
What is a measure in OLAP?
What are dimensions in OLAP?
What are levels in dimensions?
What are fact tables and dimension tables in OLAP?
What is DTS?
What is fill factor?
What is RAID and how does it work?
What is the difference between DELETE TABLE and TRUNCATE TABLE commands?

So friends answering to above question on SQL Server interview questions helped me to clear in front of the interviewer.

Friday, December 24, 2010

32 importantASP.NET interview questions - Part 2

32 importantASP.NET interview questions - Part 2


This section will cover the most asked questions related to ASP.NET interview questions by the interviewer so have a look on the following and do revise it when ever you go for the ASP.NET interview

Normally the ASP.NET interviewer starts with.....
Difference between ASP and ASP.NET?
What are major events in GLOBAL.ASAX file?
What order they are triggered?
Do session use cookies?
How can we force all the validation control to run?
How can we check if all the validation control are valid and proper?
If client side validation is enabled in your Web page, does that mean
server side code is not run?

Which JavaScript file is referenced for validating the validators at the
client side?

How to disable client side script in validators?
How can I show the entire validation error message in a message box on the
client side?

You find that one of your validations is very complicated and does not fit
in any of the validators, what will you do?

What exactly happens when ASPX page is requested from a browser?
How can we kill a user session?
How do you upload a file in ASP.NET?
How do I send email message from ASP.NET?
What are different IIS isolation levels?
ASP used STA threading model, what is the threading model used for ASP.NET?
What is the use of <%@ page aspcompat=true %> attribute?
Explain the differences between Server-side and Client-side code?
Can you explain Forms authentication in detail?
How do I sign out in forms authentication?
If cookies are not enabled at browser end does form Authentication work?
How to use a checkbox in a data grid?
What are the steps to create a windows service in VB.NET?
What is the difference between “Web farms” and “Web garden”?
How do we configure “Web Garden”?
What is the main difference between Grid layout and Flow Layout?
What is the difference between trace and debug in ASP.NET?
How do you enable tracing in on an ASP.NET page?
Which namespace is needed to implement debug and trace ?
Can you explain the concept of trace listener?
What are trace switches?

So friends answering to above question on ASP.NET interview questions helped me to clear topic in front of the interviewer.

Wednesday, December 22, 2010

29 important ASP.NET interview questions - Part 1

29 important ASP.NET interview questions - Part 1


This section will cover the most asked questions related to ASP.NET interview questions by the
interviewer so have a look on the following and do revise it when ever you go for the ASP.NET interview
Normally the ASP.NET interviewer starts with.....

What’ is the sequence in which ASP.NET events are processed?
In which event are the controls fully loaded?
How can we identify that the Page is Post Back?
How does ASP.NET maintain state in between subsequent request?
What is event bubbling?
How do we assign page specific attributes?
How do we ensure viewstate is not tampered?
What is the use of @ Register directives?
What is the use of Smart Navigation property?
What is AppSetting Section in “Web.Config” file?
Where is View State information stored?
What is the use of @ Output Cache directive in ASP.NET?
How can we create custom controls in ASP.NET?
How many types of validation controls are provided by ASP.NET?
Can you explain “AutoPostBack”?
How can you enable automatic paging in Data Grid?
What is the use of “GLOBAL.ASAX” file?
What is the difference between “Web.config” and “Machine.Config”?
What is a SESSION and APPLICATION object?
What is the difference between ‘Server.Transfer’ and ‘response. Redirect’ ?
What is the difference between Authentication and authorization?
What is impersonation in ASP.NET?
Can you explain in brief how the ASP.NET authentication process works?
What are the various ways of authentication techniques in ASP.NET?
How does authorization work in ASP.NET?
What is difference between Data grid, Datalist, and repeater?
From performance point of view, how do they rate?
What is the method to customize columns in Data Grid?
How can we format data inside Data Grid?
How to decide on the design consideration to take a Data grid, data list,
or repeater?


So friends answering to above question on ASP.NET interview questions helped me to clear topic in front of the interviewer.

Tuesday, December 21, 2010

40 important .net interview questions on Fundamentals

40 important.net interview questions on Fundamentals

This section will cover the most asked questions related to Fundamentals during .net interview by the interviewer so have a look on the following and do revise .net interview questions when ever you go for the interview
Normally the .net interviewer starts with.....
How can we achieve inheritance in VB.NET?
What are abstract classes?
What is a Interface?
What is difference between abstract classes and interfaces?
What is a delegate?
What are Events?
Do events have return type?
Can events have access modifiers?
Can we have shared events?
What is shadowing?
What is the difference between Shadowing and Overriding?
What is the difference between delegate and events?
If we inherit a class do the private variables also get inherited?
What is the different accessibility levels defined in .NET?
Can you prevent a class from overriding?
What is the use of “Must inherit” keyword in VB.NET?
Do interface have accessibility modifier?
What are similarities between Class and structure?
What is the difference between Class and structure’s?
What does virtual keyword mean?
What are shared (VB.NET)/Static(C#) variables?
What is Dispose method in .NET?
What is the use of “Overrides” and “Overridable” keywords?
Where are all .NET Collection classes located?
What is ArrayList?
What is a HashTable?
What are queues and stacks?
What is ENUM?
What is nested Classes?
What is Operator overloading in .NET?
For the below code which constructor will fire first?
What is the significance of Finalize method in .NET?
How can we suppress a finalize method?
What is the use of DISPOSE method?
How do I force the Dispose method to be called automatically, as clients
can forget to call Dispose method?

In what instances you will declare a constructor to be private?
Can we have different access modifiers on get/set methods of a property ?
If we write a goto or a return statement in try and catch block will the
finally block execute?

What is Indexer?
Can we have static indexer in C#?
Can two catch blocks be executed?
What is the difference between System.String and System.StringBuilder
classes?

So friends answering to above question on Fundamentals of .net interview questions will help to
clear interview in front of the interviewer.

Monday, December 20, 2010

15 important .net interview questions on Interoperability

15 important.net interview questions on Interoperability


This section will cover the most asked questions related to Interoperability during .net interview by the interviewer so have a look on the following and do revise .net interview questions when ever you go for the interview
Normally the .net interviewer starts with.....

How can we use COM Components in .NET?
We have developed the COM wrapper do we have to still register the COM?
How can we use .NET components in COM?
How can we make Windows API calls in .NET?
When we use windows API in .NET is it managed or unmanaged code?
What is COM?
What is Reference counting in COM?
Can you describe IUKNOWN interface in short?
Can you explain what DCOM is?
How do we create DCOM object in VB6?
How to implement DTC in .NET?
How many types of Transactions are there in COM + .NET?
How do you do “object pooling” in .NET?
What are types of compatibility in VB6?
What is equivalent for regsvr32 exe in .NET?


So friends answering to above question on Interoperability of.net interview questions will help to
clear interview in front of the interviewer.

Saturday, December 18, 2010

30 important .net interview questions on XML

30 important .net interview questions on XML


This section will cover the most asked questions related to XML during .net interview by the interviewer so have a look on the following and do revise it when ever you go for the .net interview
Normally the .net interviewer starts with.....

What is XML?
What is the version information in XML?
What is ROOT element in XML?
If XML does not have closing tag will it work?
Is XML case sensitive?
What is the difference between XML and HTML?
Is XML meant to replace HTML?
Can you explain why your project needed XML?
What is DTD (Document Type Definition)?
What is well formed XML?
What is a valid XML?
What is CDATA section in XML?
What is CSS?
What is XSL?
What is element and attributes in XML?
Which are the namespaces in .NET used for XML?
What are the standard ways of parsing XML document?
In what scenarios will you use a DOM parser and SAX parser?
How was XML handled during COM times?
What is the main difference between MSML and .NET Framework XML classes?
What are the core functionalities in XML .NET framework?
Can you explain in detail those functionalities?
What is XSLT?
Define XPATH?
What is the concept of XPOINTER?
What is an XMLReader Class?
What is XMLTextReader?
How do we access attributes using “XmlReader”?
Explain simple Walk through of XmlReader?
What does XmlValidatingReader class do?

So friends answering to above question on XML of .net interview questions will help to clear interview in front of the interviewer.

Friday, December 17, 2010

25 important WCF interview questions

25 important WCF interview questions

This section will cover the most asked questions on WCF interview. So have a look on the following and do revise it when ever you go for the WCF interviewNormally WCF interviewer starts with.....


What are the important principles of SOA (Service oriented Architecture)?
What are ends, contract, address, and bindings?
Which specifications does WCF follow?
What are the main components of WCF?
Explain how Ends, Contract, Address, and Bindings are done in WCF?
What is a service class?
What is a service contract, operation contract and Data Contract?
What are the various ways of hosting a WCF service?
How do we host a WCF service in IIS?
What are the advantages of hosting WCF Services in IIS as compared to
self-hosting?

What are the major differences between services and Web services?
What is the difference WCF and Web services?
What are different bindings supported by WCF?
Which are the various programming approaches for WCF?
What is one-way operation?
Can you explain duplex contracts in WCF?
How can we host a service on two different protocols on a single server?
How can we use MSMQ bindings in WCF?
Can you explain transactions in WCF?
What different transaction isolation levels provided in WCF?
Can we do transactions using MSMQ?
Can we have two-way communications in MSMQ?
What are Volatile queues?
What are Dead letter queues?
What is a poison message?

So friends answering to above questions on WCF interview questions helped me to clear interview in front of the interviewer.

Wednesday, December 15, 2010

23 important .net interview questions on Localization/Globalization

23 important.net interview questions on Localization/Globalization

This section will cover the most asked questions related to Localization/Globalization during .net interview by the interviewer so have a look on the following and do revise it when ever you go
for the .net interview
Normally the .net interviewer starts with.....
What is Unicode & Why was it introduced?
Does .NET support UNICODE and How do you know it supports?
What is the difference between localization and globalization?
What architecture decisions you should consider while planning for
international software’s?

How do we get the current culture of the environment in windows and
ASP.NET?

Which are the important namespaces during localization and globalization?
What are resource files and How do we generate resource files?
Can resource file be in any other format other than resx extensions?
How is resource files actually used in project?
How can we use Culture Auto in project?
What are satellite assemblies?
How do we generate Satellite assemblies?
What is AL.EXE and RESGEN.EXE?

What is the use of resource manager class?
What precautions do we need to take while deploying satellite assemblies?
Can we get a strongly typed resource class rather than using resource
manager?

Can you explain the fundamentals of “GetGlobalResourceObject” and
“GetLocalResourceObject” functions?

Can we sign a satellite assembly?
Can you explain collation sequence in sql server?
How do we define collation sequence for database and tables?
Can we change the order in a select query with a specified collation
sequence?

Can you list best practices for globalization and localization?
Why is the culture set to the current thread?
So friends answering to above questions on Localization/Globalization of .net interview questions
will help you to clear interview in front of the interviewer.

Monday, December 13, 2010

29 important .net interview questions on Remoting and Webservices

29 important .net interview questions on Remoting and Webservices


This section will cover the most asked questions related to Remoting and Webservices during .net interview by the interviewer so have a look on the following and do revise it when ever you go for the .net interview
Normally the .net interviewer starts with....
What is an application domain?
What is .NET Remoting?
Which class does the remote object has to inherit?
What are two different types of remote object creation mode in .NET ?
Describe in detail Basic of SAO architecture of Remoting?
What are the situations you will use singleton architecture in remoting?
What is fundamental of published or precreated objects in Remoting?
What are the ways in which client can create object on server in CAO model?
Are CAO stateful in nature?
To create objects in CAO with ‘new’ keyword and what should be done?
Is it a good design practice to distribute the implementation to Remoting Client?
What are LeaseTime, SponsorshipTime, RenewonCallTime and
LeaseManagerPollTime?

Which config file has all the supported channels/protocol
How can you specify remoting parameters using Config files?
Can Non-Default constructors be used with Single Call SAO?
How can we call methods in remoting asynchronously?
What is Asynchronous One-Way Calls?
What is marshalling and What are different kinds of marshalling?

What is ObjRef object in remoting?

What is a Web Service?
What is UDDI?
What is DISCO?
What is WSDL?
What the different phase/steps of acquiring a proxy object in Web
service?

What the different phase/steps of acquiring a proxy object in Web
service?

What is file extension of Web services?
Which attribute is used in order that the method can be used as
WebService?

What are the steps to create a web service and consume it?
Do webservice have state?

So friends answering to above question on Remoting and Webservices of .net interview questions helped me to clear interview in front of the interviewer.

37 important interview questions on ADO.NET

37 important interview questions on
ADO.NET


This section will cover the most asked questions related to ADO.NET during .net interview by the interviewer so have a look on the following and do revise it when ever you go for the ADO.NET interview
Normally the .net interviewer starts with.....

What is the namespace in which .NET has the data functionality class?
Can you give an overview of ADO.NET architecture?
What are the two fundamental objects in ADO.NET?
What is difference between dataset and data reader?
What are major difference between classic ADO and ADO.NET?
What is the use of connection object?
What is the use of command objects?
What is the use of data adapter?
What are basic methods of Data adapter?
What is Dataset object?
What are the various objects in Dataset?
How can we connect to Microsoft Access, FoxPro, and Oracle etc?
How do we connect to SQL SERVER, which namespace do we use?
How do we use stored procedure in ADO.NET and How do we provide parameters
to the stored procedures?

How can we force the connection object to close after my data reader is
closed?

I want to force the data reader to return only schema of the data store
rather than data.

How can we fine-tune the command object whe we are expecting a single
row?

Which is the best place to store connection string in .NET projects?
What are the steps involved to fill a dataset?
What are the various methods provided by the dataset object to generate
XML?

How can we save all data from dataset?
How can we check that some changes have been made to dataset since it was
loaded?

How can we add/remove row is in “Data Table” object of “Dataset”?
What is basic use of “Data View”?
What is the difference between “Dataset” and “Data Reader”?
How can we load multiple tables in a Dataset?
How can we add relation between tables in a Dataset?
What is the use of Command Builder?
What’s difference between “Optimistic” and “Pessimistic” locking?
How many ways are there to implement locking in ADO.NET?
How can we perform transactions in .NET?
What is difference between Dataset Clone and Dataset. Copy?
Can you explain the difference between an ADO.NET Dataset and an ADO
Record set?

Explain in detail the fundamental of connection pooling?
What is Maximum Pool Size in ADO.NET Connection String?
How to enable and disable connection pooling?
What extra features does ADO.Net 2.0 have?
So friends answering to above questions on ADO.NET helped me to clear interview in
front of the interviewer.

Friday, December 10, 2010

33.net interview questions on Caching Concepts

33.net interview questions on Caching Concepts

This section will cover questions related to Caching Concepts during.net interview by the interviewer so have a look on the following and do revise it when ever you go for the.net interview
Normally the .net interviewer starts with.....

What is an application object?
What is the difference between Cache object and application object?
How can get access to cache object?
What are dependencies in cache and types of dependencies?
Can you show a simple code showing file dependency in cache?
What is Cache Callback in Cache?
What is scavenging?
What are different types of caching using cache object of ASP.NET?
How can you cache different version of same page using ASP.NET cache
object?

How will implement Page Fragment Caching?
Can you compare ASP.NET sessions with classic ASP?
Which are the various modes of storing ASP.NET session?
Is Session_End event supported in all session modes?
What are the steps to configure StateServer Mode?
What are the steps to configure SQLServer mode?
Where do you specify session state mode in ASP.NET?
What are the other ways you can maintain state?
What are benefits and Limitation of using Hidden fields?
What is ViewState?
Does the performance for viewstate vary according to User controls?
What are benefits and Limitation of using Viewstate for state management?
How can you use Hidden frames to cache client data?
What are benefits and limitations of using Hidden frames?
What are benefits and limitations of using Cookies?
What is Query String and what are benefits and limitations of using Query
Strings?

What is Absolute and Sliding expiration?
What is cross page posting?
How do we access viewstate value of this page in the next page?
Can we post and access view state in another application?
What is SQL Cache Dependency in ASP.NET 2.0?
How do we enable SQL Cache Dependency in ASP.NET 2.0?
What is Post Cache substitution?
Why do we need methods to be static for Post Cache substitution?
Answer to above given question on Caching concept of .net interview questions

Thursday, December 9, 2010

25 important .net interview questions on Threading

25 important.net interview questions on Threading


This section will cover the most asked questions related to Threading during
.net interview by the interviewer so have a look on the following and do revise it when ever you go for the .net interview
Normally the .net interviewer starts with.....

What is Multi-tasking?
What is Multi-threading?
What is a Thread?
Did VB6 support multi-threading?
Can we have multiple threads in one App domain?
Which namespace has threading?
What does Address Of operator do in background?
How can you reference current thread of the method?
What is Thread.Sleep () in threading?
How can we make a thread sleep for infinite period?
What is Suspend and Resume in Threading?
What the way to stop a long running thread?
How do I debug thread?
What is Thread.Join () in threading?
What are Daemon threads and How can a thread be created as Daemon?
How is shared data managed in threading?
Can we use events with threading?
How can we know a state of a thread?
What is use of interlocked class?
What is a monitor object?
What are wait handles?
What is ManualResetEvent and AutoResetEvent?
What is Reader Writer Locks?
How can you avoid deadlock in threading?
What is the difference between thread and process?

So friends answering to above question on Threading of .net interview questions helped me to
clear topic on threading in front of the interviewer.

Wednesday, December 8, 2010

32 important .net interview questions

32 important.net interview questions


When interviewer starts with .net basic questions then following are most
likey asked important questions during an interview. So always prepare and
revise it when ever you go for the.net interview
Normally the .net interviewer starts with.....


What is an IL?
What is a CLR?
What is CTS?
What is a CLS (Common Language Specification)?
What is a Managed Code?
What is a Assembly?
What are the different types of Assembly?
What is NameSpace?
What is Difference between NameSpace and Assembly?
If you want to view an Assembly how do you go about it?
What is Manifest?
Where is version information stored of an assembly?
Is versioning applicable to private assemblies?
What is GAC?
What is the concept of strong names?
How to add and remove an assembly from GAC?
What is Delay signing?
What is garbage collection?
Can we force garbage collector to run?
What is reflection?
What are different types of JIT?
What are Value types and Reference types?
What is concept of Boxing and Unboxing ?
What is the difference between VB.NET and C#?
What is the difference between System exceptions and Application
exceptions?

What is CODE Access security?
What is a satellite assembly?
How to prevent my .NET DLL to be decompiled?
What is the difference between Convert.toString and .toString () method?
What is Native Image Generator (Ngen.exe)?
If we have two version of same assembly in GAC how do we make a choice?
What is CodeDom?
Really friends having answered to .net interview questions is one thing and answering with the proper right key word will help you to impress in front of the interviewer.

Tuesday, December 7, 2010

ASP.NET Interview questions Caching , Application and ASP.NET page lifecycle - Part 1 ( 5 Questions ).

ASP.NET Interview questions Caching , Application and ASP.NET page life
cycle - Part 1 ( 5 Questions ).

Below are Most important ASP.NET interview questions from caching aspect
during .NET Interviews .
Day before yesterday I was at Mumbai Seepz giving a C# interview and below are some questions which where asked from ASP.NET aspect.

What are the various ways of doing caching in ASP.NET ?You can cache by using output cache directive , cache object and application object.
The next thing the interviewer asked was regarding cache and application object.
What's the difference between cache and application object ?In cache object you can define dependency properties , in application object you can not. In other words when the data which is cached changes even the cache object gets refreshed , but this is not the case of application object. You need to do a pull to refresh the data.This is a 100% sure question , how does ASP.NET page life cycle work ?.
What are the different events which occur in ASP.NET page life cycle ?
Init , load , validate , event and render.
Remember SILVER ( Init , load , validate , event and render).
What are HttpHandlers and HttpModules ?
Both of these entities have one common goal , i.e. intercepting ASP.NET request and performing some operation on the request before it reaches the main object.
But they way they intercept the request are different. HttpHandler intercepts the request using file extensions while HttpModule intercepts the request using Http events.
You can refer ASP.NET page life cycle article here for details.

Why do we need session variables ?Http is a stateless protocol , after every request and response it forgets its original state. Session variables helps us to remember the state after every request and response.

Well frankly I did not clear this ASP.NET interview as I failed to answer simple .NET interview questions. So i will suggest every one to go through .NET Interview questions from this link. This article is part 1 of ASP.NET interview question and answers i will be soon posting by other questions in the coming week... Happy job hunting.

By Shivprasad koirala

Monday, December 6, 2010

Most important ASP.NET Interview questions

Most importantASP.NET Interview questions


Below are Most important ASP.NET interview questions which repeat again and again in .NET Interviews .

Most important ASP.NET Interview questions and answers


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


In which event are the controls fully loaded?


How can we identify that the Page is Post Back?


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


What is event bubbling? How do we assign page specific attributes?


How do we ensure viewstate is not tampered?


What is the use of @ Register directives?


What is the use of Smart Navigation property?


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


Where is View State information stored?


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


How can we create custom controls in ASP.NET?


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


Can you explain “AutoPostBack”?


How can you enable automatic paging in Data Grid?


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


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


What is a SESSION and APPLICATION object?


What is the difference between ‘Server.Transfer’ and ‘response. Redirect’ ?


What is the difference between Authentication and authorization?


what is impersonation in ASP.NET?


Can you explain in brief how the ASP.NET authentication process works?


What are the various ways of authentication techniques in ASP.NET?


How does authorization work in ASP.NET?


What is difference between Data grid, Datalist, and repeater?


From performance point of view, how do they rate?


What is the method to customize columns in Data Grid?


How can we format data inside Data Grid?


How to decide on the design consideration to take a Data grid, data list, or
repeater?


Difference between ASP and ASP.NET?


What are major events in GLOBAL.ASAX file?


What order they are triggered?


Do session use cookies?


How can we force all the validation control to run?


How can we check if all the validation control are valid and proper?


If client side validation is enabled in your Web page, does that mean server
side code is not run.


Which JavaScript file is referenced for validating the validators at the client
side?


How to disable client side script in validators?


How can I show the entire validation error message in a message box on the
client side?


You find that one of your validations is very complicated and does not fit in
any of the validators, what will you do?


What exactly happens when ASPX page is requested from a browser?


How can we kill a user session?


How do you upload a file in ASP.NET?


How do I send email message from ASP.NET?


What are different IIS isolation levels?


ASP used STA threading model, what is the threading model used for ASP.NET.


What is the use of <%@ page aspcompat=true %> attribute?


B) Explain the differences between Server-side and Client-side code?


Can you explain Forms authentication in detail?


How do I sign out in forms authentication?


If cookies are not enabled at browser end does form Authentication work?


How to use a checkbox in a data grid?


What are the steps to create a windows service in VB.NET?


What is the difference between “Web farms” and “Web garden”?


How do we configure “Web Garden”?


What is the main difference between Grid layout and Flow Layout?


What’s the difference between trace and debug in ASP.NET?


How do you enable tracing in on an ASP.NET page?


Which namespace is needed to implement debug and trace ?


Can you explain the concept of trace listener?


What are trace switches?

Friday, December 3, 2010

34 important ASP.NET Interview questions

34 important ASP.NET Interview questions


Below are 34 important ASP.NET interview questions which repeat again and
again in .NET Interviews .

  1. What is an application object?
  2. what is the difference between Cache object and application object?
  3. How can get access to cache object?
  4. What are dependencies in cache and types of dependencies?
  5. Can you show a simple code showing file dependency in cache?
  6. What is Cache Callback in Cache?
  7. What is scavenging?
  8. What are different types of caching using cache object of ASP.NET?
  9. How can you cache different version of same page using ASP.NET cache object?
  10. How will implement Page Fragment Caching?
  11. Can you compare ASP.NET sessions with classic ASP?
  12. Which are the various modes of storing ASP.NET session?
  13. Is Session_End event supported in all session modes? 106
  14. What are the steps to configure StateServer Mode?
  15. What are the steps to configure SQLServer mode?
  16. Where do you specify session state mode in ASP.NET?
  17. What are the other ways you can maintain state?
  18. What are benefits and Limitation of using Hidden fields?
  19. What is ViewState?
  20. Does the performance for viewstate vary according to User controls?
  21. What are benefits and Limitation of using Viewstate for state management?
  22. How can you use Hidden frames to cache client data ?
  23. What are benefits and limitations of using Hidden frames?
  24. What are benefits and limitations of using Cookies? 109
  25. What is Query String and What are benefits and limitations of using Query
    Strings?
  26. What is Absolute and Sliding expiration?
  27. What is cross page posting?
  28. How do we access viewstate value of this page in the next page ?
  29. Can we post and access view state in another application?
  30. What is SQL Cache Dependency in ASP.NET 2.0?
  31. How do we enable SQL Cache Dependency in ASP.NET 2.0?
  32. What is Post Cache substitution?
  33. Why do we need methods to be static for Post Cache substitution?
  34. Can you explain page life cycle ?

Wednesday, December 1, 2010

C# and .NET OOP (Object oriented  programming) interview questions - Abstract classes and interfaces.


C# and .NET OOP (Object oriented programming) interview questions
-
Abstract classes and interfaces.


I have yet to remember a .NET interviewer who never asked about abstract classes, interfaces and object oriented interview questions . I am putting forward questions which comes around abstract classes and interfaces again and again...Hope every one benefits.
Normally the C# interviewer starts with.....

What is abstract class ?
Abstract class is a base class or a parent class. Abstract classes can have empty abstract methods or it can have implemented methods which can be overridden by child classes.

The next question i expected
was on interfaces and yes there it comes.


What are interfaces?
Interface is a contract class with empty methods , properties and functions. Any class which implements the interface has to compulsory implement all the empty methods , functions and properties of the interface.
Now the 1000% sure
question was bound to come difference between them...



What's the difference between abstract class and interface?
There are many differences, below are some key two differences :-

  • Abstract class are base class or parent class while interfaces are
    contracts.

  • Abstract class can have some implemented methods and functions while
    interfaces methods and functions are completely empty.

  • Abstract classes are inherited while interfaces are implemented.

  • Abstract classes are used when we want to increase reusability in
    inheritance while interfaces are used to force a contract.

Can we create a object of abstract class or interface?
No we can not.
Now the practical
question..


In what scenarios will you use a abstract class and in what scenarios will
you use a interface?

If you want to increase reusability in inheritance then abstract classes are
good. If you want implement or force some methods across classes must be for
uniformity you can use a interface. So to increase reusability via inheritance
use abstract class as it is nothing but a base class and to force methods use
interfaces.
Really friends having C# experience is one thing and cracking
Dot net and C# interviews is a different ball game all together .

Monday, November 29, 2010

.NET and C# interview questionsBoxing, Unboxing, Heap, Stack, By reference and by value

.NET and C# interview questions Boxing, Unboxing, Heap, Stack, By reference and by value


Also see
Important .NET interview questions and answers part 1
Important .NET interview questions and answers part 2

Recently I went for a big IT multinational company and the interviewer grilled me in for a hour around the below concepts Boxing , Unboxing , Heap , Stack , By reference and by value. I am just putting my experience so that every one can be benefitted. The above 6 concepts are very much interlinked and asked by C# interviewers again and again. They can start from anyone of the three sections i.e. boxing / unboxing , Stack / Heap or By ref and value.

From which ever section they initiate the discussion, all interviewers touch base the above concept directly indirectly. In my particular C# interview he started first with...

What are stack's and heaps ?

Stack are like series of compartment i.e. one above another. It keeps track of your running memory needed by your application. On the other hand heap is nothing but pile of objects which are kept one above another and they can be reached any moment of time.

I knew that I had answered right but he was not expecting that answer he was expecting something else....So bang came the next question.

So what kind of data stack has and heap has ?

Both stack and heap are memory types. Stack memory are value types like integer , double , Boolean etc , while heap memory are objects and string data types.

Once I answered the above question , I was expecting the next question on what are value types and references. But he went some other route but again near to expectation ...

How is boxing and unboxing related to the above concept ?

Boxing happens when data moves from value type to reference type and unboxing happens when data moves from reference types to value types.

This leads to a small performance hit in the application.

I purposely put the last line so that he would probe further on performance and yes yes , he asked me the next question...Its my simple old trick to force the interviewer to ask question which i am good at..;-)

Why does performance decrease when boxing and unboxing happens ?

In boxing and unboxing data moves from value to reference and vice versa which needs quite a bit processing as they are different memory types all together. Due to the same there is a performance decrease when the boxing and unboxing phenomenon happens.

I knew this was becoming a in-depth discussion forum and the next question but obvious was ...

So how can we avoid boxing and unboxing ?

We can not really avoid , but where ever possible we can do two things at least :-



  • First is avoid unnecessary conversions.


  • Second use generics to avoid the conversion situation.

What are the scenarios in which boxing and unboxing happens ?

One of the common situation is when we take data in to UI object like text boxes and we need to move the data in to a value data type like integer , double etc. As the UI textboxes and controls are objects its very difficult to avoid this scenario.

Are string by val or by ref ?

They are by ref. String and objects are by ref and they are always stored in a heap. All the other data types other than these 2 are value types.

This question was unexpected...but i had my concepts clear..so.

How do stack and heap memory gets claimed back when the application exits ?.

Stack is the running memory , the byval memory , So it just gets claimed when the application exits. The by ref memory or heap memory is not claimed as soon as the application exits , but its claimed by the garbage collector routine. So the GC just spawns and claims the memory acquired by the heap.

By Shivprasad Koirala.

Thursday, October 21, 2010

CAS (Code access security) & .NET 4.0 Security model FAQ (With Full Video demonstration)

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 here
or else you can catch me on my daily free training @ here

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 too 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%28VS.90%29.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/



Saturday, September 25, 2010

6 ways of doing locking in .NET (Pessimistic and optimistic)

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 here
or else you can catch me on my daily free training @ from here

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.




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




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.



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.




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…