Vous êtes sur la page 1sur 14

1.

ASP FAQ What is the ObjectContext object used for? Choice 1: To enumerate the properties of any object in the session or application. Choice 2: To determine whether an object is static or dynamic. *Choice 3: To commit or abort a transaction managed by Microsoft Transaction Server. Choice 4: To enumerate the properties of only current session objects. Choice 5: To determine the state of the server. Which choice will return the physical path of the ASP page? Choice 1: Server.MapPath(this) *Choice 2: Request.ServerVariables("APPL_PHYSICAL_PATH") Choice 3: Request.Session("APPL_PHYSICAL_PATH") Choice 4: Session("APPL_PHYSICAL_PATH") Choice 5: Request.MapPath Which choice is NOT an ADO Connection event handler? Choice 1: ConnectComplete Choice 2: Disconnect *Choice 3: WillConnect Choice 4: ExecutePending Choice 5: InfoMessage Which line of code would instantiate the Browser Capabilities component? Choice 1: var objBrowser = Server.CreateObject("BrowserType") Choice 2: objBrowser = Server.CreateObject("MSWC.BrowserType") *Choice 3: Set objBrowser = Server.CreateObject("MSWC.BrowserType") Choice 4: var objBrowser = Server.CreateObject("MSWC.BrowserType") Choice 5: var objBrowser = CreateObject("MSWC.BrowserType") Which choice will cause the Session.OnEnd event handler to fire? Choice 1: When the client goes to another page in the site. *Choice 2: When the client closes the browser. Choice 3: If the IIS service is paused. Choice 4: When the session times out. Choice 5: When the client opens another browser instance. <% Dim x, y y = "5" For x = 1 to 10 If x = y then Response.write "Match found!" Else Response.write "No match found." End If Next %> Referring to the above, why will "Match found!" never be written to the page? *Choice 1: x is an integer; y is a string. Choice 2: "Match" is the name of a function. Choice 3: The Response.write statement needs parentheses. Choice 4: You cannot dimension more than one variable per line. Choice 5: A loop statement is needed.

2.

3.

4.

5.

6.

Page 1 of 14

7.

Which choice is NOT a property of Dictionary Object? Choice 1: Count Choice 2: Item() Choice 3: CompareMode *Choice 4: Exists() Choice 5: Key() What does the "scope" of a variable refer to? *Choice 1: visibility Choice 2: polymorphism Choice 3: lifetime Choice 4: size Choice 5: datatype <input type=radio name=rbSex value="M">Male <input type=radio name=rbSex value="F">Female Referring to the above, which line (->ChangeTo: "snippet") of code would retrieve the button value? *Choice 1: Choice 2: Choice 3: strSex = Request.rbSex.value strSex = Request("rbSex") For cnt=0 to rbSex.count - 1 If rbSex(cnt).value = selected Then strSex = rbSex(cnt).value exit for End If Next Choice 4: For Each value in rbSex If rbSex.selected = true strSex = value exit for Next strSex = Request("rbSex").selected.value selected radio

8.

9.

Choice 5: 10.

At some point you may use third-party or custom ASP server components. If the component you want to use is c:\winnt\system32\demo.dll, which of the following commands must be executed in order to interface with this .dll? Choice 1: use c:\winnt\system32\demo.dll *Choice 2: regsvr32.exe c:\winnt\system32\demo.dll Choice 3: iis.exe c:\winnt\system32\demo.dll -register Choice 4: register.exe c:\winnt\system32\demo.dll Choice 5: regedit.exe c:\winnt\system32\demo.dll -add What happens when a client submits a form which changes the value of an Application variable? Choice 1: Client actions cannot change Application variables. Choice 2: The change is visible to all clients immediately after the form is processed by the server. *Choice 3: The change is not visible to any client until the application is stopped and started. Choice 4: The change is only visible to future requests made by that client during their current session. Choice 5: The change is visible to all clients, but only after they complete their current sessions and begin a new session.

11.

Page 2 of 14

12.

