Computer Notes

Reviews
Tags
Stats
views:
36
rating:
not rated
reviews:
0
posted:
8/17/2009
language:
English
pages:
0
ASP Questionnaire Date: March 31,2003 Author: ravindra Sadaphule Number: Heading: Question: Answer: 1 IIS What is ISAPI filter? An ISAPI filter is a custom dll that is called by web server in reponse to every http request. In this way, the ISAPI filter changes the manner in which web server itself behaves. The ISAPI filter then instructs the web server how to handle the request. ISAPI filters thus allow to customize web server‟s response. ISAPI dll can be written only in C++. TL Comments: Level: Number: Heading: Question: Answer: Comments: Level: 2 ASP Object Model Response.CacheControl = "Public". What is the result if a client loads a page with the code above . The page is cached on proxy server. SE Number: Heading: Question: 3 ASP Object Model <% SET Conn = Server.CreateObject( "ADODB.Connection" ) Conn.Open "DSN=db1" sSQL = "SELECT field1 FROM table1" Set rsTest = Conn.Execute(sSQL) RsTest.MoveFirst Do Until rsTest.EOF Response.write rsTest(0) & "
" Loop %> Assuming the connection and SQL are valid and table1 has at least one row, what is the result of the above code? Answer: Comments: Level: Script timeout error SE Number: Heading: Question: 4 ASP Object Model Function encodeCheck(encodeVar) If Not IsNull(encodeVar) Then encodeCheck = Server.HtmlEncode(encodeVar) Else encodeCheck = "" End If Response.write enclodecheck End Function Why is the above code necessary when dealing with values obtained from a database? Answer: Comments: Level: To prevent browser from interpreting special html characters contained in variable encodevar SSE Number: Heading: Question: Answer: 5 ASP Error Handling On Error goto 0 On Error Resume Next What is the result of including the code in the sample above in a page? On error goto 0 In this case preprocessing, syntax errors and runtime errors are captured by IIS and execution will be redirected to page 500-100.asp . On Error Resume Next In this case preprocessing, syntax errors are captured by IIS and execution will be redirected to page 500-100.asp . Runtime errors will not cause IIS to redirect to 500-100.asp page. Comments: Level: SE Number: Heading: Question: Answer: Comments: Level: 6 ASP Object Model What do you use in order to determine if the cookie "FavoriteMovies" in the Request object contains more than one entry? Request.Cookies("FavoriteMovies").HasKeys SE Number: Heading: Question: Answer: Comments: Level: 6 ASP objects model What are ASP intrinsic objects? There are 7 ASP intrinsic objects. They are Application, ASPError, ObjectContext, Request, Response, Server, Session. SE Number: Heading: Question: Answer: 8 ASP Object Model Explain events of Application object. Application object has 2 events, Application_Onstart and Application_OnEnd . Application_Onstart fires when the first user requests page from application. Application_OnEnd fires when the web administrator unloads the application using Microsoft Management Console. SE Comments: Level: Number: 9 Heading: Question: Answer: ASP object model Write a ASP subroutine that returns current date. Write ASP code that invokes this function and displays date returned. <% ….. Response.write GetDate …..%> Comments: Level: SE Number: Heading: Question: Answer: Comments: Level: 10 ASP Object Model How do u avoid conflict when 2 or more users attempt to modify application variable? Use Application.Lock, then modify the variable and then use Application.unlock. This essesntially serializes user requests. SE Number: Heading: Question: Answer: 11 ASP object model How will u go about writing your own User Hit Counter for a website? Use Application variable say Application(“UserHitCounter”) to maintain the page hit counter. The value of UserHitCounter is incremented on Session_Onstart event . Since this variable is in memory, it could get destroyed if somebody stops IIS. Hence OnApplication_End event , this variable should be written into a file. Also In Application_Onstart event, this variable should be loaded from file. SSE Comments: Level: Number: Heading: Question: 12 ASP Object Model What will be values of dblPi and strCountry in following code <%… Application.Contents.Removeall Application.Contents(“pi”) = 3.1415567 Application.Contents(“Country”) = “India” Application.Contents(“State”) = “MH” Dim dblPi, strCountry DblPi = Application.Contents(0) StrCountry = Application.Contents(1) … %> DblPi will be initialized with undefined value. StrCountry = “3.1415567” This is because contents collection of application is 1 based and not 0 based SE Answer: Comments: Level: Number: Heading: Question: 13 Asp Object Model What will be values of strFirst, strMiddle and strLast in following code <%…. Application.Contents.RemoveAll Application(“FirstName”)= “Ravindra” Application(“MiddleName”)= “Chandrakant” Application(“LastName”)= “Sadaphule” Application.Contents.Remve(“MiddleName”) Dim strFirst, strMiddle, strLast StrFirst = Application(1) StrMiddle = Application(2) StrLast = Application(3) %…> Answer: StrFirst = “Ravindra” StrMiddle = “Sadaphule” StrLast = undefines SE Comments: Level: Number: Heading: Question: Answer: 14 ASP Object Model What is staticobjects collection of application object? StaticObjects collection contains all of the objects added to the application through the use of tag in Global.asa file and has application scope. e.g. SE/SSE/TL Comments: Level: Number: Heading: Question: Answer: 15 ASP Object Model What is difference between objects created with tag and objects created with Server.CreateObject? Objects created with server.createObject get instantiated as soon as server.createobject is called. Objects created with tag get instantiated only after property or mehod of that object is called for the first time. TL Comments: Level: Number: Heading: Question: 16 ASP Object Model Is it possible to use Server.MapPath() in Application_Onstart event and Application_OnEnd event? Answer: Comments: Level: SE Server.Mappath can be used in application_onstart but it can not be used in Application_OnEnd Number: Heading: Question: Answer: 17 ASP Error Handling How do u retieve rutnime error message in ASP? Dim objErr ObjErr = Server.GetLastError Response.write “Source:” &objErr.Source „Line that has caused the error Response.write “Line:” & objErr.Line „ Line number Response.write objErr.Description „Error description SE Comments: Level: Number: Heading: Question: Answer: Comments: Level: 18 ASP Object Model How do u make ASP page transactional? Include <%@ TRANSACTION=Required %> directive at the top of the page. SE Number: Heading: Question: Answer: 19 ASP Object Model Why is it not recommended to give objects functioning in transaction a session or application scope? It is not recommended because transactional objects are deactivated at the end of their transaction i.e. after setcomplete / setabort method. If u give such an object session or application scope, calls after the end of the transaction will fail and raise an error. Comments: Level: TL Number: Heading: Question: Answer: 20 ASP object model When can we say that transaction on ASP page is successfully completed. Transaction in ASP page is said to be completed - if all components invoked on the page calls setcomeplete or - if none of the components call setAbort [Autocomplete] If any of compenents call setabort() then the transaction is aborted SSE Comments: Level: Number: Heading: Question: Answer: Comments: Level: 21 ASP Object model If response.buffer = true and ASP script takes too long too execute, then what needs to done to avoid user seeing a blank page for a long time? User response.flush to outpout intermediate data. SE Number: Heading: Question: Answer: 22 ASP Object Model What does reponse.AppendToLog strLogMessage do? This statement adds a string specified in strLogMessage to Webserver log for the current client request.. This log is present in winnt\system32\logfiles\w3svc1\ex[date].log. SE Comments: Level: Number: Heading: Question: 23 ASP Object Model What is output of following code? <% Dim strFileName strFileName="/Apps/CustomerDetails.inc" %> <% response.write "hello world" %> Answer: Active Server Pages, ASP 0126 (0x80004005) The include file '<%=strFileName%>' was not found. /test.asp, line 4 The error ocurrs because server side includes are preprocessed before any asp script code. So during preprocessing stage strFileName was blank Comments: Level: SSE Number: Heading: Question: Answer: 24 ASP Object Model In what way Server.Execute method is better than Server side include? #include directive is processes before any ASP script. Hence it forces ASP ISAPI filter to retrive the filecontents, insert into current script and interpret all included code even if it is never used by the including script. In other words we can not include files dynamically. The server.execute method on the other hand, allows you to execute other asp scripts programaatrically only when the logic in the calling script requires it. That is, execute method allows you to dynamically include scripts. SE Comments: Level: Number: Heading: Question: 25 ASP Object Model What is value of str1 in following 2 scripts Script 1 <% Dim str1 str1 = "
Ravindra Sadaphule
" response.write str1 %> Script 2 <% Dim str1 str1 = "
Ravindra Sadaphule
" response.write Server.htmlEncode(str1) %> Answer: Script1: Ravindra Sadaphule Script 2:
Ravindra Sadaphule
Comments: Level: SE Number: Heading: Question: 26 ASP Object Model Assume that strFilecontents is a ASP variable that contains html source code of a html file. Write ASP code to display this html source code to user. Response.write Server.HtmlEncode(strFileContents) SE Answer: Comments: Level: Number: Heading: Question: Answer: 27 ASP Object Model Write a generic ASP code that displays physical path of a file that includes it. Dim strFilePath StrFilePath = Server.Mappath(Request.ServerVariables(“PATH_INFO”)) Response.write strFilePath SE Comments: Level: Number: Heading: Question: 28 ASP Object Model What will be value of intUserAge at the end of the script? <% … Session(“intUserAge”)=23 Session.Abandon … … Dim intUSerAge IntUserAge = Cint(Session(“intuserage”))/10 Response.write intUserAge ….. ….. …. %> Answer: Comments: Level: 2 . Although Session.abandon is called session variable retian value till the end of the script. Once the script ends session is discarded SE Number: Heading: Question: Answer: 29 ASP Security What is impersonation? Impersonation is when a user gains access to a resource by using a different identity, usually as an anonymous user. To allow this, Windows uses a special user account known as the anonymous logon account. Whenever an attempt is made to access server resources over the Web, the user is automatically logged on anonymously. The user can only access the resources for which the anonymous user account has privileges. By default, the username for the anonymous logon account takes the form IUSR_COMPUTERNAME, in which COMPUTERNAME is the name of the server. Comments: Level: SSE Number: Heading: Question: Answer: 30 ASP Security Which user accounts are used by IIS 4 for impersonation? In IIS, two accounts are used to allow impersonation: IUSR_COMPUTERNAME and IWAM_COMPUTERNAME. These accounts were created when IIS was installed. Whenever IIS receives a request for a Web page or other resources, the IUSR_COMPUTERNAME account was used. And whenever the Web page requested by a user used a COM or COM+ component, the IWAM_COMPUTERNAME account was used. Comments: Level: SSE Number: Heading: Question: Answer: 31 ASP object model When I try to do a Reponse.Redirect, it get an error message about "the HTTP headers are already written..." Why? What can I do? The rules of Web servers say that you can not do a Response.Redirect once anything has been written to the browser! Add the line at the tip of the page <% response.buffer = true %> at the top of the page This prevents writing to the browser until entire page has been executed. SE Comments: Level: Number: Heading: Question: Answer: 32 ASP Security Explain different authentication methods in IIS 4 1. Anonymous Access - This authentication method requires NO username or password to access the site. Anyone can just type in the URL and access the site. This is the default access method for IIS sites/virtual directories and is the authentication mode for 99.9999% of the World Wide Web. 2. Basic Authentication - The authentication method requires you to type in a valid NT login and password to gain access to the system (the NT login must be a valid NT login for the NT domain that the Web server is on). Where Basis Authentication is enabled you will get a popup window asking for the username and password when trying to first visit a resource in that protected site/virtual directory. After you enter the required information the username and password will be transmitted over the network WITHOUT any encryption. This will enable anyone trying to compromise your site examine passwords during the authentication process. 3. Windows NT Challenge/Response (referred to as Integrated Windows Authentication in IIS 5) - This is supposedly the most secure form of Authentication in IIS. When you login, NT validates your login and ONLY the username is transmitted over the network. No password is transmitted. So under no circumstances can your password be compromised. Note that this method will NOT work with Netscape! Comments: Level: SSE Number: Heading: Question: Answer: 33 ASP Object Model What is use LCID propery? LCID property is used for setting date time format and currency format For a particular region. E.g. currency is displayed in US dollars if LCID is set for United States whereas it will be displayed in Pounds if LCID is set for United kingdom. This property is used by FormatNumber() , FormatCurrency functions of ASP. SE Comments: Level: Number: Heading: Question: Answer: 34 ASP Object model What is difference between response.redirect and server.transfer? Why would I choose one over the other? Response.Redirect tells the browser to request a different page. This function is often used to redirect the user to a log on or error page. Since a redirect forces a new page request, the result is that the browser has to make two round trips to the Web server, and the Web server has to handle an extra request. IIS 5.0 introduces a new function, Server.Transfer, which transfers execution to a different ASP page on the same server. This avoids the extra browser-to-Web-server round trip, resulting in better overall system performance, as well as better response time for the user. Comments: Level: TL Number: Heading: Question: Answer: 35 ASP object model What are different possible values for transaction attribute of transactional components hosted in COM+ environment?  Required The object is always created in a transaction. The object is placed in the transaction of its creator if one exists. If the creator isn't running in a transaction, the COM+ runtime creates a new transaction for the object. Requires New The COM+ runtime creates a new transaction for the object. Supported The object is placed in the transaction of its creator if one exists. If the creator isn't running in a transaction, the object is created without a transaction. Not Supported The object is never created in a transaction.    Comments: Level: SSE Number: Heading: Question: Answer: 36 ASP Object model Why is it recommended to write most of the code in COM components rather that in ASP script? It is recommended because Comments: Level: SE ASP script is interpreted whereas COM components are compiled. Better error handling in COM Early binding in COM results in performance improvement. Number: Heading: Question: 37 ASP Data Access Suppose I have stored procedure given below. CREATE PROCEDURE myProc AS BEGIN SELECT columns FROM table1 SELECT columns FROM table2 SELECT columns FROM table3 END How will I display all rows from all 3 recordsets returned by stored procedure. Answer: <% ' ... ' assuming valid and open object, conn set rs = conn.execute("EXEC myProc") ' process first resultset if not rs.eof then do while not rs.eof response.write rs(0) rs.movenext loop end if ' move to second resultset, using nextRecordSet() set rs = rs.nextRecordSet() if not rs.eof then do while not rs.eof response.write rs(0) rs.movenext loop end if ' move to third resultset, using nextRecordSet() set rs = rs.nextRecordSet() if not rs.eof then do while not rs.eof response.write rs(0) rs.movenext loop end if rs.close: set rs = nothing ' ... %> Comments: Level: SE Number: Heading: Question: Answer: 38 ASP Object model How do I use FileSystemObject to create a file on the client? You don't. You can't use ASP to read, write, copy, move or delete files on the client's machine. ASP runs on the server; what you need to handle this is a client-side technology, such as an ActiveX control or a signed Java applet. If you want to get a file from the client's system to your server, you must ask them to upload it. And no, you can NOT pre-populate or otherwise programmatically interfere with the element. If you want to get a file from the server to the client's system, you must ask them to download it. And no, you can NOT force the location -- or even the filename -- that the user will save with. Comments: Level: SE Number: 39 Heading: Question: Answer: ASP Object Model How do I make my ASP page refresh? You can use the Response.AddHeader method to force a timed reload or delayed refresh / redirection in an ASP page. The following code will cycle the current page every ten seconds (and is functionally equivalent to adding a tag to the HTML): Response.AddHeader "Refresh", "10" SE Comments: Level: Number: Heading: Question: Answer: 40 ASP Object Model Should I use sessionID to uniquely identify users (e.g. primary key)? NO. SessionID is a "random" string and, as noted in the documentation for all versions of IIS, can be repeated. So if you store information for a user based on the SessionID value, be very aware that a new person next week might happen to get the same SessionID value -- this will either violate a primary key constraint, or mix two or more people's data. TL Comments: Level: Number: Heading: Question: 41 ASP Object Model What wil be value of recordcount in following code <% RS.Open SQL, Connection, adOpenForwardOnly, adLockReadOnly response.write RS.RecordCount %> -1. Since forwardonly recordset does not support recordcount property. SSE Answer: Comments: Level: Number: Heading: Question: Answer: 42 Javascript How do I close a pop up window say after 5 seconds ? ... Comments: Level: SE Number: Heading: Question: Answer: Comments: Level: 43 ASP Data Access If you wanted to create a disconnected Recordset, which cursorlocation setting must you specify when opening the Recordset? CursorLocation=adUseClient SSE Number: Heading: Question: Answer: Comments: Level: 44 ASP Object Model What is the purpose of the Response.Status property? It specifies the value of the status line returned by the server. E.g. HTTP 404 error SE Number: Heading: Question: 45 ASP data Access Dim Rs Set Rs = Server.Createobject("ADODB.Recordset") Rs.Open "Select * From Customers", "DSN=Northwind;" Considering the recordset created above, how do you print table headings of the names of all fields returned? Answer: Comments: Level: For i = 0 To Rs.Fields.Count - 1 Response.Write "" & Rs.Fields(i).Name & "" Next SE Number: Heading: Question: 46 Referring to the above sample code, in handleform.asp, what does Request.Form("number") contain? "6" Answer: Comments: Level: SE Number: Heading: Question: Answer: Comments: Level: 47 HTML The script event "onload" is typically be associated with which one of the HTML elements? BODY SE Number: Heading: Question: 48 HTML

