Solved

getting external data...

Posted on 2006-11-08
4
163 Views
Last Modified: 2010-08-05
I'm working on something - just started on it - that I hope to be able to use for displaying quiz questions.

Currently, I have a form with a label and a radio button.  I'm thinking of just creating a text file with the questions and answers, so I can interchange these and run different quizzes based upon the file supplied.

I foresee a couple of snags though, so I thought I'd get some guidance here... :^)

First of all, I have a single label for the question, but some of my questions are in the form of
This is the scenario
  > This has been done
  > This has been done
  > This has been done
What comes next?

So, I'm not sure that I can accomplish this correctly with a simple text file and still have the question laid out with the bulleted list properly...any suggestions on that?

Secondly, some questions will have multiple answers - and some will have more selections than others.  Most will default to four (A-D), but some may offer as much as 5 or 6 options.  So, I was thinking of just having the one radio button, and just create a new control dynamically for each one I need.

Then in my text file, I would list the correct answer along with the question.  My text file is something like this:

Q:  This is the question (1) '--> meaning element 1, in this case Option2, is the correct answer
A:  Option1 (or element 0)
A:  Option2
A:  Option3
[etc]
E:  This would be the explanation, if there is one

Then the text would just loop over and over.  I'm just not certain this is the right direction to take this project though - any words of advice?  Presumably I could just have (13) for the 'answers' if there are multiple, but does that have other potential problems?
0
Comment
Question by:sirbounty
  • 2
  • 2
4 Comments
 
LVL 48

Accepted Solution

by:
AlexFM earned 500 total points
ID: 17897748
I think that XML format is the way to keep such information. Typical question can look like this:

<Question Type="SingleSelection" Answer="3" Text="5 + 10 = ?">
    <Choice>100</Choice>
    <Choice>0</Choice>
    <Choice>15</Choice>
</Question>

Maybe there are questions with multiple answers, questions with "Other" answers requiring free text reply etc. XML format looks flexible enough to build such model. Except of this, possibly questions can be kept in some hierarchy, like:

<General questions>
    <Part 1>
      <Question> ... </Question>
      <Question> ... </Question>
    </Part 1>
    <Part 2>
      <Question> ... </Question>
      <Question> ... </Question>
    </Part 2>
</General questions>
<Bonus>
    <Question> ... </Question>
    <Question> ... </Question>
</Bonus>

This can be done only in XML file. Maybe you don't think about too complicated structure, but text file in any case looks like simplified solution.
Top level structure can be shown as tree. Selecting specific question shows it in details. For each question type you can have set of controls, for example:
Single selection - group of radio buttons.
Multiple selection - check boxes.
Textbox for free text.
etc.
0
 
LVL 67

Author Comment

by:sirbounty
ID: 17898910
Hmm - maybe this is going to be more difficult than I imagined...

Here, you're suggesting that the backend files that are read, are in xml format?
0
 
LVL 48

Expert Comment

by:AlexFM
ID: 17900716
Yes. BTW, you can define XML schema for such files, which improves file validation - file which doesn't match schema, throws exception when programs tries to open it.
However, if you want to implement simplest case, text file is OK. I just tried to imagine possible cases for this task.
0
 
LVL 67

Author Comment

by:sirbounty
ID: 17905742
I decided to go with a database backend (MS Access) - I'm a bit more familiar and I need the practice...
I may have to ask another question on it later though.  Thanx for the help.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now