ASP interview questions and answers

Used by IBM Consulting Services, according to the site visitor.

  1. How many objects are there in ASP?
  2. Which DLL file is needed to be registered for ASP?
  3. If you want to initialize a global variable for an application, which is the right place to declare it? (like form or some other file).
  4. What is diffrence between Server.transfer and Response.redirect.
  5. Is there any inbuilt paging(for example shoping cart. which will show next 10 records without refreshing) in ASP? How will you do pating.
  6. What does Server.MapPath do?
  7. Name at least three methods of response object other than Redirect.
  8. Name at least two methods of response object other than Transfer.
  9. Tell few programming diffrence between ADO and DAO programming. What is state?
  10. How many types of cookies are there?
  11. Tell few steps for optimizing (for speed and resources) ASP page/application
This entry was posted in .NET. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

43 Comments on ASP interview questions and answers

  1. Aparna
    Posted 12/13/2004 at 1:01 am | Permalink

    The answer for Q3 is global.asa file

  2. Mark
    Posted 12/14/2004 at 3:17 pm | Permalink

    How many objects are there in ASP? There are 6 objects. 1. Request, 2.Response, 3. Session, 4. Server, 5. Application, 6. ObjectContext

  3. Malathi
    Posted 12/14/2004 at 3:54 pm | Permalink

    I guess there is a typo in Question number 8. “Name at least two methods of response object other than Transfer”. It should be Server object instead of Response Object. Transfer method belongs to “Server” Object not to reponse object.

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iissdk/iis/ref_vbom_resomre.asp

  4. Ravish Malhotra
    Posted 12/15/2004 at 4:29 pm | Permalink

    I need answers to all of the question–>
    How many objects are there in ASP?
    Which DLL file is needed to be registered for ASP?
    If you want to initialize a global variable for an application, which is the right place to declare it? (like form or some other file).
    What is diffrence between Server.transfer and Response.redirect.

    Is there any inbuilt paging(for example shoping cart. which will show next 10 records without refreshing) in ASP? How will you do pating.
    What does Server.MapPath do?
    Name at least three methods of response object other than Redirect.
    Name at least two methods of response object other than Transfer.
    Tell few programming diffrence between ADO and DAO programming. What is state?
    How many types of cookies are there?
    Tell few steps for optimizing (for speed and resources) ASP page/application

  5. swapna
    Posted 12/16/2004 at 1:08 am | Permalink

    I need answers to all of the question–>
    How many objects are there in ASP?
    Which DLL file is needed to be registered for ASP?
    If you want to initialize a global variable for an application, which is the right place to declare it? (like form or some other file).
    What is diffrence between Server.transfer and Response.redirect.

    Is there any inbuilt paging(for example shoping cart. which will show next 10 records without refreshing) in ASP? How will you do pating.
    What does Server.MapPath do?
    Name at least three methods of response object other than Redirect.
    Name at least two methods of response object other than Transfer.
    Tell few programming diffrence between ADO and DAO programming. What is state?
    How many types of cookies are there?
    Tell few steps for optimizing (for speed and resources) ASP page/application

  6. shiva
    Posted 12/17/2004 at 1:42 am | Permalink

    Good , ThanQs for one who posted the ibm questions , and the thing is Dont depend for answers even for the simple questions also , all the above are simple and all can get anwers by refering any book .

  7. Leela
    Posted 3/14/2005 at 1:51 am | Permalink

    What is diffrence between Server.transfer and Response.redirect?

    The Redirect method causes the browser to redirect the client to a different URL.
    Syntax : Response.Redirect(URL)

    The Transfer method sends all of the information that has been assembled for processing by one .asp file to a second .asp file.
    Syntax : Server.Transfer(PATH)

  8. Leela
    Posted 3/14/2005 at 1:56 am | Permalink

    #6 What does Server.MapPath do?
    The MapPath method maps the specified relative or virtual path to the corresponding physical directory on the server.

    #7 Name at least three methods of response object other than Redirect
    AddHeader,AppendToLog,BinaryWrite,Clear,End,Flush,Write

    #8 Name at least three methods of server(typo in the question) object other than Transfer
    CreateObject,Execute,GetLastError,HTMLEncode,MapPath,URLEncode,

  9. Smita
    Posted 3/25/2005 at 1:15 am | Permalink

    How many objects are there in ASP? àREQUEST èThis object is mainly used to retrieve the information from the from in a HTML Page. ==Form - To access value from a form submitted using POST method. ==QueryString - To access varibales sent with URL after “?” or from a from submitted using GET method. ==Cookies - To access the value of a Cookie. ==ServerVariables - To access information from HTTP Headers. RESPONSE–>This object is used to send information to the user ( i.e. to the browser).Two mai method is Write & redirect. Session ObjectàThis object is used to store information with a scope to that user sessionSession.Abandon Method to destroy the session object. SessionID - Created by the web application and sent as a cookie to client. TimeOut - To set Session timeout period. Application ObjectàThis object is used to share information among the users of the web application. The variable becomes alive, when the first request to the application comes in. Since the application variables can be accessed by all the users of the application, the lock and unlock method is used to avoid more than one user accessing the same variable. Server ObjectàThis object gives access to Server components,its methods and properties. CreateObject - An important method used to create instance of Server Components HTMLEncode - To HTML encode a string passed URLEncode - To URL encode the string.eg. e.g with help of thse we get capabilities of browser.Set myb= Server.CreateObject(”MSWC.BrowserType”)

  10. jampa raj kiran
    Posted 4/1/2005 at 1:16 pm | Permalink

    Ans. 10) There are 2 types of cookies: (1) Session Based which expire at the end of the session.
    (2) Persistent cokkies which dont exipre.

  11. jampa raj kiran
    Posted 4/1/2005 at 1:26 pm | Permalink

    Ans.9)I just know that DAO
    DAO is Access native data access method whereas ADO is Microsoft generalized data access technology for most databases.
    DAO is generally faster when using MSAccess but id you are using SQL SERVER2000 then ADO would be faster.

  12. Mrs verma
    Posted 4/6/2005 at 9:28 am | Permalink

    I think answer of Q(What is diffrence between Server.transfer and Response.redirect?)
    is incomplete .Answer should be :
    Server.Transfer: It does not change URL and also save round trip from server to Browser.
    Respinse.Redirect: It first chnages the URL in the browser .So from the server it has to
    go to the browser and again it comes to the server for redirection to the desired asp page.
    This way server.transfer is better.But Server.transfer can be used with asp 3.0.

  13. Mrs verma
    Posted 4/6/2005 at 9:29 am | Permalink

    I think answer of Q(What is diffrence between Server.transfer and Response.redirect?)
    is incomplete .Answer should be :
    Server.Transfer: It does not change URL and also save round trip from server to Browser.
    Respinse.Redirect: It first chnages the URL in the browser .So from the server it has to
    go to the browser and again it comes to the server for redirection to the desired asp page.
    This way server.transfer is better.But Server.transfer can be used with asp 3.0.

  14. Himadrish
    Posted 4/11/2005 at 2:08 am | Permalink

    Well Guys all you are doing a great job.

    Still I have one qustion…suppose say I have not enough good skill sets in any languages think .NET, and I would like to work in .NET….And so I go to face one interview..OK.

    Now I had been asked what is an Assembly…well, then what should I told..I’m thinking this..suddenly one dynamic answer come to my mind 9as in past), and prompt reply…Sir the languages politicians used in ASSEMBLY HAll is called an ASSESMBLY and it is compiled in dll format and can be found in our winnt\assesmbly directory…

    So..after this…can I have some chance to prove myself in .NET???

  15. Gyan
    Posted 8/2/2005 at 5:41 am | Permalink

    there are seven objects in ASP

    1. Request, 2.Response, 3. Session, 4. Server, 5. Application, 6. ObjectContext
    7)ASPError

  16. Reeba
    Posted 8/12/2005 at 10:51 am | Permalink

    I had a question what statement has to be defined before a Response.flush

  17. Reeba
    Posted 8/12/2005 at 10:59 am | Permalink

    These were some of the questions that I was asked in an interview.Would appreciate if anyone could give me some answers to them:

    1 What programming model is ASP based on?
    2 Advantages of using interfaces for data access?
    3 What does connection.execute,connection.open do?
    4 set application(”varname”)=session what happens here?
    5 How do you define disconnected Recordset in ASP?
    6 If ActiveCommand property not set in ASP what happens?
    7 Application_start,session_start session_end application_end Is the order important?

    8 What is 1 mod 2?

  18. Reeba
    Posted 8/12/2005 at 12:03 pm | Permalink

    Question 7

    Ans: Response.end
    Response.clear
    Response.flush

  19. Posted 8/23/2005 at 8:27 pm | Permalink

    q1. 12 objects: Response, Request, Application, Session, Server, Error, FileSystem, TextStream, Drive, File, Folder, Dictionary.

    q2. Third-part COM objects.

    q3. global.asa

    q4. Server.transfer - Terminates execution of the current page and begins execution of a new page for the current request.
    Response.redirect - redirect requests from inside an ASP page

    q5. There is no built-in paging method in ASP. The way we can do is, get the numbers of records, use the propert PageSize in the instance of ADODB.Recordset and perform the apropriate calculation and loop to do it.

    q6. The MapPath method maps the specified relative or virtual path to the corresponding physical directory on the server.

    q7. Response.End, Response.Clear and Response.Flush

    q8. Server.HTMLEncode, Server.Execute, Server.CreateObject

    q9. 1 - ADO uses OLE DB to work with data sources, so you will be able to reach many more data sources than with DAO

    2 - With DAO the record that was current before you used AddNew remains current. With ADO the newly inserted record becomes the current record.

    3 - In DAO the Connect parameter of the OpenDatabase method sets the database password when opening a database. With ADO the Microsoft Jet Provider connection property Jet OLEDB:Database Password sets the password instead.

    q10. One.

    q11. Avoid the use of Server Variabels, Sessions and make use of store procedures.

    Quick post. I wish this can help anyone!!

  20. hamanth kumar p
    Posted 9/15/2005 at 6:24 am | Permalink

    i have 20 fields in a table. which is more optimizing for add/deleting/updating:
    creating a stored procedure with all the 20 fields as parameters and calling the stored proc with all the 20 parameters from asp —- or —- create the query string in asp and calling it from asp.

    i think the second is better but most of the people are telling me to use stored procedures.

  21. mahender
    Posted 10/5/2005 at 5:21 am | Permalink

    Hello,
    please tell me the diffrence b/w the dll hell problem and versioning problem in .net

  22. Mickey
    Posted 10/18/2005 at 11:23 am | Permalink

    You should use the SP and not the Querysting whenever possible. The SQL server creates many logical and execution plans and sets up the fastest and most ideal way to do a certain job for each execution.

    If you use a Stored Procedure, the execution plan will be saved in cache and if you run several inserts in a consecutive fashion, the SQL server will calcualte the best plan on the first execution and then just change the paramaters.

    whereas if you run it by querystring, the SQL will have no way of guessing this is the same thing and recalculate the best plans which would be a total waste of time.

    Lets say you want to insert 4 fields into 2 tables.
    and the SQL Server calcualtes the best logical plan in 1 sec
    and then the best execution plan in 2 secs
    and the execution itself takes 1 sec

    if you run this 15 times it will take:
    1+2 (calculation)
    +15 (execution )

    18 secs total

    but if you do not use a SP but rather a Querystring:

    15 * (1+2+1) = 90 secs

    big difference (1.5 mins is a long time to wait even in human standards)

    btw:
    a workaraound is to use a querysring with parameters in it

    string a =@”INSERT INTO table_name (column1, column2)
    VALUES (@value1, @value2)”;

  23. vinayak annam
    Posted 10/31/2005 at 9:19 am | Permalink

    There are 8 asp objects. 1. Request 2. Response. 3.Application 4.Session 5.AspError 6.ObjectContext 7.ScriptingContext 8.Server.

    For more details visit following url:
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iissdk/html/337d53ca-fe73-4e51-a25d-24f4ee5853a7.asp

  24. Antony
    Posted 5/9/2006 at 5:47 am | Permalink

    The comment which was written by Mr. Hickey is very nice. Many disputes are exist among the various programmers regarding the utiliastion of Stored Procedure. I hope this article will bring to an end of this duspute.
    Thanking you
    With regards

    Mr. Antony

  25. deepti
    Posted 6/24/2006 at 4:22 am | Permalink

    hii
    its really very helpful to see all comments
    What programming model is ASP based on?
    2 Advantages of using interfaces for data access?
    3 What does connection.execute,connection.open do?
    4 set application(”varname”)=session what happens here?
    5 How do you define disconnected Recordset in ASP?
    6 If ActiveCommand property not set in ASP what happens?

    i really want to know answers of all these questions

    and connection.execute and connection.open

    in execute you execute a update query or delete query you dont have to open
    table for that
    str=”delete from customers where id=1″
    connection.execute(str)
    str1=”select * from customers”
    and in connection.open str1,con,3,3
    after opening you can check recordcount or any operation you want o carry out

  26. SMITH
    Posted 7/31/2006 at 4:44 am | Permalink

    What is IIS? Have you used it?

  27. Posted 7/31/2006 at 5:31 am | Permalink

    Hiiiiii………

    I wanted to know why is global.asa required in asp pages?? And Can we use asp pages without global.asa??

  28. Jai
    Posted 8/5/2006 at 5:22 am | Permalink

    how to define disconnected recordset in ASP

  29. Twister
    Posted 9/14/2006 at 2:14 am | Permalink

    I wanted to know why is global.asa required in asp pages?? And Can we use asp pages without global.asa??

    global.asa is a default file that is created in the physical directory C:\Inetput\wwwroot. Also, if required we can include events on session_onstart(), session_onend(), application_onstart() and application_end() in global.asa file. We can very well use asp pages without calling global.asa file. It is better to know the purpose of such default files and make use of them in our applications.

  30. Ram Subudhi
    Posted 11/13/2006 at 4:55 am | Permalink

    Server.Transfer() : client is shown as it is on the requesting page only, but the all the content is of the requested page. Data can be persist accros the pages using Context.Item collection, which is one of the best way to transfer data from one page to another keeping the page state alive. Response.Dedirect() :client know the physical loation (page name and query string as well). Context.Items loses the persisitance when nevigate to destination page. In earlier versions of IIS, if we wanted to send a user to a new Web page, the only option we had was Response.Redirect. While this method does accomplish our goal, it has several important drawbacks. The biggest problem is that this method causes each page to be treated as a separate transaction. Besides making it difficult to maintain your transactional integrity, Response.Redirect introduces some additional headaches. First, it prevents good encapsulation of code. Second, you lose access to all of the properties in the Request object. Sure, there are workarounds, but they’re difficult. Finally, Response.Redirect necessitates a round trip to the client, which, on high-volume sites, causes scalability problems. As you might suspect, Server.Transfer fixes all of these problems. It does this by performing the transfer on the server without requiring a roundtrip to the client

  31. Gaurav
    Posted 11/16/2006 at 9:08 am | Permalink

    Q.Is there any inbuilt paging(for example shoping cart. which will show next 10 records without refreshing) in ASP? How will you do pating.
    ANS: With the help of AJAX.

    Q.What statement has to be defined before a Response. Flush
    ANS: Response. Buffer=”TRUE”

    Q.What programming model is ASP based on?
    ANS: Object Based
    Q.What does connection.execute,connection.open do?
    ANS: Connection.Execute- Execute Query.
    Connection.Open- Connect with Database
    Q.Application_start, session_start session_end application_end is the order important?
    ANS: NO
    Q.What is 1 mod 2?
    ANS: 2

  32. Ratnesh
    Posted 12/2/2006 at 3:03 am | Permalink

    hello to all….

    i have a problem regarding to code bellow:

    public partial class _Default : System.Web.UI.Page
    {
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
    try
    {
    Response.BufferOutput = true;
    Response.Redirect(”Default2.aspx”);
    }
    catch(Exception ex)
    {
    Response.BufferOutput = true;
    Response.Redirect(”Default3.aspx”);
    }
    }
    }

    when this code runs there is an exception occurs which is “Unable to evaluate expression because the code is optimized or a native frame is on the top of call stack…” .After that Default3.aspx page call.

    plz help me and tell what is the resion behind it?.

  33. Mujeeb
    Posted 12/19/2006 at 2:22 am | Permalink

    How many objects are there in ASP?
    Seven Objects
    Server - Deals with anything to be done on server (eg script run time)
    Application - Deals with the Start and end of Applications
    Session - Deals with the Start and End of Sessions
    Response - Deals with the Information to be sent to the calling page and control properties of the page
    Request -Deals with the receiving information for the page
    ObjectContext - Allows Access to MTS (Transaction)
    ASPError - Deals with Error generated by an asp Script

    Which DLL file is needed to be registered for ASP?
    asp.dll for asp and system.web.dll for ASP.net

    If you want to initialize a global variable for an application, which is the right place to declare it? (like form or some other file).
    Global.asa

    What is diffrence between Server.transfer and Response.redirect.
    Response.Redirect simply sends a message down to the browser, telling it to move to another page. eg:

    Response.Redirect(”http://www.website.com/”)

    Server.Transfer is similar in that it sends the user to another page with a statement such as Server.Transfer(”pagename.aspx”).

    However, the statement has a number of distinct advantages and disadvantages.

    Server.Transfer, uses server resources to transfer user from one page to another, Preserves the form object while redirection when used the an extra parameter as “PreserveForm=True”, the new page address will not be visible in address bar, you can not use server.transfer to redirect external site.

    Response.Redirect, simply tell the browser to visit another page that can be on the same server or any external website,you can see the new redirected page address in address bar, form contents are not available with in new redirected page

    Is there any inbuilt paging(for example shoping cart. which will show next 10 records without refreshing) in ASP? How will you do pating.

    What does Server.MapPath do?
    get the virtual path of the website

    Name at least three methods of response object other than Redirect.
    Response.write
    Response.Form
    Response.Flush

    Name at least two methods of response object other than Transfer.

    Response.end
    Response.clear
    REsponse.BinaryWrite
    Response.AddHeader

    Tell few programming diffrence between ADO and DAO programming. What is state?
    ActiveX Data Objects
    Data Access objects
    ActiveX Data Objects (ADO) solution to accessing data that can be found in various forms, not only over a local area network (LAN), but over the Internet as well. ADO was the new generation of data access that replaced Remote Data Objects (RDO) and Data Access Objects (DAO), originally created for the JET database engine. JET was originally created for Microsoft Access, and was later used as a choice of databases for small- and medium-sized single- and two-tier database solutions. Then along came ADO.NET

    How many types of cookies are there?
    two cookies, Persistent and Nonpersistent.
    Persistent cookies are stored on your computer hard disk.
    Non-persistent cookies are saved only while your web browser is running

    Tell few steps for optimizing (for speed and resources) ASP page/application
    use less recordset and close it.
    Empty the connection when all processing is finsihed.
    Use Response.write when writing HTML code with in ASP code.

  34. Sumit Bajaj
    Posted 1/20/2007 at 11:45 am | Permalink

    Q10 : Two types of cookies are there :
    1)Temporary- which expires as session is ended
    2)Parmanent- which persist on client machine

  35. Shamim Khan
    Posted 2/1/2007 at 3:26 am | Permalink

    What is the Difference between Server.Transfer and Response.Redirect

  36. anna
    Posted 2/1/2007 at 6:06 am | Permalink

    which dll file is to be registered for ASP

    following

    aspnet_isapi.dll
    system.web.dll
    and worker process aspnet_wp.exe

  37. Senthil Kumar
    Posted 2/12/2007 at 5:15 am | Permalink

    What is the Difference between Application and Session?

  38. Mr. Aniruddha
    Posted 2/15/2007 at 4:21 am | Permalink

    1. Please tell me the difference between Null, Zero, Garbage value.

    2. ASP Code to browse and send any file as an attachment with email.

    2. Please tell me how to integrate paypal in ASP application.

  39. Narasimhan
    Posted 3/20/2007 at 3:58 am | Permalink

    1. Please tell me the ASP COMPONENTS

    2. Please tell me about function and Procedures in ASP

  40. saaurabh
    Posted 3/21/2007 at 6:41 am | Permalink

    ASP Component
    1.ASP adrotator-The ASP AdRotator component creates an AdRotator object that displays a different image each time a user enters or refreshes a page. A text file includes information about the images.

    2.The ASP Browser Capabilities component creates a BrowserType object that determines the type, capabilities and version number of each browser that visits your site.

    3.The Content Linking component returns a Nextlink object that is used to hold a list of Web pages to be navigated.

    4.The ASP Content Rotator component creates a ContentRotator object that displays a different HTML content string each time a user enters or refreshes a page

  41. Naresh Kumar
    Posted 6/16/2007 at 11:47 am | Permalink

    which DLL use for ASP and i know that asp.Net use DLL system.web is used. but for ASP ?

  42. Chandrashekhar Adhav
    Posted 7/24/2007 at 5:44 am | Permalink

    Types of cookies:

    There are two types of cookies: in-memory cookies, and cookies that are stored to the client’s disk. An in-memory cookie is one or more name-value pairs that are stored in the browser’s memory until the browser is closed. A cookie that is stored to disk is a file on the client’s computer that contains name-value pairs.

  43. Maria
    Posted 8/2/2007 at 11:55 am | Permalink

    A. there are 6 objects in ASP
    1)ASP response
    2)ASP request
    3)ASP application
    4)ASP session
    5)ASP server
    6)ASP error

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*