Steve Worswick - Jun 1, 2012:
Incidentally, I have wrote these categories as I post and so they make have errors (In case Dave is watching! 
Now how do you think that makes me feel? 
Actually, I think it looks fine, except that I would suggest removing the question marks, and have them placed in the category that actually asks the questions.
This can also be done using topics, but that takes a LOT more creative AIML coding, and you would need to “break out” of the topic at the end of the test. It’s probably better to use the basic method that Steve outlined until you become more proficient in AIML coding.
As to how to call these questions, you would need something like this:
<category>
<pattern>YES</pattern>
<that>WOULD YOU LIKE TO TAKE A TEST</that>
<template>What level of difficulty (EASY, MEDIUM, or HARD) would you like?</template>
</category>
<category>
<pattern>*</pattern>
<that>WHAT LEVEL OF DIFFICULTY *</that>
<template>
<think><set name="testdifficulty"><star/></set></think>
<condition name="testdifficulty">
<li value="easy"><srai>EASYQUESTIONS</srai></li>
<li value="medium"><srai>MEDIUMQUESTIONS</srai></li>
<li value="hard"><srai>HARDQUESTIONS</srai></li>
</condition><get name="quest" />?
</template>
</category>
Grading the questions, or even just getting some sort of coherent response, can be really tricky. The following code amy or may not work, depending on whether the <GET> tag is allowed within the <THAT> tag:
<category>
<pattern>*</pattern>
<that><eval><get name="quest"/></eval></that><!-- Please note that this may well be forbidden! -->
<template>
<condition name="ans">
<li value="*">Thats right! <srai><get name="testdifficulty">QUESTIONS</srai></li>
<li>That is incorrect. Please try again.<srai>ASKTHESAMEQUESTIONAGAIN</srai>
</condition>
</template>
</category>
<category>
<pattern>ASKTHESAMEQUESTIONAGAIN</pattern>
<template><get name="quest" /></template>
</category>
I didn’t add any sort of scoring to that routine, but I’m pretty sure that we discused that bit earlier in this (or possibly another) thread.
As to asking them in a sequential manner, that’s not hard, but it requires a LOT of time and coding, because each question will have two separate categories (one to ask the question, and one to evaluate the answer). It can certainly be done, but it’s more work than I have time or space for in this post. 
Still in all, this should help a bit. And let’s see what Steve says about the “legality” of the solution I proposed. 