Interview Questions With Answers

by Administrator 13. January 2012 19:00
  •    Describe the difference between a Thread and a Process?

A process is an executing instance of an application. For example, when you double-click the Microsoft Word icon, you start a process that runs Word. A thread is a path of execution within a process. Also, a process can contain multiple threads. When you start Word, the operating system creates a process and begins executing the primary thread of that process.

It’s important to note that a thread can do anything a process can do. But since a process can consist of multiple threads, a thread could be considered a ‘lightweight’ process. Thus, the essential difference between a thread and a process is the work that each one is used to accomplish. Threads are used for small tasks, whereas processes are used for more ‘heavyweight’ tasks – basically the execution of applications.

Another difference between a thread and a process is that threads within the same process share the same address space, whereas different processes do not. This allows threads to read from and write to the same data structures and variables, and also facilitates communication between threads. Communication between processes – also known as IPC, or inter-process communication – is quite difficult and resource-intensive.

  •    What is the difference between an EXE and a DLL?

 An exe runs in its own address space, Dll gets loaded into the 'hosting' process address space or a shared address space.

  •     What is a Windows Service and how does its lifecycle differ from an EXE?

Windows Service:  Windows service is long running service. It will automatically start while booting.

Standard EXE: Where as for standard exe, we need to start it manually. Means it cannot be started unless you logon

 

  •    What is the GAC? What problem does it solve?

    GAC=Global Assembly Cache, solves dll versioning (hell) problem. It's interesting to know how it solves the problem; each assembly is uniquely identified by 4 'things' major version number, minor version, and build and revision numbers. For each differing version, the GAC silently creates a subfolder based on a hash of these and places the assembly in it. From a user perspective it seems as if, we are moving the same file in one directory and it doesn't ask if it should overwrite the file!

  •     What is Web Gardening? How would using it affect a design?

If server has multiple processors and requests traffic is dividing accordingly that is called web gardening. If server is using external resources (like sql server, web services, logging) then it could be very useful.

 

  •   How can I throw an exception without losing the original stack trace information in .NET?

Use the "throw" keyword in place of "throw ex" to preserve the original stack trace information.
When you throw an exception using “throw ex” instead of “throw” you override the original stack trace with a new stack trace that starts from the throwing method.  This can make tracking down the root causes of exceptions much more difficult.  Take a look at the example below in order to see the differences in the stack traces depending on which option you use.


            //Option 1 - Overrides original stack trace
            throw ex;

            //Option 2 - Keeps original stack trace
            throw;

            //Option 3 - Keeps original stack trace and adds additional information
            throw new Exception("Additional information...", ex);


  • Base Classes vs. Interfaces

An interface type is a specification of a protocol, potentially supported by many object types. Use base classes instead of interfaces whenever possible. From a versioning perspective, classes are more flexible than interfaces. With a class, you can ship Version 1.0 and then in Version 2.0 add a new method to the class. As long as the method is not abstract, any existing derived classes continue to function unchanged.

Because interfaces do not support implementation inheritance, the pattern that applies to classes does not apply to interfaces. Adding a method to an interface is equivalent to adding an abstract method to a base class; any class that implements the interface will break because the class does not implement the new method.

      Interfaces are appropriate in the following situations:  

  • Several unrelated classes want to support the protocol.
  • These classes already have established base classes (for example, some are user interface (UI) controls, and some are XML Web services).
  • Aggregation is not appropriate or practical.

     In all other situations, class inheritance is a better model.

Tags:

Interview Questions

Asp.net Interview Questions

by Administrator 16. January 2011 21:31

 

  • Application Object vs Cache
  • View State vs Session State
  • why out - processSession state needed?
  • response.redirect vs server.transfer
  • what is the disadv of server.transfer
  • handle exception in webservice?
  • how to pass parse xml file
  • what is XPath?
  • different Isolation Level in sql
  • Ajax State
  • Ajax Header Information
  • Ajax Get vs Post
  • C# out Keyword is good or bad
  • String is val type or ref
  • Sql server normalizaton
  • WCF timeout set
  • how many binding can have a one service
  • Different types of bindings
  • C# what is the use of virtual keyword
  • C# can we use this keyword in static constructor
  • Can we use Foreach in java script
  • Sp vs Fn
  • Types of Cursors
  • What is XSLT?
  • Class vs structure
  • Static variable
  • Const  vs readonly
  • GAC ?how to register ?
  • Abstract class vs interface
  • Do interface has access modifier
  • Access modifiers?
  • Type of consuming webservice
  • SOAP Component
  • Feature of webservice
  • Composite key
  • Last 5 records from table query
  • Many to many relationship
  • groupby and having clause
  • Fillfactor
  • Access modifiers Difference between protected and protected internals?
  • What is assembly?differenciate from namespace?
  • OOPS concepts (poly,Encapsulation)
  • Abstract class?
  • Virtual,New,this keywords
  • Asyncrnous process?
  • Upload control problem with updatepanel?
  • consume webservice in AJAX?
  •  select top 4 without using top keyword?  
  •  SELECT Uname, pwd FROM ( SELECT Uname, pwd, RANK() OVER (ORDER BY IDasc)ID_rank FROM test) test WHERE ID_rank <= 4


Tags:

Interview Questions

ASP.NET Determining whether a browser accepts cookies