<% sSQL = "SELECT * FROM CUSTOMERS;" Set objDB = Server.CreateObject("ADODB.Connection") objDB.Open "DSN=NWIND;UID=;PWD=;" Set rsResults objDB.Execute(sSQL) %> What does the server setup require in order for the above code to run? Choice 1: It requires a Transact SQL stored procedure be set up on the MS SQL Server. Choice 2: It requires that an ODBC datasource named NWIND be configured on the web server. *Choice 3: It requires that an ODBC datasource named NWIND be configured on the database server. Choice 4: It requires that an ODBC datasource named NWIND be configured on the browser's machine. Choice 5: Nothing. The ODBC datasource is created dynamically by the objDB.Open command.

13.

Which choice best describes ADOs (ActiveX Data Objects)? Choice 1: The object-based interface to only relational database systems. Choice 2: The object-based interface to the Microsoft Jet DB engine. Choice 3: The object-based interface to RDO. *Choice 4: The object-based interface to OLE DB. Choice 5: The object-based interface to only ODBC accessible data sources. How are sessions maintained? *Choice 1: The browser sends a cookie to the server with each request. Choice 2: The browser sends a QueryString variable to the server with each request. Choice 3 The browser sends a hidden Form variable to the server with each request. Choice 4 The browser sends a long variable to the server in the BODY of each request. Choice 5 None of the above. <% Response.Redirect("http://www.brainbench.com") %> What does the above code accomplish? Choice 1 It sends the response to "http://www.brainbench.com" instead of to the requesting browser. Choice 2 It sends a redirection header back to the browser, and the browser then requests the new target document. Choice 3 It sends the browser the line of sample code, and the browser executes it. Choice 4 The redirection occurs on the server-side, and the first response the browser gets is the head and body of the new target document. *Choice 5 It causes the server to send a request to the target URL and passes the response to the requesting browser.

14.

15.

16.

<% Dim iX iX = 1 mod 2 %> Referring to the above, what is the value of iX? Choice 1 0 *Choice 2 1 Choice 3 2 Choice 4 3 Choice 5 None of the above.

Page 3 of 14

17.

<% Dim Rs, sql, dsn Set Rs = Server.Createobject("ADODB.Recordset") dsn = "DSN=MyMachines;" sql = "SELECT machine FROM machines WHERE RAM = 256" Rs.Open sql, dsn, adOpenForwardOnly, adLockReadOnly, adCmdText Response.Write Rs.RecordCount Rs.Close Set Rs = Nothing %> Assuming adovbs.inc is included in your page and the "machines" table has the following structure within the "MyMachines" datasource : Machine RAM svr1 128 svr2 256 svr3 256 svr4 256 What will the above code return to the page? Choice 1 The Error Message: "The application is using arguments that are of the wrong type, are out of acceptable range, or are in conflict with one another." Choice 2 0 *Choice 3 3 Choice 4 -1 Choice 5 The Error Message: Variable is undefined: 'adOpenForwardOnly'

18.

<HTML> <HEAD> <META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0"> <TITLE></TITLE> </HEAD> <BODY> <Form method=get action=formhandler.asp> <input type=hidden name=hidNumber value="327"> <input type=submit value="submit"> </Form> </BODY> </HTML> Referring to the above, which of the following lines would print the value "327" in the formhandler.asp document? Choice 1 <%Request.QueryString("hidNumber")%> Choice 2 <%=Request.QueryString("hidNumber")%> Choice 3 <%Request("hidNumber")%> Choice 4 <%Request.Form("hidNumber")%> *Choice 5 <%=Request.Form("hidNumber")%>

19.

What can you include if you wish to reference ADO constants by name (instead of by value) when coding in VBScript? Choice 1 adovbs.txt Choice 2 adovbs.inc Choice 3 adovbs.dll Choice 4 adovbs.vbs *Choice 5 adovbs.doc

Page 4 of 14

20.

