As technology is getting more accessible day by day. Digitization is happening in every sector. With the digitization there arises the demand for new software applications that cater to the needs of the user. One such field is education which has witnessed new approaches to teach students using the Internet and Technology. Online learning is one such approach. Online learning also requires new methods to evaluate student performance. Quiz format tests are easy to evaluate and are perfect to test student’s knowledge. But it requires new software solutions to make it possible. One such solution is Quiz application using Python and MySQL. The application is simple yet powerful. It harnesses the power of data base management system and simplicity of Python language. It provides a graphical user interface to its user and provides data exchange capabilities. The quiz is stored in a widespread data format Json and Responses of quiz can be exported out of application in csv file to be analyzed using other applications too. The capabilities of this application can be expanded very easily. It makes it very maintainable. The application can be customized to the needs of organization easily. As the application uses a MySQL database it also has the potential of becoming a web application as well.
Quiz application is a simple quiz application which takes quiz in digital format. The user has to create an account. Then the user can attempt quiz in the application. The user can also view their result in the quiz application through user dashboard. The result can also be saved into a pdf file. The admin can export all the responses of the quiz into a csv file which enables admin to perform analysis on the data and keep track of the user performances. The user can also reset their password in the user dashboard. It comes with a quiz editor also. Which enables the admin to create, edit and save quiz within the application. The quiz editor offers various key features like setting response limit, scheduling quiz for a particular date and time, setting time limit for the quiz.
The quiz can be divided into multiple sections and multiple questions can be added into any section. The questions are in multiple choice format. The admin can also add points to questions. The admin can set multiple options as answer key. The admin can save quiz in json file which enables the reusability of the data across other applications as well.
The application stores its data in a SQL database which can be hosted on a server and then the application can be turned into an online quiz application without much efforts.
Application Details
Development Environment
Language: Python 3.4
Operating System: Windows 10.
Processor: Intel Pentium.
Architecture: x86
Specifications
Operating System: Windows, Mac and Linux
Processor: Intel Pentium onwards.
Architecture: x86 and x64
RAM: 60 Mb
Project structure
Figure 3 project file structure
- app.py
- user.py
- quiz.py
- quizeditor.py
app.py
app.py contains the Application class. This class provides the user login and signup window. User can create a user or admin account for him/her from signup window. The signup for admin type account requires permission from the admin.
The user/admin can login or exit. If the user/admin logs in successfully he/she is provided with an admin or user menu depending upon the type of account he/she used to login.
The admin menu has three options
- Quiz
- Quiz editor
- User dashboard
The user menu has three options
- Quiz
- User dashboard
quiz.py
quiz.py contains Quiz class which provides the user/admin to attempt the quizzes. It fetches all the available quizzes from the database and provides admin/user a menu of available quiz options. If there is no Quiz available at that moment it displays a message about it.
User/admin can select from the available options and attempt the quiz. It also checks following things before allowing the user to attempt the quiz.
- Response limit
- Date and time
If the above parameters are not satisfied the user is not allowed to attempt the quiz and the message about it is displayed on the right side of the option.
If the above parameters are satisfied it allows the user to attempt the quiz. It displays instructions about the quiz which are auto generated. The user can either accept or decline. If the user accepts response is counted and if the user declines response is not counted. If the quiz has time limit set it starts a timer and automatically submits the response when the time limit is exceeded.
User is provided with multiple choice questions to attempt.
User can either exit or submit from the quiz. In the both scenario response is counted.
quizeditor.py
quizeditor.py contains QuizEditor class which is used to create and edit quizzes. The admin can only edit and save quizzes. The quizzes are added to MySQL database when saved. The QuizEditor has a menu at the top it has two options
- File
- About
File option has
- New
- Open
- Save
- Close
- Exit
New option creates a new quiz.
Open option fetches an already saved quiz from MySQL Database after asking to save any opened or new quiz.
Save option saves the quiz opened or new quiz.
Close option closes any quiz if it’s opened or new quiz after asking to save it.
Exit option exits from the Quiz Editor.
About option opens a window showing information about the Qui Editor
user.py
It contains the User class which stores user/admin details during run time and provide the user/admin dashboard. The user dashboard has two view admin mode and user mode.
User mode view has options to reset password and view previous quiz responses. If there are no responses available it shows a message about it. The user can view their individual response and export them into a file.
Admin mode view has all the capabilities of User mode and admin has the ability to export all the individual quiz responses into a file. Which he/she can then use to analyze the data.
Dependencies
- sqlite3
sqlite3 is a standard python module used for accessing, storing and modifying data in a database from a python application.
- tkinter
tkinter is a standard python module used for creating graphical user interface applications in python. It is available with a standard python installation and is cross-platform i.e compatible with Windows, Mac, and Linux operating systems.
- json
json is a standard python module used to parse and create JSON files.
- matplotlib
matplotlib is a python module used to plot graphs and charts.
- os
Os is a standard python module used to access operating system functions.
- datetime
datetime is a standard python module used to manipulate access date and date related data
-
time
time is a standard python module used to access time and manipulate time related data.
-
fpdf
fpdf is a python module used to create, edit and save pdf files
Database structure
The Quiz.db database consists of three tables
-
quizzes
-
responses
-
users
quizzes table
id | name | path |
---|---|---|
1 | Samplequiz1 | C:/Samplequiz1.json |
2 | Samplequiz2 | C:/Samplequiz2.json |
3 | Samplequiz3 | C:/Samplequiz3.json |
4 | Samplequiz34 | C:/Samplequiz4.json |
responses table
user | quiz | response | response_count |
---|---|---|---|
1 | 23 | response/name1_quiz.json | 1 |
2 | 12 | Response/name2_quiz.json | 2 |
users table
privilege 1 for admin and privilege 0 for user
id | username | password | privilege |
---|---|---|---|
1 | admin | password | 1 |
2 | user1 | password1 | 0 |
3 | user2 | password2 | 0 |
Quiz File
File format JSON file.
Sample File structure.
{
"id": 61,
"test": "sample quiz name\n",
"response_limit": 1,
"date": {
"day": 1,
"month": 8,
"year": 2020
},
"time": {
"hour": 10,
"minute": 30,
"second": 0
},
"time_limit": {
"hour": "1",
"minute": "0",
"second": "0"
},
"sections": [
{
"id": 0,
"section": "sample section name",
"questions": [
{
"id": 0,
"question": "sample question",
"options": [
{
"option": "sample option",
"id": 0,
"key": true
}
],
"type": "single",
"point": 1
}
]
}
],
"instructions": [
{
"instruction": "You have 1 hours"
},
{
"instruction": "There are 1 sections in total"
},
{
"instruction": "In the section sample section name there are 1 questions in total"
}
]
}
Quiz response file
File format JSON file.
Sample File structure.
{
"test": 61,
"response": [
[ 0, 0, [0],1,[0], 1 ]
],
"max_points": 1,
"score": 1,
"correct": 1,
"incorrect": 0,
"no_response": 0
}
Flow chart
Usage
- How to make a user account
- Start the application
- A login window will appear on the screen like below. ![ref1]
- Enter username and password of your choice both should be at least 8 digit long.
- Select the type of account. By default, it is set to User type.
- Click Submit Button.
- A message will appear after successful account creation. ![ref2]
- Press continue button to login.
- How to make Admin Account
- Enter username and password of any administrator account to continue
- Click submit button.
- A message will appear after successful account creation. ![ref2]
- How to login
- Start the application
- A login window will appear on the screen like below. ![ref3]
Figure 11 quiz login username and password
- How to start a quiz
- Click on the quiz you want to attempt.
- If you have exceeded response limit of quiz a message will appear
- Click Accept to start the quiz
- Click Decline to quit the quiz but response won’t be counted
- How to attempt a quiz
- Name of quiz
- Time limit of quiz
- Name of section in the quiz
- Question and options
- Back button to go to previous question in section in quiz
- Next button to go to next question in section in quiz
- Previous section button to go to previous section in quiz
- Next section button to go to next section in quiz
- Submit button to submit the response.
- Exit button to exit the quiz.
- Jump to any question of any section by clicking the question number.
- How to reset password
- From user menu or quiz menu select user dashboard option.
- A user or admin dashboard will appear. ![ref4]
Figure 21 user or admin dashboard
- How to View Quiz result
- From user menu or quiz menu select user dashboard option.
- A user or admin or user dashboard will appear. ![ref4]
Figure 25 admin or user dashboard
Figure 26 no response dashboard
Figure 27 quiz response available
- How to save the quiz result
Figure 29 save quiz result dialog
Figure 30 quiz result save message
- If there are any errors occur whiling saving result a message will appear.
- The Result will be saved in a PDF file.
- How to export all the responses of a quiz
Figure 31 export all quiz response
Figure 32 all quiz response exported successfully
- How to create a quiz.
- Requires admin account.
- Click quiz editor option from admin menu.
- Press Ctrl + N or ![ref5]
- Click File option from menu. ![ref6]
- How to open saved quiz.
- Requires admin account
- Press Ctrl + O or
- Click File option from menu in quiz editor ![ref7]
Figure 38 quiz editor file menu
- Open window will appear like this if there are no quizzes saved already message will appear like this
- Click the quiz you want to open.
- How to save quiz
- Requires admin account
- Press Ctrl + S or
- Click File option from menu in quiz editor. ![ref7]
- How to remove quiz
- How to close quiz
- Requires admin account
- Press Ctrl + C or
- Click File option from menu in quiz editor. ![ref7]
- Enter quiz name here
- Enter section name here.
- Enter question here.
- Enter option here
- Click to Add Section
- Click to Add Question
- Click to Add Option
- Schedule date of quiz by checking.
- Scheduling time of quiz by checking.
- Set time limit by checking.
- Set response limit. NOTE 0 is default value meaning unlimited response.
- Click to Remove section
- Click to Remove question
- Click to remove option
- Set points of question by checking.
- Set the option as answer key by checking.
- How to exit quiz editor
- Requires admin account
- Press Ctrl + Q or
- If any quiz is opened it ask to save it.
- Then it will come back to user or admin menu
- How to view Quiz editor version
- Requires admin account
- Click About option from menu in quiz editor. ![ref7]
- A window will appear showing version of quiz editor
Quiz database
Quiz.db
users table
- CREATE TABLE "users" (
- )
responses table
- CREATE TABLE "responses" (
- )
quizzes table
- CREATE TABLE "quizzes" (
- )