by Administrator 7. January 2011 19:13

In this post I would like to explain on how to check if cookies are accepted in a web browser or not. Before that, I would like to say thanks to my readers for their appreciation and to enourage me to write more. Let us move on to topic. To determine whether the browser accepts cookies you may think that "Request.Browser.Cookies" property will return a boolean value & based on that we can determine it. But the Browser-object only indicates whether cookies are supported by the browser or not and not whether cookies are enabled in the browser or not.

The properties exposed by the "HttpBrowserCapabilities"object indicate inherent capabilities of the browser, but do not necessarily reflect current browser settings. For example, the Cookies property indicates whether a browser inherently supports cookies, but it does not indicate whether the browser that made the request has cookies enabled.

Users can set their browser to decline cookies. No error is raised if a cookie cannot be written. The browser like wise does not send any information to the server about its current cookie settings and moreover since browser supports cookies "Request.Browser.Cookies" property returns true.

One simple to way to determine whether browser accept cookies are not is Trying to write a Cookie on it and read it back .Let me explain it with example pages.

We need to have two pages. In the first page write a cookie, and redirect to page2 in the second page try to read the same cookie value based on that we can determine. Let us create the page1 in c#

protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            if (Request.QueryString["cookiesAllowed"] == null)
            {
                Response.Cookies["TestCookies"].Value = "ok";
                Response.Cookies["TestCookies"].Expires =
                    DateTime.Now.AddMinutes(10);
                Response.Redirect("Page2.aspx?Returnurl=" +
                    Server.UrlEncode(Request.Url.ToString()));
            }
            else
            {
                Label1.Text = "Allow cookies = " +
                    Server.UrlEncode(
                    Request.QueryString["cookiesAllowed"]);
            }
        }
In the first page first we are checking whether Cookie Test has been done or not. If it is done determine browser accept cookies or not based on the querystring value. Test is not done then we are adding the test cookies value to the browser with expiration date, and redirecting to the page2 with the return url.

 Page2 code in C#
protected void Page_Load(object sender, EventArgs e)
{
   string redirect = Request.QueryString["returnurl"];
   string acceptsCookies;
   if(Request.Cookies["TestCookies"] ==null)
       acceptsCookies = "no";
   else
   {
       acceptsCookies = "yes";
       // Delete test cookie.
       Response.Cookies["TestCookies"].Expires =
           DateTime.Now.AddDays(-1);
   }
   Response.Redirect(redirect + "?cookiesAllowed=" + acceptsCookies,
   true);
}
In the page2 I am trying to read the cookies value return in page1. If the cookie value is exist, then we can determine if cookies are accepted in the browser & we can delete that test cookies and return back to page1 with Yes. If we are unable to read the same cookie value then we can confirm from this the browser do not accept cookie value and return to page1 with No. Based on this we can determine whether the browser accept cookies or not .

For more information, see ASP.NET Cookies Overview"


Tags:

ASP.NET

Javascript History

by Administrator 18. December 2010 02:00

When the "World Wide Web" was first created in the early 1990's all web pages were static. When you viewed a web page you saw exactly what the page was set up to show you and there was no way for you to interact with the page.

Being able to interact with a web page have it do something in response to your actions required the addition of some form of programming language to "instruct" the page how it should respond to your actions. In order to have it respond immediately without having to reload the web page this language needed to be able to run on the same computer as the browser displaying the page.



At the time there were two browsers that were reasonably popular Netscape Navigator and Internet Explorer. Netscape was the first to bring out a programming language that would allow web pages to become interactive - they called it Livescript and it was integrated into the browser (meaning that the browser would interpret the commands directly without requiring the code to be compiled and without requiring a plugin to be able to run it). This meant that anyone using the latest Netscape browser would be able to interact with pages that made use of this language.


Another programming language called Java (which required a separate plugin in order to run) became very well known and so Netscape decided to try to cash in on this by renaming the language built into their browser to Javascript. Note that while some Java and Javascript code may appear similar, they are in fact two entirely different languages that serve completely different purposes.

Not to be left behind Internet Explorer was soon updated to support not one but two integrated languages. One was called vbscript(only IE supports) and was based on the BASIC programming language and the other was called Jscript and was very similar to Javascript. In fact if you were very careful what commands you used you could write code that would be able to be processed as Javascript by Netscape Navigator and as Jscript by Internet Explorer.

At the time Netscape Navigator was by far the more popular browser and so later versions of Internet Explorer implemented versions of Jscript that were more and more like Javascript. By the time that Internet Explorer became the dominant browser Javascript had become the accepted standard for writing interactive processing to be run in the web browser.

The importance of this scripting language was too great to leave its future development in the hands of the competing browser developers and so in 1996 Javascript was handed over to an international standards body called ECMA who then became responsible for the subsequent development of the language. As a result of this the language was officially renamed ECMAScript or ECMA-262 but most people still refer to it as Javascript.

 

Tags:

Javascript

About Me

It's MeHi, I’m Esakki Raja and I write ASP.NET FREAK to explore my experience and view about Technologies. I started ASP.NET FREAK blog in 2010 to geeks to share my knowledge and thoughts. I have a 5+ years of experience in Microsoft technologies . Feel free to comment on bl


 

Calendar

<<  May 2012  >>
MoTuWeThFrSaSu
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910

View posts in large calendar

Month List

Page List