The interface of an ASP object does NOT consist of which of the following? Choice 1 Events *Choice 2 Functions Choice 3 Properties Choice 4 Methods Choice 5 Collections <form method=post action="handletxtCG.asp"> 1: <INPUT type=text name=txtAddr size=20><br> 2: <INPUT type=text name=txtAddr size=20><br> 3: <INPUT type=text name=txtAddr size=20><br> 4: <INPUT type=text name=txtAddr size=20><br> <input type=submit value="submit"> </form> Assume the user entered text in text boxes 1 and 3 shown above, then clicked submit. In handletxtCG.asp, what would be the value of Request.Form("txtAddr").count property and why? *Choice 1 The value would be 4 since the Request("txtAddr") collection contains a key/value pair for each textbox in the Control Group. Choice 2 The value would be 1 since the Request("txtAddr") collection is zero based. The count value of 1 represents two items with indices 0 and 1. Choice 3 The value would be 1 since only the name/value pair of the last textbox of a Control Group is posted to the server. Choice 4 The value would be 2 since the Request("txtAddr") collection only contains key/value pairs for the textboxes that have a content. Choice 5 The value would be 1 since there is only one textbox collection containing multiple key/value pairs.

21.

22.

Of the choices below, which scope of an Active Server Component will provide maximum scalability? Choice 1 Visible Choice 2 Global *Choice 3 Page Choice 4 Session Choice 5 Application <% Set Application("Thing") = Server.CreateObject("THINGDOER.thingy") %> The above code appears in the global.asa file. What would it accomplish? *Choice 1 It would create a "Thing" object and place it in Contents Collection of the Application object. Choice 2 It would create a "Thing" object and place it in StaticObjects Collection of the Application object. Choice 3 It would create a "Thing" object and place it in the Application.Buffer Collection of the Application object. Choice 4 It would create an application-level variable named "Thing" with the value of the object property "THINGDOER.thingy". Choice 5 It would fail to create a "Thing" object because the code requires the Application.Lock and Application.Unlock methods.

23.

Page 5 of 14

24.

Which of the following provides ADO hierarchial recordset capabilities? Choice 1 Data Shaping Service for OLE DB Choice 2 An ODBC driver that specifically has data shaping capabilities Choice 3 Any ODBC 3.x-compliant database driver Choice 4 ODBC Manager 3.x *Choice 5 Hierarchial Recordset Service for OLE DB connection.Execute command.Execute recordset.Open Each of the above code lines will return a recordset when completed with the proper syntax. Which command can use parameter symbol "?" [ChangeTo] ...Which command can access the Parameters collection? Choice 1 Connection.Execute *Choice 2 Command.Execute Choice 3 Recordset.Open Choice 4 Dataset.Open Choice 5 Recordset.Fetch

25.

26.

Set Application("objIT") = Server.CreateObject("SOME.Object") The code above instantiates an objIT object in which collection? Choice 1 Server.Objects collection Choice 2 Application.Contents collection Choice 3 Server.Contents collection Choice 4 Application.StaticObjects collection *Choice 5 Application.Objects collection

27.

On a server running IIS and using a web browser, typing the URL "c:\inetpub\wwwroot\default.asp" brings up the above sample dialog box. How can you view this page in the web browser? Choice 1 Type the URL "http://c:\inetpub\wwwroot\default.htm". Choice 2 Use File | Open Page. *Choice 3 Type the URL "localhost\default.asp". Choice 4 Use forward-slashes instead of back-slashes. Choice 5 Type the URL "c:\inetpub\wwwroot\default.htm". Which statement is true about object instantiation in an .asp document? *Choice 1 ASP does not instantiate an object that you declare with the <OBJECT> tag until that object is referenced by a script command from an .asp file. The Server.CreateObject method instantiates the object immediately. Choice 2 ASP does not instantiate an object that you declare with the Server.CreateObject method until that object is referenced by a script command from an.asp file. The <OBJECT> TAG instantiates the object immediately. Choice 3 ASP immediately instantiates an object that you declare with the <OBJECT> tag or the Server.CreateObject method. Choice 4 ASP does not instantiate an object that you declare with the <OBJECT> tag in an .asp document. The Server.CreateObject is the only method that instantiates the object. Choice 5 ASP does not instantiate an object that you declare with the <OBJECT> tag or the Server.CreateObject method until that object is referenced by a script command from an .asp file.

28.

Page 6 of 14

29.

