ASP Components - Quiz Explanation
The correct answers are indicated below, along with the text that explains the correct answers.
1.
How many Case tests can the Select/Case statement contain?
Please select the best answer.
A.
A minimum of two and a maximum of five.
B.
A minimum of 3 and a maximum of 15.
C.
As many values as were defined when the variable was initialized.
D.
No limit to the number of Case tests.
The correct answer is D.
There is no theoretical limit to the number of Case test in a Select/Case statement. Answers A, B, and C incorrect, as they all refer to a finite limit.
2.
When would you place an End If statement at the end of an If/Then/Else decision structure?
Please select the best answer.
A.
When the Else branch takes you to another .asp script.
B.
When the If/Then statement and the Else statement is written on multiple lines.
C.
When the If part compares two or more variables.
D.
When the Then branch performs a calculation with a mathematical operator.
The correct answer is B.
The End If statement is not needed when the entire structure is written on one line. A is not correct because a jump to another script is not the determining factor. C is incorrect because the number of variables alone is not the determining factor. D is incorrect because the type of operator is not a consideration.
3.
Which of these is equivalent to putting <% Response.Write ("Hello") %> into a script?
Please select the best answer.
A.
<% Write "Hello" %>
B.
<% ("Hello") %>
C.
<%= "Hello" %>
D.
<% Response.Write "Hello" %>
The correct answer is C.
The = sign tells the ASP interpreter to write the expression or literal. A is incorrect because "Write" is not a valid ASP command. B is incorrect because it is missing the = sign.
D is incorrect because the parentheses are required in this form of the command.