Friday, March 16, 2012

ADO.NET interview questions: - Mention different ways to implement optimistic locking in ADO.NET?

Following are the ways to implement optimistic locking using ADO.NET:-

  • When we call “Update” method of Data Adapter it handles locking internally. If the Dataset values are not matching with current data in Database, it raises concurrency exception error. We can easily trap this error using Try. Catch block and raise appropriate error message to the user.

  • Define a Date time stamp field in the table. When actually you are firing the UPDATE SQL statements, compare the current timestamp with one existing in the database. Below is a sample SQL which checks for timestamp before updating and any mismatch in timestamp it will not update the records. This I the best practice used by industries for locking.
Update table1 set field1=@test where Last Timestamp=@Current Timestamp
  • Check for original values stored in SQL SERVER and actual changed values. In stored procedure check before updating that the old data is same as the current Example in the below shown SQL before updating field1 we check that is the old field1 value same. If not then some one else has updated and necessary action has to be taken.
Update table1 set field1=@test where field1 = @oldfield1value

Locking can be handled at ADO.NET side or at SQL SERVER side i.e. in stored procedures.

See the following video on SQL Server which describes difference between UNION and UNION All: -


Learn more on ADO.NET interview questions

Regards,

From more on author’s blog related to ADO.NET interview questions click and visit.

Tuesday, March 13, 2012

.NET interview questions: - Show CMMI in details?

CMMI stands for Capability Maturity Model Integration. It is a process improvement approach that provides companies with the essential elements of effective process. CMMI can serve as a good guide for process improvement across a project, organization or division.

CMMI was formed by using multiple previous CMM process. Below are the areas which CMMI addresses because of integrating with CMM process:-

Systems engineering: - This covers development of total systems. System engineers concentrate on converting customer needs to product solution and support them through out the product life cycle.

Software Engineering: - Software engineers concentrate on the application of systematic, disciplined, and quantifiable approaches to the development, operation, and maintenance of software.

Integrated Product and Process Development: - Integrated Product and Process Development (IPPD) is a systematic approach that achieves a timely collaboration of relevant stakeholders throughout the life of the product to better satisfy customer needs, expectations, and requirements. This section mostly concentrates on the integration part of the project for different processes. For instance it’s possible that your project is using services of some other third party component. In such situation the integration is a big task itself and if approached in a systematic manner can be handled with ease.

Software Acquisition: - Many times organization has to acquire products of other organization. Acquisition is itself a big step for any organization and if not handled in a proper manner means just calling for disaster.

Below is what CMMI call about.

Figure: - CMMI

See the following video which describes Simple Unit Testing: -



Learn more on .NET interview questions

Regards,

From more on author’s blog related to .NET interview questions click and visit.

Wednesday, March 7, 2012

.NET Interview Questions: - Mention LeaseTime, SponsorshipTime, RenewonCallTime and LeaseManagerPollTime?

This is a very important question from practical implementation point of view. Companies who have specific requirement for Remoting projects will expect this question to be answered.

In normal .NET environment objects garbage collector manages lifetime. However, in remoting environment remote clients can access objects, which are out of control of garbage collector. Garbage collector boundary is limited to a single PC on which framework is running; any remote client across physical PC is out of control of GC (Garbage Collector).

This constraint of garbage collector leads to a new way of handling lifetime for remoting objects, by using concept called as “LeaseTime”. Every server side object is assigned by default a “LeaseTime” of five minutes. This lease time is decreased at certain intervals. Again, for every method call a default of two minutes is assigned. When i say method call means every call made from client. This is called as “RenewalOnCallTime”.

Let’s put the whole thing in equation to make the concept more clear.

Total Remoting object life time = LeaseTime + (Number of method calls) X (RenewalTime).

Then default Remote Object Life Time = 5 + (1) X 2 = 10 minutes (Everything is in minutes)

When total object lifetime is reduced to zero, then it queries the sponsor that should the object be destroyed. Sponsor is an object, which decides should object Lifetime be renewed. So it queries any registered sponsors with the object, if does not find any then the object is marked for garbage collection. After this garbage, collection has whole control on the object lifetime. If we do not foresee how long a object will be needed specify the “Sponsorship Timeout” value. Sponsorship Timeout is time unit a call to a sponsor is timed out.

“LeaseManagerPollTime” defines the time the sponsor has to return a lease time extension.

View the following video on Garbage Collector, Gen 0, 1 & 2 asked in C#.Net interview: -

Learn more on .NET interview questions

Regards,

From more on author’s blog related to .NET interview questions click and visit.

Thursday, March 1, 2012

ASP.NET Interview Questions: - Show Post Cache substitution?

This is one of the asked ASP.Net Interview Questions during the Interview by the Interviewer.
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:








Figure: - “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.



Figure: - Substitution Control
Figure: - 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.

View following video on Web.config transformation in ASP.Net: -



Learn more on ASP.NET interview questions

Regards,

From more on author’s blog related to ASP.NET interview questions click and visit.