<% strColor = Request("txtColor") %> The above code will look through the Request object collections in which order? Choice 1 Server Variables, QueryString, Form, Cookies, and ClientCertificate. Choice 2 QueryString, Form, Cookies, ClientCertificate, and ServerVariables. Choice 3 QueryString, Form, Cookies, ServerVariables, and ClientCertificate. Choice 4 Cookies, QueryString, Form, ClientCertificate, and ServerVariables. *Choice 5 Form, QueryString, Cookies, ClientCertificate, and ServerVariables.

30.

<% Response.Flush %> Before using the above code, which line should precede it? Choice 1 Response.Binarywrite *Choice 2 Response.Clear Choice 3 Response.Buffer = True Choice 4 Response.Buffer = False Choice 5 Response.End

31.

<%= Application("StartTime") %><br> <% response.Write(Application("StartDate"))%><br> <%= Application.Value("StartDayOfWeek")%><br> & What would the above code accomplish? Choice 1 Nothing would be displayed. Choice 2 It would only display the application variable StartDayOfWeek. *Choice 3 It would display the application variables StartTime, StartDate, and StartDayOfWeek. Choice 4 It would only display the application variable StartTime. Choice 5 It would only display the application variable StartDate.

32.

Using IIS 4.0, what is the most exact sequence of events when an ASP page accesses a database? Choice 1 IIS --> ODBC --> ADO --> Database Choice 2 IIS --> Database --> ADO *Choice 3 IIS --> ADO --> OLEDB --> Database Choice 4 IIS --> ADO --> Database Choice 5 IIS --> OLEDB --> Database Which line of code sets the timeout of a session to 600 seconds? Choice 1 Session.Timeout = 10 Choice 2 Session.SetTimeout = 36000 Choice 3 <% *Choice 4 Session.Timeout = 600 Choice 5 Session.Timeout = 36000 In VBScript, if x = 1,000, what function would you use to display x as $1,000.00? *Choice 1 FormatCurrency(x) Choice 2 Dollar(x) Choice 3 DollarAmount(x) Choice 4 FormatMoney(x) Choice 5 FormatMoney(x,"x.xx")

33.

34.

Page 7 of 14

35.

In Internet Explorer, what could you precede a table with in order to have it displayed in an embedded Excel spreadsheet? *Choice 1 Response.ContentType = "application/vnd.ms-Excel" Choice 2 Server.Application = "Excel" Choice 3 Response.Application = "application/Excel" Choice 4 Server.Application = "application/vnd.ms-Excel" Choice 5 Response.UseApp = "ms-Excel" <%@ Language=VBScript %> <%If false Then%> <!-- #INCLUDE FILE="FunctionOne.inc"--> <%Else%> <!-- #INCLUDE FILE="FunctionTwo.inc"--> <%End If%> What would the above code load? *Choice 1 Both files, since Server Side Includes are processed before ASP interpreting. Choice 2 Neither file, since Server Side Includes are processed before ASP interpreting. Choice 3 Only the FunctionTwo.inc file into the ASP page. Choice 4 Only the FunctionOne.inc file into the ASP page. Choice 5 Neither file, since the #INCLUDE statements are commented out.

36.

37.

<% intA = 3 sStrA = "Hello World" sStrB = "Hello World" + intA Response.Write sStrB %> What would be the result of the above code? Choice 1 0 Choice 2 "Hello World" Choice 3 Type mismatch error *Choice 4 "Hello World3" Choice 5 "Hello World, Hello World, Hello World"

38.

Which choice is NOT an ADO collection? Choice 1 Fields Choice 2 Parameters Choice 3 Errors *Choice 4 Records Choice 5 Properties Using VBScript, which of the following Scripting Object(s) is NOT available from scrrun.dll? *Choice 1 TextStream Choice 2 Dictionary Object Choice 3 Err Object Choice 4 FileSystemObject Choice 5 All are available from scrrun.dll.

39.

1.Question : True or False: The Application.Contents.RemoveItems method removes all items that have been added to the Application.Contents collection. True False

Page 8 of 14

