Archive for August, 2012

Question of the day :Day 11




Question of the day.

Question:
How to get the Current Year in SQL ?

Answer:
select Year(GetDate())
HappyCoding ! πŸ˜‰

Question of the day :Day 10




Question of the day.

Question:
which is the Inbuilt tool in SQl which can be used to trace SQL Server events ?

Answer:
SQL Server Profiler
It helps to trace and saves those events in what’s known as a trace file.

HappyCoding ! πŸ˜‰

Question of the day :Day 9





Question of the day.

Question:
When is Visual Studio 2012 (and TFS 2012) being released?

Answer:

15 th August 2012
Double Dhamaka! As August 15 is celebrated as the Independence Day in India.So two reasons to celebrate on Aug 15

HappyCoding ! πŸ˜‰

Question of the day :Day 8





Question of the day.


This is a perplexing question that has been asked to me by an interviewer long back.I thought of sharing it with u. He asked me about the difference between string and string builder.I gave him an impressive answer.The answer that i gave him was efficient memory management that can be achieved using string builder.
You can view my previous post on String and String Builder for more details.
Then he asked me a question linking garbage collector to it. Since garbage collector automatically remove unwanted objects. why do we need a string builder?


I told him that garbage collector is unpredictable. The moment when the garbage is actually collected can be unpredictable, resulting in stalls scattered throughout a session. he was not satisfied with my answer.So today’s Question is all about Garbage collector.We know the advantages of using Garbage collector.But it has some disadvantages too. lets have a detailed look on it.

Question:

What are the Disadvantages of Garbage Collector?

Answer:

  • Time Consumption
  • The point when the garbage is actually collected can be unpredictable, resulting in stalls scattered throughout a session.
  • Garbage collection consumes computing resources in deciding what memory is to be freed, reconstructing facts that may have been known to the programmer.
  • In virtual memory environments typical of modern desktop computers, it can be difficult for the garbage collector to notice when collection is needed, resulting in large amounts of accumulated garbage, a long, disruptive collection phase, and other programs’ data swapped out.
  • Perhaps the most significant problem is that programs that rely on garbage collectors often exhibit poor locality (interacting badly with cache and virtual memory systems), occupy more address space than the program actually uses at any one time, and touch otherwise idle pages. These may combine in a phenomenon called thrashing, in which a program spends more time copying data between various grades of storage than performing useful work. They may make it impossible for a programmer to reason about the performance effects of design choices, making performance tuning difficult. They can lead garbage-collecting programs to interfere with other programs competing for resources

  • HappyCoding ! πŸ˜‰

    Question of the day :Day 7





    Question of the day.

    Question:

    In C# [Serializable()] attribute gets inspected at?
    Answer:

    Run-Time

    HappyCoding ! πŸ˜‰

    Question of the day :Day 6





    Question of the day.

    Question:

    What is a Static class and Why do wee need it?

    Answer:


    The Word Static means unchangeable or not moving or fixed.So a static class means whose value is fixed in the Memory.Static classes are light weight and don’t need instantiation.It is not possible to create instances of a static class using the new keyword.A static class cannot have non-static members.Static classes are loaded automatically by the .NET Framework common language runtime (CLR) when the program or namespace containing the class is loaded.



    The advantage of using a static class is that the compiler can check to make sure that no instance members are accidentally added. The compiler will guarantee that instances of this class cannot be created. thus you can say that Static Class is an Example of Data Hiding.



    Static classes are sealed and therefore cannot be inherited.



    When you want to restrict the class from creating any objects of its we can go for a static class

    HappyCoding ! πŸ˜‰