Saturday, April 24, 2010

ASP.NET Interview Questions


Few days back I was asked by my employer to prepare some interview questions on asp.net and sqlserver for the purpose of written test. I am providing few of the interview questions with answers for the same. Let me know your ideas on the topic.



  1. What is the interface we need to implement in order to create a HTTP Handler
    1. IMyHandler
    2. IHttpHandler
    3. IHttpHandlerFactory
    4. None of the above


  2. What is the fastest way to retrieve data from the database
    1. Use DataTable
    2. Use DataAdapter
    3. Use Dataset
    4. Use DataReader
Reason:Because DataAdapter internally makes use of DataReader class.



  1. What is the correct answer among the following regarding the ViewState
    1. It is used to Create the visibility on the Web pages
    2. It is used to Maintain the State of the User as long as he surf the website
    3. It is used to maintain the state between the subsequent requests within a page
    4. It is used to increase the performance of the web application


  2. When does the Session_Start event in the Global.asax fire,
    1. When a new user starts using the application
    2. When the user logs into the server using the Login.aspx page
    3. When a user requests a secured page
    4. When first user sends a request


  3. There is a Master page called MyApplication.master and a content page called MyContentPage.aspx. When we run the application which of the following events will take place first
    1. Page load event in the MyApplication.master
    2. Page load event in the MyContentPage.aspx
    3. PreInit event in the MyApplication.master
    4. PreInit event in the MyContentPage.aspx
Reason:Because you have the capability to change the master page at run time in the PreInit event of the content page.



  1. You need to execute code conditionally, depending on whether the page is generated in response to a server control event on the same page. How would you check this programmatically?
    1. Page.HasControls
    2. Page.IsCrossPagePostBack
    3. Page.IsPostBack
    4. Page.IsCallback


  2. In which folder you can place the SqlServer Express Edition
    1. App_Data
    2. App_Code
    3. App_Themes
    4. App_LocalResources
App_Data folder is used to store the .mdf files in asp.net (Introduced in 2.0).

App_Code folder is used to store the class files in asp.net (Introduced in 2.0).

App_Themes is used to store the skins, themes etc (Introduced in 2.0).

App_LocalResources is used to store the resource information in asp.net.



  1. There is a class called as MyClass in C#. When initializing the class in Using block as,
    MyClass obj = new MyClass();
    using(obj)
    {
    //Some Code to follow..
    }
    The above application resulted in error. What could be the reason,

  1. We cannot use "using" block for the Custom classes
  2. MyClass must implement IDisposable interface
  3. The obj must be declared in try, catch block
  4. using block cannot be used in ASP.NET, that is only related to C#
Reason:The using block will call the dispose method automatically when the scope of the using block is ended.



  1. If one has two different web form controls in application and if one wanted to
    know whether the values in the above two different web form control match what
    control must be used.
    1. DataGrid Control
    2. CompareValidator
    3. TextBox Validator
    4. ListView Control


  2. Which of the following denote ways to manage state in an ASP.Net Application?
    1. Session Objects
    2. Application Objects
    3. View State
    4. All of the above


  3. In ASP.NET the < authorization > section contain which of the following
    elements
    1. <deny>
    2. <allow>
    3. Both A and B
    4. None of the above


  4. What is the easiest way to handle all the exceptions in a web application
    1. Use try.. catch block for all the methods
    2. Use Error handler at the page level in each page
    3. Use Application level Error handler at Global.asax
    4. Create a section in web.config file that can handle all the errors


  5. What is AJAX?
    1. It is a technology that enables browsers to render information faster than normal way
    2. It is a technology which enables javascript to do high graphics on the web pages
    3. It is a latest version of the Web Services
    4. None of the above


  6. What are the datasource controls available in ASP.NET
    1. SqlDataSource
    2. ObjectDataSource
    3. XmlDataSource


    4. All of the Above




  7. How do you Cache a DataTable
    1. By using Cache object
    2. By saving the DataTable to xml file and keeping in memory
    3. Writing the Page Output Cache attribute on the page control
    4. Creating a user control for a DataTable


  8. Trace and debug classes belong to which Namespace
    1. System.Diagnostics
    2. System.Reflection
    3. System.Data
    4. None of the above


  9. Column mappings belongs to which namespace
    1. System.Data
    2. System.Data.Common
    3. System.Xml
    4. System.Data.Relations
     I will post the remaining ASP.NET Interview questions and Sql Server Interview Question to the blog as soon as possible.

6 comments:

  1. I would never give these questions to a candidate. 'Which namespace are column mappings in?': Who cares? That's what Visual Studio and MSDN are for. These questions may be good at stopping someone at the door who has never done it, but that's about it.

    I would focus on problem solving skills and general approaches to problems instead of a book test. Maybe give them a small project to complete and give them access to MSDN and VS. I realize you said your employer asked for written questions, so if you have to stick with that format I'd go with questions that demonstrate problem-solving and a real understanding of the workflow/technology, like the 'What is the viewstate used for' questions, but even that you could get a unqualified person who happened to open an asp.net book.

    Just my 2 cents.

    ReplyDelete
  2. First of all thanks for the comment. As this interview will be for the candidates from fresher to experienced level I have to provide these questions. However, I will post more questions to the blog soon, so that will be helpfull for the persons who are in search of a job as well as who wants to improve their skills.

    ReplyDelete
  3. I will definitely used this to figure out if the candidate is real or fake. Thanks for posting.

    ReplyDelete
  4. It's nice Queries but the thing is these all are basic one who is appearing freshers.most time.
    Nice job done man.

    ReplyDelete
  5. May be, better way is to categorize questionnaire based on ASP.NET concepts(like data access, UI, performance etc), skill level(basic, intermediate, expert) etc..Just my 2 cents!!!

    --Rajesh

    ReplyDelete
  6. Hi,The common way to present a navigational system on your website is through links to the different pages for Web Design Cochin that are placed on the header section.Thanks......

    ReplyDelete