2. Question : The ObjectContext object contains which of the following events? OnTransactionStart OnTransactionAbort OnTransactionComplete OnTransactionCommit OnTransactionEnd 3. Question : True or False: The SetComplete method in the ObjectContext object overrides any previous SetAbort methods that have been called in the script of the same page. True False Question : Which of the following ASPError object properties are valid? ASPCode ASPDescription ASPFile LineNumber Description 4. Question : Which server environment variable in the Server variables collection will be 1 if the request is being handled on a secure port? SERVER_PORT_SECURE SERVER_PORT SERVER_PROTOCOL SERVER_SECURE SERVER_SECURE_PORT 5. Question : What will be the output of the asp code shown below when it is executed in a .asp page accessed by the following QueryString? http://hostname/sampleData.ASP?I=Sam&I=Tom <%For Each Data In Request.QueryString("I") Response.Write Request.QueryString("I")(Data) & "" Next %> SAM SAM SAM TOM TOM TOM TOM SAM None of the above 6.Question : Which of the following are valid Request object Collections? Form QueryString Cookie ServerVariables ClientCertificate 7.Question : What condition is tested by the following syntax? <% If Len(Request.ClientCertificate("Subject")) = 0 then some sample condition ? End if

Page 9 of 14

%> If the certificate has expired. If a certificate is valid. If a certificate is present. If the subject of the certificate was issued by a 0th provider. None of the above 8.Question : What will be the result of executing the following code in an ASP page <% Response.Write "<TABLE HEIGHT = 100% Border=1\>" %> A table will get created in the browser when the page is accessed via http. A table will not get created in the browser when the page is accessed via http. 9. Question : Which of the following are valid Response object methods? Flush End Cookie Transfer AppendLog 10. Question : True or False: <% Response.Addheader "WWWauthenticate", "BASIC" %> will cause the client to to use Basic authentication True False 11. Question : Response.ContentType when not specified has a default value of _______________ txt text/plain text/HTML text text/HTM 12. Question : True or False : The GetLastError method returns an Error object describing the error condition that occurred True False 13. Question : The default timeout value of an ASP page script is _________________ 1000 seconds. 10 seconds. 60 seconds. 90 seconds. 120 seconds. 14. Question : How many events does the Server object have? 0 1 2 3 4 15. Question : Which of the following Server methods are valid? CreateInstance CreateObject Redirect Transfer

Page 10 of 14

LastError 16. Question : The OEM code page (in Windows) used for Japanese Kanji is.... 932 912 984 928 982 17. Question : Which of the following are valid Session object methods? Start Abandon Timeout Remove RemoveAll 18. Question : True or False: The StaticObjects collection contains all of the objects created with the <OBJECT> tag within the scope of the session object. True False 19.Question : Which of the following are valid Session object contents collection methods? Add AddItem Remove RemoveAll Item 36. IIS Access Anonymous Authenticated Basic Digest Integrated Windows Application Protection - Low (IIS Process), Medium (Pooled), High (Isolated) 37. SP How will you call? Command Object/Connection Object ASP Transaction ASP Objects Default Timeout Period for Session(20 Min) Application OnStart, Session OnStart, Session OnEnd, Application OnEnd
1. Q. List ASP objects. : A.: Server, Application,

Session,

Request,

Response,

ObjectContext

objects.

2. Q. Suppose, your ASP executes an SQL SELECT statement that runs a few minutes. The ASP generates an : error up to 1.5 minute. How do you enlarge the page waiting time for the result? A.: To enlarge the value of the Server.ScriptTimeout property.

Page 11 of 14

