Presentation is loading. Please wait.

Presentation is loading. Please wait.

Generating GAIGS XML Scripts II Integrating Algorithm Visualization into Computer Science Education Grand Valley State University June 13-16, 2006.

Similar presentations


Presentation on theme: "Generating GAIGS XML Scripts II Integrating Algorithm Visualization into Computer Science Education Grand Valley State University June 13-16, 2006."— Presentation transcript:

1 Generating GAIGS XML Scripts II Integrating Algorithm Visualization into Computer Science Education Grand Valley State University June 13-16, 2006

2 Adding Interactive Questions GAIGS Scripts can be used to ask four types of questions: True / False Fill in the Blank Multiple Choice Multiple Selection A Multiple Choice Question

3 Question Basics All the questions in a GAIGS script are collected at the end of the XML File Each contains a unique ID number A snapshot can contain a question reference The reference is by ID number A question reference causes the question to appear when the snapshot is shown Questions appear in their own pop-up window

4

5 r queue index.php?line=2 9 Color of the next queue item? red green blue A Simple Visualization with a Multiple Choice Question

6 The Question Reference A question reference comes last in a snapshot The tag just has one attribute, the value of which is the appropriate question id. <!ELEMENT snap ( title, doc_url?, pseudocode_url?, (tree|array|graph|stack|queue|linkedlist|bargraph|node)*, question_ref? )> DTDs for the Snap and Question_ref Elements

7 DTDs for Question Elements <!ATTLIST question type CDATA #REQUIRED id CDATA #REQUIRED> <!-- TFQuestion: use text "true" or "false" (no quotes) for the correct answer--> <!-- specify "yes" only if it is a MC/MSQuestion, otherwise ignored --> DTDs for Question Elements

8 Question Generation Support I As for GAIGS structures, there are support classes for the generation of question XML. XMLtfQuestion: true / false XMLmcQuestion: multiple choice XMLmsQuestion:multiple selection XMLfibQuestion:fill in the blank Each support class allows the definition of the question text, choices, and correct answer(s).

9 Question Generation Support II To include a question in a snap, pass a question in ShowFile method writeSnap This method also require documentation and pseudocode urls (or nulls) writeSnap(String title, double titleSize, String doc_url, String pseudo_url, question q, GAIGSdatastr… ds) writes to the file the XML for a snap with the title titleSize (optional parameter) documentation url pseudocode url question and each of the listed structures.

10 XMLtfQuestion Constructors: XMLtfQuestion(ShowFile f, String id) The id string must be unique within a script ShowFile reference is a legacy code issue. Key Methods: setQuestionText(String text) sets the text which will be displayed as the question. setAnswer(boolean value) set the correct answer to value.

11 XMLtfQuestion Example int id = 0; boolean swapIsDone = false; … XMLtfQuestion tf = new XMLtfQuestion(show, id + ""); id++; tf.setQuestionText("Will a swap be done next?"); … show.writeSnap(TITLE, null, null, tf, …); … tf.setAnswer(swapIsDone);

12 XMLfibQuestion Constructor: XMLfibQuestion(ShowFile f, String id) The id string must be unique within a script ShowFile reference is a legacy code issue. Key Methods: setQuestionText(String text) sets the text which will be displayed as the question. setAnswer(String text) set text to be one of answers to be accepted as correct.

13 XMLfibQuestion Example int id = 0; int swapsThisPass = 0; … XMLfibQuestion fib = new XMLfibQuestion(show, id + ""); id++; fib.setQuestionText("How many swaps will be made this pass?"); … show.writeSnap(TITLE, null, null, fib, …); … fib.setAnswer(swapsThisPass + "");

14 XMLmcQuestion Constructor: XMLfibQuestion(ShowFile f, String id) The id string must be unique within a script ShowFile reference is a legacy code issue. Key Methods: setQuestionText(String text) sets the text which will be displayed as the question. addChoice(String text) set text to be one of possible choices. setAnswer(int n) sets choice n to be the correct choice (starts from 1).

15 XMLmcQuestion Example int id = 0; int futurePasses = 0; … XMLmcQuestion mc = new XMLmcQuestion(show, id + ""); id++; mc.setQuestionText("Which of the following is true?"); mc.setChoice("No further passes will be made."); mc.setChoice("One more pass will be made."); mc.setChoice("More than one more pass will be made."); … show.writeSnap(TITLE, null, null, mc, …); … mc.setAnswer(futurePasses + "");

16 XMLmsQuestion Just like XMLmcQuestion, except setAnswer can be used more than once to define all the correct choices

17 Probabilistic Question Asking I The support classes allow the user to define the number of questions to be asked during a session, despite how many are “added”. This is done by specifying the number of questions to actually be asked. the number of times questions will be added using writeSnap. Then when questions are added using writeSnap, they are sometimes discarded in order to ask the correct number of questions.

18 Probabilistic Question Asking II To do this, use the alternative constructor for ShowFile: ShowFile(String fileName, int count, int possibles) fileName is the name of the file to be written to. ask no more than count questions, using possibles to compute probabilities. if possibles is exact, then exactly count questions will be asked.

19 Bubblesort + Questions Return to your Bubblesort visualization and Add a question which asks how many swaps will be made during the next pass (asked just before a pass). Add a question which asks if a swap will be made (asked just before a comparison is made). Use probabilistic questioning to limit the number of questions asked during a session.


Download ppt "Generating GAIGS XML Scripts II Integrating Algorithm Visualization into Computer Science Education Grand Valley State University June 13-16, 2006."

Similar presentations


Ads by Google