Sure.
Lets start with the type:
type questionType
question as string
a as string
b as string
c as string
d as string
solution as integer `1,2,3,4 for a,b,c,d
solutionString as string
endtype
You can define your own types - basically the same thing as integer, string, float etc., just potentially more complex. This data type is designed in a way to contain questions for your quiz as well as their respective solutions. So you could create a single question like this:
myQuestion as questionType
myQuestion.question = "What is 2+2?"
myQuestion.a = "1"
myQuestion.b = "4"
myQuestion.c = "3"
myQuestion.d = "2"
myQuestion.solution = 2
myQuestion.solutionString = "4"
So you have one variable myQuestion that contains all the data. Using the "variable.attribute"-notation you can access the individual values defined in the type.
However, this isn't much of an improvement in comparison to your code. So the first step would be to use an array instead of individual variables. Consequently all questions will be stored in a set of variables that can be accessed via indices.
rem Create an empty Array that will contain all the questions
dim question(0) as questionType
Arrays are basically just lists. This array is created with 0 elements (actually 1, but let's ignore that for now), so it starts empty. The following code would add a single question to the list of questions stored in that array:
array insert at bottom question()
question(1).question = "What is 2*3?"
question(1).a = "6"
question(1).b = "2"
question(1).c = "4"
question(1).d = "3"
question(1).solution = 1
question(1).solutionString = "6"
But since you want to add more than just one question, you'd end up with a lot of redundant code. That's why writing a function makes sense.
This is the above code utilizing a function:
addQuestion("What is 2*3?", "6", "2", "4", "3", 1, "1")
function addQuestion(q$,a$,b$,c$,d$,solution,solutionString$)
array insert at bottom question() `add one element to the list
ID = array count(question()) `'ID' is the index of the new element (array count() returns the last element's ID, which is what we need since 'array insert at bottom' adds an element to the end of the list)
question(ID).question = q$
question(ID).a = a$
question(ID).b = b$
question(ID).c = c$
question(ID).d = d$
question(ID).solution = solution
question(ID).solutionString = solutionString$
endfunction ID
This way you can add arbitrarily many functions without writing any redundant code.
This whole construct yields the advantage that everything is way easier to handle. Instead of working with a specific question, you can always refer to some question that is defined by an index.
For instance you could write a function 'printQuestion(ID)':
function printQuestion(ID)
center text screen width()/2, 200, question(ID).question
center text screen width()/2-100, 300, question(ID).a
center text screen width()/2+100, 300, question(ID).b
center text screen width()/2-100, 400, question(ID).c
center text screen width()/2+100, 400, question(ID).d
endfunction
And you can use this function for any of your questions instead of writing the code for each question individually.
Consider that you want to change the position to which the question is printed. In your code you'd need to change the position value at many places, whereas in the above implementation you could just change the printQuestion()-function and save a lot of time.
Well, I hope that made things clearer. Otherwise, feel free to ask, but I highly recommend reading a few tutorials on arrays, types, functions etc. (the DBPro help contains some paragraphs as well afaik).