<%@ include file="../../ga4.jsp" %> ASP Applications - Quiz

ASP Applications - Quiz

The correct answers are indicated below, along with the text that explains the correct answers.
 
1. An ASP application consists of what files?
Please select the best answer.
  A. All ASP and HTML files in a virtual directory.
  B. All ASP files in a virtual directory.
  C. All ASP files in a virtual directory and its subdirectories.
  D. All ASP and HTML files in a virtual directory and its subdirectories.
  The correct answer is D. The correct answer is D. A is incorrect because it doesn't mention the files in a virtual directory's subdirectories. B is incorrect because it leaves out HTML files in the virtual directory and all files in its subdirectories. C is incorrect because it leaves out HTML files.

2. If the Application variable acImages_Dir is set to "http://www.dispersednet.com/images/", what HTML would be created by the statement <IMG SRC="<%=Application(acImages_Dir")%>red_btn.gif"> ?
Please select the best answer.
  A. <IMG SRC="http://www.dispersednet.com/acImages_Dir/red_btn.gif">
  B. <IMG SRC="http://www.dispersednet.com/images/red_btn.gif">
  C. <IMG SRC="acImages_Dir/red_btn.gif">
  D. <IMG SRC="http://www.dispersednet.com/images//red_btn.gif">
  The correct answer is B. The correct answer is B. A is incorrect because it substitutes acImages_Dir for the images sudirectory. C is incorrect because is substitutes AcImages_Dir for https://www.acme.com/images. D is incorrect because it leaves out the images subdirectory.

3. What condition must you guard against to avoid having application variables update incorrectly when two users enter a site at the same time?
Please select the best answer.
  A. Race condition.
  B. Lock condition.
  C. Update condition.
  D. Unlock condition.
  The correct answer is A. The correct answer is A. B is incorrect because you use the Lock method to prevent Application variables from being updated by two sessions simultaneously. C is incorrect because the term "update" refers to the type of error, not the condition that caused the error. D is incorrect because you use the Unlock method to release the Application variable so it can be updated by another session.

4. You need to keep track of the number of users on a Web site at a given time. After you initialize the counting variable, where in the Global.asa file should you increment the variable tracking the number of users?
Please select the best answer.
  A. Anywhere in the file.
  B. In the Application_OnStart procedure.
  C. In the Session_OnStart procedure.
  D. In the Application_OnEnd procedure.
  The correct answer is C. The correct answer is C. A is incorrect because the procedures in the Global.asa file run at different times, incrementing the counter at the wrong time would lead to an erroneous result. B is incorrect because the Application_OnStart procedure is only run once, when the first user connects to the site. D is incorrect because the Application_OnEnd procedure only runs when there are no visitors connected to the site.

5. Where is the best place in the Global.asa file for you to store external variables, such as the names of servers or database?
Please select the best answer.
  A. Anywhere in the file.
  B. In the Application_OnStart procedure.
  C. In the Session_OnStart procedure.
  D. In the Application_OnEnd procedure.
  The correct answer is B. The correct answer is B. A and D are incorrect because storing the external variables in either the Application_OnEnd or Session_OnEnd procedures would mean the variables wouldn't be set until at least one user (or all users in the case of the Application_OnEnd procedure) had exited the site. C is incorrect because the variables would be re-set every time a new user visited the site. Placing the external variable definitions there would work, but would not be the best place in the Global.asa file.