Make your own free website on

ASP - Grade A

1. <% strName="John Smith" %> Referring to the above, if you want to pass the contents of the strName variable in a hyperlink, which line of code would you use?
A. This cannot be done. The anchor is on the client and the variable is on the server. B. href="Encode.asp?name=<%=Server.URLPathEncode(strName)%>">click here</a> C. <a href="Encode.asp?name=<%=strName%>">click here</a> D. <a href="Encode.asp?name=<%=Server.HTMLEncode(strName)%>">click here</a> E. <a href="Encode.asp?name=<%=Server.URLEncode(strName)%>">click here</a>  
2. <%@ Language=VBScript %> <%If false Then%> <!-- #INCLUDE FILE=""--> <%Else%> <!-- #INCLUDE FILE=""--> <%End If%> What would the above code load? A. Only the file into the ASP page. B. Both files, since Server Side Includes are processed before ASP interpreting. C. Only the file into the ASP page. D. Neither file, since Server Side Includes are processed before ASP interpreting. E. Neither file, since the #INCLUDE statements are commented out. 3. <% Response.Redirect("") %> What does the above code accomplish? A. It sends the browser the line of sample code, and the browser executes it. B. It sends the response to "" instead of to the Requesting browser. C. It sends a redirection header back to the browser, and the browser then requests the new target document. D. The redirection occurs on the server-side, and the first response the browser gets is the head and body of the new target document. E. It causes the server to send a request to the target URL and passes the response to the requesting browser. 4. How are sessions maintained? A. The browser sends a cookie to the server with each request. B. The browser sends a QueryString variable to the server with each request. C. The browser sends a hidden Form variable to the server with each request. D. The browser sends a long variable to the server in the BODY of each request. E. None of the above. 5. When does the application OnEnd event handler fire? A. After every request for an application document, since web servers are stateless servers. B. As soon as there are no open connections to any application document. C. When the web server is stopped in an orderly fashion. D. Twenty minutes after the last request for a document in the application. E. When there are no application requests for the amount of time defined by the SessionTimeout variable. 6. How long is a sessionID guaranteed to be unique? A. It is unique for the web server, whether it is restarted or not. B. Only until the web server is restarted. C. It is like a GUID in that it is for any web server at any time. D. Only until the session expires, then it can be reissued to another client. E. It is unique per client. A client cannot have two sessions with the same sessionID 7.Which code sample will report whether the client's browser supports cookies? A. <% var objFSO = Server.CreateObject("Scripting.FileSystemObject") response.write objFSO.cookiesSupported %> B. You can only use JavaScript for this. C. <% var objFSO = Server.CreateObject("Scripting.FileSystemObject") response.write objFSO.cookies %> D. <% var objBrowser = Server.CreateObject("MSWC.BrowserType") response.write objBrowser.cookies %> E. <% var objBrowser = Server.CreateObject("MSWC.BrowserType") response.write objBrowser.cookiesSupported %> 8. <input type=radio name=rbSex value="M">Male <input type=radio name=rbSex value="F">Female Referring to the above, which line of code would retrieve the selected radio button value? A. For cnt=0 to rbSex.count - 1 If rbSex(cnt).value = selected Then strSex = rbSex(cnt).value exit for End If Next B. strSex = Request("rbSex").selected.value C. strSex = Request("rbSex") D. strSex = Request.rbSex.value E. For Each value in rbSex If rbSex.selected = true strSex = value exit for Next 9. The FileSystemObject provides an object interface to drives, directories, and files for which of the following? A. Any local or mapped drive on either the server or the client. B. Only files and subdirectories in the web site's home directory. C. Any local physical drive or mapped drive on the web server. D. Any file system physically located on the web server. E. The client's computer.   10. What purpose is served by the Application.lock method? A. It locks the Application object, preventing other clients from altering any values in the Contents collection. B. It locks the application, preventing the server from responding to any requests for application documents. C. It locks the application, preventing non-SSL requests from being processed. D. It locks the Application object, preventing other clients from reading any values in the Content collection. E. It locks other clients from reading the Contents collection. 11. How to Display images using Response object A. Contenttype=Application/Brush B. Contenttype=Image/JPG C. Contenttype=Application/paint D. Contenttype=Image/WMF 12.What is the use of following Statement Response.Expires=120 A.The page will be removed form cache after 120 Hours B.The page will be removed form cache after 120 Sec C.The page will be removed form cache before 120 Min D.The page will be removed form cache after 2 Hours 13. Which choice is NOT a property of Dictionary Object? A. Key() B. CompareMode C. Item () D. Exists () E. Count 14. Using VBScript, which of the following Scripting Object(s) is NOT available from scrrun.dll? A. TextStream B. Dictionary Object C. Err Object D. FileSystemObject E. All are available from scrrun.dll. 15. What is an .ASP file? It is a Text File that contains the combination of the following: · Text · HTML tags · Script Commands 16.How are scripts executed?
ASP provides scripting engines that execute the corresponding scripting languages on the server side. Scripts should be encoded within the <% ….%> delimiters. 17. What are the browsers that can access ASP pages?
· Internet Explorer (supports VBScript, JavaScript) · Netscape Communicator/ Navigator (supports only JavaScript, Vbscript can be also added too) 18. What is a "Virtual Directory"? Virtual directories are aliases for directory paths on the server. It allows to move files on the disk between different folders, drives or even servers without changing the structure of web pages. It avoids typing an extremely long URL each time to access an ASP page. 19. What is the difference between client-side script and server-side script? Scripts executed only by the browser without contacting the server is called client-side script. It is browser dependent. The scripting code is visible to the user and hence not secure. Scripts executed by the web server and processed by the server is called server-side script. 20. Give the comment Tags for the following:
VBScript : REM & ‘(apostrophe) JavaScript : // (single line comment) /* */ (Multi-line comments) 21.How can you disable the browser to view the code?
Writing codes within the <! -- //-- > Tag. 22. How does the server identify and execute the server-side scripts within HTML code?
· Including the RUNAT=SERVER attribute in the <SCRIPT> tag · Use <% … %> server script delimiter 23. How can you change the primary scripting language for a page? Specify <%@ LANGUAGE = Scripting language %> 24. What is the order of execution for an ASP application?
1) Global.asa 2) Server-side Includes 3) Jscript scripts tagged within <SCRIPT> tags 4) HTML together with scripts tagged within <% … %> delimiters 5) VBScripts tagged within <SCRIPT> tags 25. What are the tasks performed by <FORM> tags? · <FORM> tags provides space for the user to input values · the form has a button to submit information back to the server · It transfers control to another ASP page · It carries the information in the fields to another ASP page 26. What are the attributes of the <FORM> tags? What are their functions? The two attributes are ACTION and METHOD The ACTION gives the name of the ASP file that should be opened next by which this file can access the information given in the form The METHOD determines which of the two ways (POST or GET) the browser can send the information to the server 27. What are the tags necessary to be present within the <FORM> tag?
<INPUT> tag: Provides input spaces (text boxes, combo boxes, radio button, etc.) on a form called fields. It has three attributes TYPE, NAME and VALUE. TYPE provides the characteristics of the field and the NAME specifies a name to the field by which it can be referred. 28. What is QueryString collection?
This collection stores any values that are provided in the URL. This can be generated by three methods: · By clicking on an anchor tag <A> · By sending a form to the server by the GET method · Through user-typed HTTP address 29. What is a Form collection?
The Form collection holds the values of the form elements submitted with the POST method. This is the only way to generate a Form collection. 30. What is the difference between QueryString collection and Form collection? The main difference is that the QueryString collection gets appended to a URL(with a ?) and can be generated by three ways whereas the Form collection is sent as part of the HTTP request body and there is only way to generate a Form collection. 31. What is Cookies collection?
Cookies are text files that store information about the user by which the web server identifies and marks each different visitor to a web site and determines where a user has been before. A cookie can store information only when the user sends it. Individual cookies are limited to 4KB of data. The maximum number of cookies allowed is 300. Cookies are stored on client’s machine. 32. What is the difference between Cookies collection and Form/QueryString collection? Cookie collection does not have the Count property. Cookies can have multiple values for the same cookie name but each value can be referred using a key whereas in a Form/QueryString cookie each value has to be referred using a index value. 33. What is ServerVariables collection? The ServerVariables collection holds all of the HTTP headers and also additional items of information about the server. 34. What is ClientCertificate collection? A ClientCertificate is an encrypted number that is stored in a file on the user’s computer. This stores details of any security certificates included with the request. 35. What are the event handlers of Session Object?
· Session _OnStart – This event will be fired when a new user begins a session with the web site. · Session_OnEnd – This event is called whenever a session terminates. 36. What are the advantages of Cookies over Session Object? · It informs each page what session the request belongs to when a user accesses during a session. · It retrieves all the session information stored on the server. · Cookies can persist for a much longer period of time than session that has a timeout value usually of 20 minutes and hence can store information even when a user is of f the site. 37. How will you delete a Cookie? By setting its Expires property to any date prior to today Response.Cookies("cookie name").Expires = Date – 1. 38. What is Server Object?
Controls the ASP execution environment. It can set the amount of time script can run before an error occurs. Converts a virtual path to a physical path on the server. Takes a user supplied string and encode it into proper format for a URL string. 39. What is a TextStream object?
It allows you to access(read/write) the contents of text files stored on the web server. 40. What is an Err Object? Name it’s properties and methods? An object used to trap errors in the application. Description, Number, Source, HelpFile and HelpContext are its properties and Raise and Clear are its method. 41. What is Extranet? An area of a web site available only to a set of registered visitors.