3. Q. What does Server.HTMLEncode method? : A.: The method replaces <, >, & and " characters with HTML special texts: &lt;, &gt;, &amp; and &quot; 4. Q. What are Virtual Directory and Real Directory? How do you convert a Virtual path into its Real Path? : A.: Virtual directory provides access to files of the web site. The Virtual directory is associated to a Real directory in the Local File system of the Internet ServerMethod Server.MapPath converts Virtual file/folder path into Real path. 5. Q. How do you use the Application.Contents? : A.: Application.Contents dictionary is used by the programmer for storage the Web Site global data. The data are shared by all ASP files on the site. 6. Q. Which events are supported by ASP objects? : A.: ASP objects support the following events: Application_onStart Application_onEnd Session_onStart Session_onEnd ObjectContext_onTransactionSubmit ObjectContext_onTransactionAbort First four events must be placed into the GLOBAL.ASA file, located in the root of the virtualdirectory 7. Q. What is Global.ASA file? : A.: Global.ASA file contains the following four event procedures: Sub Application_onStart() Sub Application_onEnd() Sub Session_onStart() Sub Session_onEnd() 8. Q. When do you use Lock and Unlock methods of the Application object? : A.: If we want to change a value of the Application.Contents dictionary, we have to use Application.Lock and Application.Unlock methods before and after the changes. For example: Application.Lock Application.Contents("Visited") = Application.Contents("Visited") + 1 Application.Unlock 9. Q. How do you use Session.Contents property? : A.: Session.Contents property is a dictionary that holds programmer's data (session variables). The data used for passing from one ASP file to another. So, the data are user's connection life time data 10. Q. What are cookies? : A.: Cookies are data that are holded on a client-site (by the Internet Browser) and can be passed from one HTML page to another. Cookies are managed by the Internet Server Site, for example, by an ASP file. 11. Q. How do you kill a cookie? :

Page 12 of 14

A.: An Access to a cookie is provided by the Response.Cookies dictionary. Each element of the collection has property Expires. Negative value (usually, -1) of the property kills cookie immediately. 12. Q. What are Code Page and Locale Id? : A.: CodePage and LcId reflects user's browser International settings:Language and Time Zone 13. Q. How do you force to close a client's connection? : A.: Session.Abandon and Response.End

methods

close

client's

connection.

14. Q. How do you recieve a client's hash? : A.: Request object has two dictionaries: QueryString and Form that contain client's hash passed with methods GET and POST correspondly. 15. Q. How do you detect client's browser type and version? : A.: Request object has a dictionary ServerVariables that holds different useful information, including client-site and server-site data, browser's type and version ( HTTP_USER_AGENT) 16. Q. What is ClientCertificate? : A.: Client Certificates are located on a client-site and secure web site. Client Certificate is a software distributed by the Owner of the Web site to clients.Dictionary Request.ClientCertificates provides an access to the certificates. 17. Q. How do you create an ASP file that sends a GIF-format image to a client? : A.: Object Response has ContentType property and BinaryWrite methods, that allow to send a binaty data, for example: <% Dim oFS, oFile, oStream, sStr Set oFS = Server.CreateObject("Scripting.FileSystemObject") Set oFile = oFS.GetFile(Server.MapPath("SomeFile.gif")) Set oStream = oFile.OpenAsTextStream sStr = oStream.ReadAll Response.ContentType = "image/gif" Response.BinaryWrite sStr %> 18. Q. How do you use buffering of the Response object? : A.: The Response object allows buffering to send data with Buffer property. Method Flash submits data and method Clear clears the data. Methods Redirect and End clear buffer also. 19. Q. How do you redirect program flow control to another ASP file? Which restrictions of the redirection do : you know? A.: Method Response.Redirect moves control of program flow to another ASP/HTML file. The methods is prohibited if some data or cookies already sent without buffering. 20. Q. How do you pass data from one ASP file to another one? :

Page 13 of 14

A.: There are few ways to pass data from one ASP file to another: HTML Page: <input type='hidden'> element Cookies Session.Contents dictionary Application.Contents dictionary Outside the ASP (database, file system) 21. Q. Write an example of the ASP firewall program. : A.: Sorry, the text is so long and that

is

why

cannot

be

shown

here

Murat

22. Q. What is Multi Tier technology? What is Business Object? : A.: Multi Tier (Three-tier, Four-tier, etc) distributes business functionalities to different server applications: Data Server (Database: Oracle DBMS, MS SQL Server, Sybase SQL Server, DB/2) Business Transaction Server (Middle level: MTS, Oracle Application Server) Distribution Server (Web server: MS IIS, Oracle Web Server) Representative Application (MS IE, Netscape Navigator, front-end application) Business Object is supported by the Middle level and provides business rules.

Page 14 of 14

Vous aimerez peut-être aussi