How do I program multiple choice questions that include different text for each wrong answer

You need a way to encode and decode a file with questions, answers, responses to answers, and scores for answers. You don't want to hard code those into blocks. Here is a sample test file for you to start:

Q1,"What is the square root of 4?"
Q1A1,16,0,"No, 16 is the square of 4. You get 0 points."
Q1A2,2,1,"Correct, 2 is a square root of 4. You get 1 point"
Q1A3,"2 and -2",2,"Excellent, you found both square roots of 4"
Q2,"What Greek letter is most used when working with circles?"
Q2A1,"Pie",0,"No, you must be hungry."
Q2A2,"e",0,"Sorry, that's for logarithms"
Q2A3,"Pi",1,"Correct!. Pi is the ratio of a circle's circumference to its diameter."

Column 1 of this Comma Separated Values (CSV) table is a unique key that you can build up with the text JOIN block and your current question and answer numbers. Use that unique key with the lookup in pairs list block to look up questions and answers from the table.
I added a score column (column 3) to allow multiple correct answers of varying value.

This design allows you to reuse the same screen components for different questions and answers.

1 Like