Monday, February 27, 2012

.NET Interview Questions: - Show object pooling in .NET?

This is the most practical oriented .Net Interview Questions which may be asked during the Interview by the Interviewer.

COM+ reduces overhead by not creating object from scratch. So in COM+ when object is activated it’s activated, from pool and when it has deactivated it’s pushed back to the pool. Object pooling is configures by using the “ObjectPoolingAttribute” to the class.

Note:- When a class is marked with object pooling attribute it can not be inherited.

ObjectPooling(MinPoolSize := 2, MaxPoolSize := 5, CreationTimeout :=
20000)> _
Public Class testingclass
Inherits ServicedComponent
Public Sub DoWork()
' Method contents go here.
End Sub
End Class

Above is a sample code, which has the “Object Pooling” attribute defined. Below is a sample code, which uses the class.

Public Class App
Overloads Public Shared Sub Main(args() As String)
Dim xyz As New TestObjectPooling()
xyz.doWork()
ServicedComponent.DisposeObject (xyz)
End Sub
End Class

Above is a sample code, which uses the object pooled object. Note the Dispose Object () This ensures its safe return to the object pool.

View following video on regular expressions & some practical demonstrations in .Net Interview: -

Learn more on .NET interview questions

Regards,

From more on author’s blog related to .NET interview questions click and visit.

Thursday, February 23, 2012

.NET interview questions: - Can you explain the advantages of using OOPS over functional programming?

In fact this one is the basic but very important .NET interview questions asked in almost every interview. An interviewer expects that every candidate should know and answer it. So if you are not sure about it so read the following answer thoroughly and get clear your fundamental related to OOPS.
  • Abstraction: - Abstraction filters un-necessary information from the user’s perspective. It just gives enough information to the user rather than giving him unnecessary information by which he can get confused. Abstraction can be different from different user perspective. For instance below figure 'Abstraction perspective' shows how a simple user looks at a television and how a TV mechanic looks at the television. From a simple user perspective he only needs to start, stop, change channels and control volume. But when a TV mechanic looks at the box he is concerned with details like CRT, Electrical Components, Wires, connection, cooling fan etc. So abstraction is about two things one is show only what is needed and second the need should be from end users perspective.


Figure: - Abstraction Perspective

Ok, now how does that fit in to the software world? When we design components we should know what type of user will be using the component. Figure ‘Abstraction in action’ shows how the customer components when has different view of abstraction for the internal and external developer.


Figure: - Abstraction in Action
  • Encapsulation: - Encapsulation separates an object interface from its implementation. It hides internal implementation details from the users. You can get a better feel by looking at the figure ‘Encapsulation and Abstraction’. It shows a simple stock class which allows a user to add and remove products from the stock. It also has a restock and alert in case products are out of stock. End user is only exposed to operations like ‘addstock’,’removestock’ and get the current level of the stock. He is completely isolated from auto functionalities like how the restock operation takes place. These operations are encapsulated from the end user perspective.
Note :- Abstraction means to expose the necessary functionalities while encapsulation means to hide the complexity. They both complement each other, but there is a huge difference in terms of thinking approach. In interviews ‘difference between abstraction and encapsulation’ is one of the favorites questions among interviewers. So understand the concept fundamentally as you can get in to long talks of confusion with the interviewer.


Figure: - Encapsulation and Abstraction
In java or C# encapsulation is achieved by using private, public and protected access modifiers.
  • Inheritance: - OOPS is all about mapping with real world. One of the relationships in real world is parent child relationship. Inheritance is a methodology by which you can form new classes using existing classes as base. For instance figure ‘Inheritance in action’ shows we have created a parent class called as ‘ClsDisplay’. We can inherit from ‘clsDisplay’ and create bold and italic display classes.

Figure: - Inheritance in action
  • Polymorphism: - Polymorphism means one object can exist in different forms. It refers to ability of the object to take different forms depending on situations. For instance we can use the ‘clsDisplay’ object to point to italic or a bold display object. So depending on the situation the parent class ‘clsDisplay’ can morph/change to any other form.

Figure: - Polymorphism in action
See more on OOPS in video from describing implementation of Aggregation, Association and Composition as follows: -



Visit to get more stuff on .NET interview questions

Regards,

Also visit for more author’s other blogs on .NET interview questions

Monday, February 20, 2012

SQL Server interview question:- What do you mean by SSIS, SSAS and SSRS?

All these 3 things are related to Business intelligence. Business intelligence is all about making meaning of your data, forecasting using that data, making more business sense from the data.

In order to do the same we first need to collect data, analyze it and then display it to the stake holders.
The collection of data is done by using SSIS.

The data analyzation part is done by SSAS.

The displaying of data is done by using SSRS or reporting services.

Below is a simple video in 2 parts which explains the same in more detail and with full demonstration.

Part 1:



Please click to see the Part 2 of what are SSIS, SSAS and SSRS video.

Click for more SQL Server interview questions

Regards,

Visit for more author’s blog on SQL Server interview questions