473,770 Members | 4,544 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to create Java based quiz system? need ideas

3 New Member
Hello everyone,

One of my course works is to implement a java based quiz system. the program consists of two modules one for the teacher to create, set questions , answers and the number of questions to be published, and the other one is to allow the student to run the quiz. the data for the quiz is stored in text files and the correct answers are encrypted. everytime the students take a quiz the result has to be stored and a report containing the number of questions were answered correctly and the number of questions were answered incorrectly to be included for the teacher to view later.

Would really appreciate some suggestions regarding the following questions.

1. I am not entirly sure what data structure to use in order to link each question with the right answer?

2. Whether to store the correct answers in a seperate file or in the same file as the questions and their associated answers?

3. How to Structure the database file?

Thanks for all your replys in advance.
Nov 20 '07 #1
5 7214
chaarmann
785 Recognized Expert Contributor
Hello everyone,

One of my course works is to implement a java based quiz system. the program consists of two modules one for the teacher to create, set questions , answers and the number of questions to be published, and the other one is to allow the student to run the quiz. the data for the quiz is stored in text files and the correct answers are encrypted. everytime the students take a quiz the result has to be stored and a report containing the number of questions were answered correctly and the number of questions were answered incorrectly to be included for the teacher to view later.

Would really appreciate some suggestions regarding the following questions.

1. I am not entirly sure what data structure to use in order to link each question with the right answer?

2. Whether to store the correct answers in a seperate file or in the same file as the questions and their associated answers?

3. How to Structure the database file?

Thanks for all your replys in advance.
1.) you can use a Vector.
Expand|Select|Wrap|Line Numbers
  1. Vector answers = new Vector();
  2. Vector questions= new Vector();
  3. questions.add("question1");
  4. answers.add("answer1");
  5. questions.add("question2");
  6. answers.add("answer2");
  7. questions.add("question3");
  8. answers.add("answer3");
  9. ...
  10. System.out.println("The first answer is: " + answers .elementAt(0));
  11. System.out.println("The second question is: " + questions.elementAt(1));
You could also try with Properties:
Expand|Select|Wrap|Line Numbers
  1. Properties questionsAndAnswers = new Properties();
  2. questionsAndAnswers.setProperty("question1", "answer1");
  3. questionsAndAnswers.setProperty("question2", "answer2");
  4. questionsAndAnswers.setProperty("question3", "answer3");
  5. ...
  6. System.out.println("The first answer is: " + questionsAndAnswers.getProperty("question1"));
or you can use string-arrays:
Expand|Select|Wrap|Line Numbers
  1. String [][] questionsAndAnswers = {{"question1", "answer1"}, {"question2", "answer2"}, {"question3", "answer3"}};
  2. System.out.println("The first answer is: " + questionsAndAnswers[0][1]);
2.) store them in a separate file. One file for the original question and answer. And one file for each student for all the answers a student has given.
If you mix all data in one file, you will have problems if you want to modify/delete some data later on.

3.) Use XML. Then here is already a java-method that you can use to read and save all the data for you. (read about SAX and DOM). XML is industrial standard. A lot of programs can read it or create it and so you can use the data for everything. You can display the file directly into your browser, convert it to a table for a database, edit it comfortably etc.
For example:
...
Expand|Select|Wrap|Line Numbers
  1. <student>
  2. <name>newbie</name>
  3. <answerList>
  4.     <answer>answer1</answer>
  5.     <answer>answer2</answer>
  6.     <answer>answer3</answer>
  7. </answerList>
  8. </student>
4.) Now I have a question:
It's not quite clear why you post this question in this forum if this task was given by a teacher for your programming course. If others solve it for you, then you don't learn. I hope the answers gave to you are getting you started. But try yourself as much as you can. Next time, post some code from your own tries where you got stuck. Have you tried already or just copied the task onto the forum without trying or thinking/reading yourself?
Nov 20 '07 #2
r035198x
13,262 MVP
...

3. How to Structure the database file?

...
What database file?

1.) you can use a Vector.
Vectors are not the right approach here. Besides they being old, they do not store a mapping relationship. A Map is much better.
Nov 20 '07 #3
JosAH
11,448 Recognized Expert MVP
Are those questions multiple choice questions (easy) or are they supposed to
be 'open end' questions (very difficult)?

kind regards,

Jos
Nov 20 '07 #4
pefok
3 New Member
Thanks for all your replys .

By the database i mean the test files one of which holds the quizzes and one of which is holds the correct answers and has to be encrypted.

The questions are multi-choice with four answers to each question and one correct answer.

I am kinda thinking towards array list , What do you think?

Many thanks
Nov 27 '07 #5
pefok
3 New Member
1.) you can use a Vector.
Expand|Select|Wrap|Line Numbers
  1. Vector answers = new Vector();
  2. Vector questions= new Vector();
  3. questions.add("question1");
  4. answers.add("answer1");
  5. questions.add("question2");
  6. answers.add("answer2");
  7. questions.add("question3");
  8. answers.add("answer3");
  9. ...
  10. System.out.println("The first answer is: " + answers .elementAt(0));
  11. System.out.println("The second question is: " + questions.elementAt(1));
