a) to program a Moodle Block, the learning courve is very steep
b) best way is to take an existing block (search for it) that does more or less what you want to do and then start modifying line by line until it does, what you want to do.
c) you have to study also all the built in Moodle blocks, to see how it works
d) YUI and other javascript libraries are possible to integrate. You have to read the according docs
e) to send data back to the server you have to implement GET/PUT Forms
f) the question is, whether you need to send something back to the server or not. The example you show does certainly send NOTHING back to the server. I guess this is pure javascript containing every expected question and answer. There is no artificial intelligence behind it. If it were, then you would have a big job to do to reinvent human interaction parsing and "understanding" what humans ask and what the correct answer might be...
g) if you really send back data to the server, you would have the problem of reloading the page or part of it the whole time
Rosario