User Sessions and Session Variables - Quiz Explanation

The answers you selected are indicated below, along with text that explains the correct answers.
 
1. What does "HTTP is a stateless protocol" mean?
Please select the best answer.
  A. No information about a user or session is stored as part of an HTTP connection.
  B. No information about a user or session can be stored on a server.
  C. No information about a user or session can be stored on the user's computer
  D. No information about a user or session can be stored on a server or the user's computer.
  The correct answer is A.
The correct answer is A. B is incorrect because you can use server variables or a database to store data about a user or session on a server. C is incorrect because you can use cookies to store information about a user or session on the user's computer. D is incorrect for the reasons given for answers B and C.


2. You need to run a routine whenever a user connects to your site. Where would you put the code to be run?
Please select the best answer.
  A. In a cookie.
  B. In a session variable.
  C. In the Global.asa file.
  D. In a schedule file.
  The correct answer is C.
A is incorrect because, while a cookie could theoretically store ASP code, it would not run automatically. B is incorrect because you can't create a session variable until the user has connected to your site. D is incorrect because schedule files are used with the Ad Rotator component and aren't used to store executable code.

3. Which of the following code snippets represents the proper HTTP construction of a URL with spaces?
Please select the best answer.
  A. http://www.dispersednet.com/product.asp?shirt=U_of_C_Tshirt
  B. http://www.dispersednet.com/product.asp?shirt=U+of+C+Tshirt
  C. http://www.dispersednet.com/product.asp?shirt=U%20of%20C%20Tshirt
  D. http://www.dispersednet.com/product.asp?shirt=U&of&C&Tshirt
  The correct answer is C.
A is incorrect because the underscore character is used in combination with a space to indicate that two lines of code should be read as a single line. B and D are incorrect because the & and + characters are used to concatenate strings involving variables or literals, not to represent a space in a URL.

4. You want to assign a unique identifier to every site visitor. Which of the following values is the best choice for that value?
Please select the best answer.
  A. The user's SessionID value.
  B. A value generated in the Session_OnStart routine.
  C. A value supplied by the user.
  D. The time the user's session began.
  The correct answer is B.
The correct answer is B. A is incorrect because the SessionID values are reset whenever the server is restarted. C is incorrect because users could submit the same value without knowing it. D is incorrect because two or more users could start their sessions at the same time.

5. What is the default value for the Session.Timeout property?
Please select the best answer.
  A. 15 minutes.
  B. 20 minutes.
  C. 30 minutes.
  D. No default value.
  The correct answer is B.
The correct answer is B. A and C are wrong because they give the wrong default value, while D is incorrect because the property does have the default value of 20 minutes.