Name? What file?

What is missing in above code? Answer: Comments: Level: Form tag should have ENCTYPE attribute set to “multipart/form-data” SE Number: Heading: Question: 49 Javascript var x = "Hello There!"; var y = x.substr(2, 5); Referring to the above, what is the value of y? y = "llo T" SE Answer: Comments: Level: Number: Heading: Question: 50 Javascript var x; x = 5 * 5 * 5 * 5 * 5; Rewrite above statement using javascript built-in function? x = Math.pow(5,5); SE Answer: Comments: Level:
About
I am Computer Professional, did my MCA and seeking a Job in Software industry. I love computers
Other docs by aswath ramacha...
Wireless Networking
Views: 78  |  Downloads: 3
Wireless Networking
Views: 42  |  Downloads: 1
Wireless Networking
Views: 25  |  Downloads: 2
Wireless Networking
Views: 25  |  Downloads: 0
Wireless Networking
Views: 16  |  Downloads: 0
Wireless Networking
Views: 27  |  Downloads: 0
Wireless Networking
Views: 24  |  Downloads: 2
Wireless Networking
Views: 15  |  Downloads: 1
Wireless Networking
Views: 11  |  Downloads: 0
Wireless Networking
Views: 8  |  Downloads: 0
Wireless Networking
Views: 10  |  Downloads: 0
Wireless Networking
Views: 12  |  Downloads: 0
Wireless Networking
Views: 7  |  Downloads: 0
Wireless Networking
Views: 17  |  Downloads: 1
Wireless Networking
Views: 14  |  Downloads: 1
Related docs
NOTES
Views: 15  |  Downloads: 0
notes
Views: 7  |  Downloads: 0
NOTES
Views: 0  |  Downloads: 0
Computer Notes
Views: 32  |  Downloads: 1
Computer Notes
Views: 94  |  Downloads: 4
Computer Notes
Views: 18  |  Downloads: 2
Computer Components
Views: 50  |  Downloads: 3
Computer Software
Views: 20  |  Downloads: 3
Notes
Views: 27  |  Downloads: 0
Computer Tech Notes - Databases
Views: 35  |  Downloads: 5
Flip Charts and Computer Notes
Views: 97  |  Downloads: 6
NOTES-CHAPTER-1
Views: 0  |  Downloads: 0
NOTES-CHAPTER-1
Views: 3  |  Downloads: 0
NOTES-CHAPTER-1
Views: 5  |  Downloads: 1
NOTES-CHAPTER-1
Views: 18  |  Downloads: 2