Tuesday, March 27, 2012

.Net interview questions: - Explain other ways preferable over finalize for clean up?

Problem with finalize is that garbage collection has to make two rounds in order to remove objects which have finalize methods.

Below figure will make things clear regarding the two rounds of garbage collection rounds performed for the objects having finalized methods.


Figure: - Garbage collection in actions

In this scenario there are three objects Object1, Object2, and Object3. Object2 has the finalize method overridden and remaining objects do not have the finalize method overridden.

Now when garbage collector runs for the first time it searches for objects whose memory has to free. He can see three objects but only cleans the memory for Object1 and Object3. Object2 it pushes to the finalization queue.

Now garbage collector runs for the second time. He see’s there are no objects to be released and then checks for the finalization queue and at this moment, it clears object2 from the memory.

So if you notice that object2 was released from memory in the second round and not first. That is why the best practice is not to write clean up Non.NET resources in Finalize method rather use the DISPOSE.

See the following video in .NET which describes regular expressions & some practical demonstrations: -



Click for more important .NET interview questions

Regards,

Visit for more authors’ blog on interview questions and answers for Dotnet

Thursday, March 22, 2012

ASP.NET interview questions: - Can you differentiate between trace and debug in ASP.NET?

There is also a fundamental difference in thinking when we want to use trace and when want to debug. Tracing is a process about getting information regarding program's execution. On the other hand debugging is about finding errors in the code.

Debug and trace enables you to monitor the application for errors and exception without VS. NET IDE.

In Debug mode compiler inserts some debugging code inside the executable. As the debugging code is the part of the executable they run on the same thread where the code runs and they do not given you the exact efficiency of the code ( as they run on the same thread). So for every full executable DLL you will see a debug file also as shown in figure ‘Debug Mode’.

Figure: - Debug mode
Trace works in both debug as well as release mode. The main advantage of using trace over debug is to do performance analysis which cannot be done by debug. Trace runs on a different thread thus it does not impact the main code thread.

See the following video for how to Skip debugging in ASP. NET: -



Click for more ASP. NET Interview questions

Regards,

Visit for more authors’ blog on ASP. NET Interview questions

Tuesday, March 20, 2012

.NET interview questions: - Can you explain various roles in Six Sigma implementation?

Sigma means deviation in Greek language. Deviation means how much variations exist in a set of data. For instance let’s say in a software maintenance project out of 100 defects 68 defects are rectified to the mark and remaining bounce back that means your bug fixing process is on “2 Sigma” level. I had described only from bug fixing perspective. But this can be applicable to any process organization.

Figure: - SIX Sigma Values

Therefore, I should only have 3.4 defects in a million defects then I can say I am six sigma.

Attaining Six Sigma is team effort and cannot be attained individually. Driving Six Sigma itself in an organization is huge project as it involves lot of mentoring and change of attitude of the current workers. So when an organization wants to drive the Six Sigma way they appoint persons with certain roles as defined below. Executive Leadership includes CEO and other key top management team members. They are responsible for setting up a vision for Six Sigma implementation. They also empower the other role holders with the freedom and resources to explore new ideas for breakthrough improvements.

Champions are responsible for the Six Sigma implementation across the organization in an integrated manner. The Executive Leadership draws them from the upper management. Champions also act as mentor to Black Belts.

Master Black Belts, identified by champions, act as in-house expert coach for the organization on Six Sigma. They devote 100% of their time to Six Sigma. They assist champions and guide Black Belts and Green Belts. Apart from the usual rigor of statistics, their time is spent on ensuring integrated deployment of Six Sigma across various functions and departments.

Black Belts operate under Master Black Belts to apply Six Sigma methodology to specific projects. They devote 100% of their time to Six Sigma. They primarily focus on Six Sigma project execution, whereas Champions and Master Black Belts focus on identifying projects/functions for Six Sigma.

Green Belts are the employees who take up Six Sigma implementation along with their other job responsibilities. They operate under the guidance of Black Belts and support them in achieving the overall results.

See the following video on implement TDD (Test driven development) in c# using VSTS unit testing: -



Click for more important Dotnet interview questions

Regards,

Visit for more author’s blog on Most asked Dotnet interview question

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 interview questions and answers for .NET

Regards,

From more on author’s blog related to Most asked .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 interview questions and answers for .NET

Regards,

From more on author’s blog related to Most asked Dotnet interview question 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.