You could also try with Properties:
Expand|Select|Wrap|Line Numbers
  1. Properties questionsAndAnswers = new Properties();
  2. questionsAndAnswers.setProperty("question1", "answer1");
  3. questionsAndAnswers.setProperty("question2", "answer2");
  4. questionsAndAnswers.setProperty("question3", "answer3");
  5. ...
  6. System.out.println("The first answer is: " + questionsAndAnswers.getProperty("question1"));
or you can use string-arrays:
Expand|Select|Wrap|Line Numbers
  1. String [][] questionsAndAnswers = {{"question1", "answer1"}, {"question2", "answer2"}, {"question3", "answer3"}};
  2. System.out.println("The first answer is: " + questionsAndAnswers[0][1]);
2.) store them in a separate file. One file for the original question and answer. And one file for each student for all the answers a student has given.
If you mix all data in one file, you will have problems if you want to modify/delete some data later on.

3.) Use XML. Then here is already a java-method that you can use to read and save all the data for you. (read about SAX and DOM). XML is industrial standard. A lot of programs can read it or create it and so you can use the data for everything. You can display the file directly into your browser, convert it to a table for a database, edit it comfortably etc.
For example:
...
Expand|Select|Wrap|Line Numbers
  1. <student>
  2. <name>newbie</name>
  3. <answerList>
  4.     <answer>answer1</answer>
  5.     <answer>answer2</answer>
  6.     <answer>answer3</answer>
  7. </answerList>
  8. </student>
4.) Now I have a question:
It's not quite clear why you post this question in this forum if this task was given by a teacher for your programming course. If others solve it for you, then you don't learn. I hope the answers gave to you are getting you started. But try yourself as much as you can. Next time, post some code from your own tries where you got stuck. Have you tried already or just copied the task onto the forum without trying or thinking/reading yourself?




Thanks alot for your suggestions chaarmann,

I have been trying but I would like to use the best suited data structure before submitting it , I have been thinking about using XML but not allowed to do so , I have been trying with array list and it looks promising , I agree with what you are saying trying and learning from it.
Nov 27 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

0
2392
by: Todd Cary | last post by:
I would like to have an Open Source HTML editor on a Web site so the user can create HTML based text. Google brings up too many matches when I type in "Browser HTML editor Java Open Source" that do not match my needs. Does anyone have a suggestion? Todd
7
2172
by: Spammay Blockay | last post by:
Does anybody know of a solid Java-based email list management product? - Tim --
10
3204
by: Hung Jung Lu | last post by:
Hi, Does anyone know whether there is any generic GUI-based build system around? (Python-based would be great. Also, for now I am only looking for Windows OS.) By "build system" I mean something similar the "make/makefile" system, but somewhat more generic/powerful/flexible/higher-level/etc, so that if you have a sequence (maybe even some simple conditional branches and loops) of system tasks to perform, you can more easily visualize...
0
889
by: Liddle Feesh | last post by:
Good afternoon m.p.d.l.vb :) I'm looking for some sound system design ideas. I'm planning to build an application in VB.NET that interfaces with MSDE for a local estate agency (realtor in the US!). I have about one month to create this application. Has anyone created a client-server application interfacing images as BLOBS to an MSDE database before? I have previously done this with VB6 - and it
0
1313
by: Soung | last post by:
I'm trying to create a simple test application that can talk with the Java based web service. The problem is everytime I execute my client application it comes back with an error message saying "Authentication Failure". I did check the packets and it actually send out the message and server responds back with the failure message. My code looks like proxyobj.Credentials = new NetworkCredential("id", "password");...
5
2045
by: SeanCly10 | last post by:
Hi all. I don't want to sound like a complete idiot here, but I'm somewhat limited in my coding knowledge, and I need some advice and help. I'm working on a database that will eventually be used to hold patient information for research purposes. What I'm trying to do is create a form-based query system that will be easier (and less dangerous) for my future users to use to search the patient information. Let me outline the specifics,...
3
4405
by: Raqueeb Hassan | last post by:
Hello, I was helping one of my friend's school on setting up a online quiz system. They have the AMP systems to host php+mysql. The quiz script/software should have the following features: a. Excellent results screen (customizable) which can be printed right away. b. 3/5 simultaneously run quizes along with a authentication system. c. Should be able to handle MCQs (multiple choice questions) along with
0
2025
by: itsraghz | last post by:
Hello people, My present project need is to have an Open Source Java based reporting tool, which would allow the users to customize the fields to be chosen at runtime. The chosen fields are used to build a dynamic SQL query and the subsequent results will be used to fill the report for the chosen columns. The application being used in WebSphere Portals. Though my search in google for the same gave many tools like JasperReports,...
4
2296
by: santosh.tripathy | last post by:
We have a requirement where in a java based web application is getting integrated with the existing .net based web pages. The .net based web pages are secured through forms authentication. Is there any mechanism where we can extend the same form based authentication to java based web pages?
0
9591
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10228
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10057
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10002
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7415
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6676
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5449
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3970
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2816
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.