0% found this document useful (0 votes)
26 views

Sample

Uploaded by

1st year CSE
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views

Sample

Uploaded by

1st year CSE
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 33

QUIZ APPLICATION USING JAVA

Final Project Report of


Project – II

SUBMITTED IN PARTIAL FULFILLMENT OF THE REQUIREMENTS


FOR THE AWARD OF

BACHELOR OF TECHNOLOGY
(Computer Engineering)

SUBMITTED TO

MAHARSHI DAYANAND UNIVERSITY, ROHTAK

SUBMITTED BY

Name of Student University Roll No.


Ananya 5064514

Under The Supervision Of


Mrs. Meenakshi Chawla

DEPARTMENT OF COMPUTER ENGINEERING,

TIT&S, BHIWANI (HARYANA) - 127021


Vision and Mission of Institute

VISION
To become excellent knowledge enterprise.

MISSION
Creation of centre of excellence for learning and research in engineering & technology.

Vision and Mission of Department

VISION
To produce professionally excellent, knowledgeable, globally competitive and socially
responsible computer engineers and entrepreneurs.

MISSION

 To provide quality education to students of computer engineering.


 To establish an industry – Institute interaction, participation, collaboration to various
job- oriented skills for computer engineering.
 To build human values, social values entrepreneurship skills and professional ethics among the
IT technocrats.
 To focus on innovative and latest development of technologies by engaging in various research
areas.
Declaration

I the undersigned solemnly declare that the project report Quiz Application using Java is based on my
own work carried out during our study under the supervision of Mrs. Meenakshi Chawla. I assert that the
statements made and conclusions drawn are an outcome of my Project work. I further certify that the
work contained in the report is original and has been done by our group under the general supervision of
my supervisor. The work has not been submitted to any other Institution for any other degree/diploma/
certificate in this university or any other University of India or abroad. We have followed the guidelines
provided by the university in writing the report. Whenever we have used materials (data, theoretical
analysis, and text) from other sources, we have given due credit other in the text of the report and giving
their details in the references.

Student’s Signature
ANANYA (20CE121)

i
Certificate

I hereby declare that the work presented in this report entitled “Quiz Application using Java” in
partial fulfillment of the requirements for the award of the degree of Bachelor of Technology in
Computer Engineering submitted in the department of Computer Engineering and Information
Technology, The Technological Institute of Textile & Sciences is an authentic record of my
own work carried out over a period from July 2023 to December 2023 under the supervision of
Mrs. Meenakshi Chawla.

Signature of Student
Ananya (20CE121)

Examined by:

Mrs. Meenakshi Chawla


(Assistant Professor)
Department of Computer Engineering
The Technological Institute of Textile & Sciences, Bhiwani

Dr. Jyoti Choudhary


(Assistant Professor)
(Head of Department)
Department of Computer Engineering
The Technological Institute of Textile & Sciences, Bhiwani

ii
ACKNOWLEDGEMENT

I would like to express my sincere gratitude to our H.O.D. Dr. Jyoti Chaudhary,
Department of Computer Engineering, whose role as project guide was
invaluable for the project. I am extremely thankful for the keen interest she took
in advising me, for the books and reference materials provided and for the moral
support extended to me.

I am also indebted to our entire faculty of CE Department at TIT&S from where


I have learnt all the concepts which helped me a lot in completion of this project.

Also, I have a feel of immense gratitude towards my family, their moral boosting
and encouragement is a boon for me.

Student Name :

(Ananya)
Roll No.: 20CE121

B.Tech (CE) TIT&S, BHIWANI

iii
ABOUT PROJECT

The quiz application project is a dynamic and engaging platform designed to test and enhance
users' knowledge on various topics. Built with a user-friendly interface, the application
provides a seamless experience for participants to navigate through a diverse range of quizzes,
spanning subjects such as science, history, pop culture, and more. Users can choose quizzes
based on their interests and skill levels, making the platform suitable for both casual learners
and those seeking a more challenging experience.

The application incorporates features like real-time scoring, instant feedback on answers, and
a leaderboard to foster a sense of competition and motivation among users. Additionally, the
project leverages technologies such as responsive design to ensure accessibility across
different devices, creating a flexible and inclusive learning environment. The quiz application
aims not only to entertain but also to educate, serving as a valuable tool for individuals
looking to expand their knowledge in a fun and interactive way. Whether used for self-
assessment or friendly competition, the quiz application project provides a versatile and
engaging platform for continuous learning.

iv
TABLE OF CONTENTS

S. Topic Page No.


No.
Declaration i
Certificate ii
Acknowledgement iii
About Project iv

1 Chapter 1: Introduction 1
2 Chapter 2: Literature Review and 2-4
technology used
3 Chapter 3: Project Work 5-6
3.1 Objectives 5
3.2 DFD 5
3.3 H/W and S/W used 6
4 Chapter 4: Result and Discussion 7-21
4.1 Code 7
4.2 Screenshot 20
5 Chapter 5: Conclusion and 23-24
Future Scope
Chapter 1: Introduction

This “Quiz application” in Java is a software program designed to facilitate interactive quizzes or
assessments, typically for educational, training, or entertainment purposes. This application allows
users to answer a series of questions, and receive their scores or performance summaries at the end.
This application can commonly be used in schools, online learning platforms, and various other
contexts where knowledge assessment is required
This quiz application includes:
1. User Interface (UI):
 The user interface is an essential component of any quiz application. It provides the
interaction point between the user and the quiz questions. The UI includes:
 A welcome screen with instructions and a start button.
 Question presentation with options
 Navigation controls (next, previous, submit).
 A timer (to impose time limits).
 A score display.

2. Questions and Answers:


 A structured way to store questions, answer options, and correct answers is needed.
This can be done using data structures like arrays, lists, or databases.
 Each question is having a unique identifier, the question text, options, and the correct
answer.

3. Logic and Business Rules:


 Implementing the logic for presenting questions one by one and tracking user
responses.
 Checking user answers against the correct answers to calculate the score.
 Implementing rules for skipping questions, going back, or finishing the quiz early.

4. Timer Functionality:
 The quiz has a time limit for each question for which the timer functionality is
implemented.
 Java's Timer or TimerTask classes can be used to manage time constraints.

5. Scoring and Results:


 Calculating the user's score based on their responses and display it at the end of the
quiz.

6. User Experience (UX):


 Ensuring that the application is user-friendly, with clear instructions and intuitive
navigation.
 Testing the application to identify and fix any bugs or issues.

7. Testing and Quality Assurance:


 Thoroughly testing the application to ensure it works correctly in various scenarios
and on different devices and browsers.

8. Deployment:
 The application is now ready for its execution.

1
Chapter 2: Literature Review and Technology Used

A literature review on quiz applications reveals a growing body of research focused on the
intersection of technology and education. Studies emphasize the potential of quiz applications to
enhance learning outcomes and engagement. Research by Hwang and Wu (2014) discusses the
benefits of mobile-assisted language learning through quiz applications, highlighting the positive
impact on vocabulary acquisition and language proficiency. This underscores the versatile
applications of quiz platforms beyond traditional subject areas.

Additionally, investigations into gamified learning platforms, such as quiz applications, have
demonstrated their ability to foster intrinsic motivation and active participation among learners.
Incorporating elements of gamification, such as points, badges, and leaderboards, has been found to
positively influence user engagement and knowledge retention. These findings suggest that quiz
applications have the potential to not only assess knowledge but also serve as effective tools for
promoting a playful and motivational learning environment.

Furthermore, the literature highlights the importance of adaptive learning features in quiz
applications. Research by Shute and Kim (2014) emphasizes the value of personalized feedback and
adaptive content delivery to cater to individual learning styles and preferences. This customization
enhances the effectiveness of quiz applications as educational tools, ensuring that users receive
targeted support and challenges based on their unique needs. Overall, the literature supports the
notion that quiz applications, when thoughtfully designed and aligned with pedagogical principles,
can play a significant role in modern educational strategies, providing engaging and effective
learning experiences.

-Core Java

Core Java refers to the fundamental and foundational components of the Java programming
language. It encompasses the basic features, libraries, and syntax that every Java developer should
be familiar with before delving into more advanced topics or specialized areas of Java
development. Core Java provides the essential building blocks for developing a wide range of
applications, from simple command-line tools to complex enterprise-level systems.

Core Java serves as a strong foundation for various application domains, including web
development (Java EE), mobile development (Java ME), and big data (Hadoop). It is often the
starting point for Java developers, providing them with the essential skills and knowledge needed
to create reliable, platform-independent, and scalable Java applications. Two main requirements
from core java for the development of this quiz application are:

1) Java Swing
Java Swing is a powerful and versatile GUI (Graphical User Interface) toolkit that is part of the
Java Standard Library. It allows Java developers to create rich, interactive, and platform-
independent desktop applications with a modern and consistent look and feel. Swing is an
integral part of Core Java and is often used for building applications ranging from simple
desktop utilities to complex enterprise software.

Some of the main types of Swing components are:


1. Containers:
 Containers are components that can contain other components. They provide the
structure for organizing and arranging other GUI elements. Common container
classes include:
2
 JFrame: A top-level window for creating the main application window.
 JPanel: A generic container that can be used for grouping and
organizingother components.
 JDialog: A dialog box for displaying messages or requesting user input.
2. Basic Controls:
 These components are fundamental for user interaction and data input.
Examples include:
 JButton: A button that triggers actions when clicked.
 JTextField: A single-line text input field.
 JTextArea: A multi-line text input area.
 JCheckBox and JRadioButton: Components for selecting options.
 JComboBox: A drop-down list for selecting from a list of items.
3. Text Components:
 These components are used for displaying and manipulating text and
documents. Examples include:
 JTextPane and JEditorPane: Rich text components that support
formattedtext and HTML.
 JPasswordField: A field for securely entering passwords.
4. Containers for Layout:
 These specialized containers help with arranging components in a specific
layout. Common layout managers include:
 FlowLayout: Arranges components in a row or column.
 BorderLayout: Divides the container into five regions (north,
south, east,west, and center).
 GridLayout: Organizes components in a grid of rows and columns.
 GridBagLayout: Provides precise control over component
placement using constraints.
5. Lists and Tables:
 Swing provides components for displaying lists and tables of data.
 JList: A component for displaying a list of items.
 JTable: A component for displaying tabular data.
6. Trees:
 JTree is used for displaying hierarchical data structures, such as directory
trees ororganizational charts.
7. Menu Components:
 Swing supports the creation of menu bars, menus, and menu items for
building menu-driven user interfaces.
 JMenuBar: A container for menus.
 JMenu: A menu within a menu bar.
 JMenuItem: An item within a menu.
8. Dialogs and Popups:
 Swing allows the creation of various dialog boxes and pop-up windows
for interacting with users.
 JOptionPane: Provides standard dialog boxes for messages,
input, andoptions.
 JFileChooser: A file chooser dialog for selecting files and directories.
9. Graphics and Custom Components:
 Developers can create custom graphical components by subclassing Swing
classes or using the JComponent class. This enables the creation of custom
charts, diagrams, and visual element.

3
2) AWT
Java AWT, or Abstract Window Toolkit, is one of the original GUI (Graphical User
Interface) libraries provided by Java for creating platform-independent graphical user
interfaces for desktop applications. AWT was introduced with the first version of Java
and serves as the foundation for other GUI libraries like Swing and JavaFX.

Here are the main types of Java AWT components:


1. Containers:
 Containers are components that can contain other components. They provide
the structure for organizing and arranging other GUI elements.
2. Basic Controls:
 These components are fundamental for user interaction and data input.
3. Layout Managers:
 Layout managers help with arranging components within containers. AWT
provides several layout managers.
4. Menus and Menu Components:
 AWT supports the creation of menu-driven user interfaces with classes like
Menu, MenuBar, MenuItem, and PopupMenu. These components are
essential for building menu bars and context menus.
5. Dialog Boxes:
 AWT allows the creation of dialog boxes for displaying messages, accepting
user input, and providing options. The Dialog class is used for this purpose.
6. Event Handling Components:
 Components for handling user input events, such as mouse and keyboard
events. Event listeners are registered with these components to respond to user
interactions.
7. Graphics and Custom Components:
 Developers can create custom graphical components by subclassing AWT
classes or using the Canvas class for drawing custom graphics.
8. Scrollbars and Scroll Panes:
 AWT provides Scrollbar components for scrolling content within a container.
ScrollPane can be used to create scrollable areas for other components.
9. Images and Icons:
 AWT includes classes for loading, displaying, and manipulating images. The
Image and ImageIcon classes are commonly used for working with images.
10. Component Events:
 AWT allows components to generate and handle events. Common event
listeners include ActionListener, MouseListener, and KeyListener.

-Visual Studio Code

Visual Studio Code (VS Code) is a popular, free, and open-source code editor developed by Microsoft.
It has gained widespread popularity among developers due to its versatility, rich set of features, and
extensive extension marketplace. Its combination of a lightweight design, extensibility, and robust
features has made it a top choice for many developers across different domains. Some key aspects and
features of Visual Studio Code are that it is cross platform, open source, comes with integrated
debugging, intelligent code editing, customizable interface, integrated terminal and IDE features.

4
Chapter 3: Project Work

3.1 Objectives
The objectives of a quiz application can vary depending on the target audience, educational
context, and specific goals of the developers. However, common objectives for a quiz
application typically include:
1. Knowledge Assessment:
 Objective: To provide a platform for users to assess their knowledge on various
topics.
 Rationale: The primary purpose of a quiz application is to evaluate users'
understanding of specific subjects or general knowledge. This objective is
fundamental for both educational and recreational quiz applications.
2. Engagement and Interactivity:
 Objective: To engage users in an interactive and dynamic learning experience.
 Rationale: The application should aim to captivate users' attention, making the
learning process enjoyable and encouraging active participation. Interactive
features, such as timed questions, multimedia content, and gamified elements,
contribute to increased engagement.
3. Learning Reinforcement:
 Objective: To reinforce learning through instant feedback and explanations.
 Rationale: Providing immediate feedback on users' responses helps in
reinforcing correct information and correcting misconceptions. This objective
aligns with educational principles that emphasize the importance of timely
reinforcement for effective learning.
4. Competition and Social Interaction:
 Objective: To foster a sense of competition and social interaction among users.
 Rationale: Including features such as leaderboards, achievements, and the ability
to challenge friends creates a competitive yet collaborative environment. Social
elements contribute to increased user motivation and a sense of community.
5. Accessibility and User-Friendliness:
 Objective: To ensure the application is accessible across various devices and
user-friendly.
 Rationale: A well-designed and accessible interface promotes ease of use,
making the application inclusive for a diverse user base. Compatibility with
different devices and platforms enhances the reach and usability of the quiz
application.

3.2 Data Flow Diagram(DFD)

A comprehensive Data Flow Diagram (DFD) for a quiz application involves illustrating the flow of
data within the system. Below is a simplified representation, incorporating major components and
interactions.
1. Processes:
 User Registration/Login: The process of user registration and login involves the creation
of user accounts or authentication of existing users.
 Quiz Creation: This process allows quiz creators to generate new quizzes, including
questions, options, and correct answers.
 Quiz Taking: Users engage in taking quizzes, answering questions, and submitting
responses.

5
 Scoring and Feedback: The system evaluates user responses, calculates scores, and
provides feedback on correct and incorrect answers.
 Result Generation: After completing a quiz, the system generates and displays results,
including scores and performance summaries.
2. Data Stores:
 User Database: Stores user account information, including usernames, passwords, and
other relevant details.
 Quiz Database: Contains data on quizzes, including questions, answer options, correct
answers, and metadata.
 Result Database: Stores user quiz results, including scores, completion time, and
performance details.
3. Data Flows:
 User Registration/Login Data Flow: User details flow from the user interface to the User
Database during registration/login processes.
 Quiz Creation Data Flow: Quiz content, including questions and answers, is stored in the
Quiz Database.
 Quiz Taking Data Flow: User responses flow from the user interface to the system for
evaluation.
 Scoring and Feedback Data Flow: Results, including scores and feedback, are
communicated back to the user interface.
 Result Generation Data Flow: Quiz results are stored in the Result Database for later
retrieval and analysis.

3.3 Hardware and software required

3.3.1 Hardware Requirements:

1. Server:
 Processor: Multi-core processor (e.g., Intel Xeon, AMD Ryzen)
 RAM: 8GB or higher
 Storage: 50GB or more
2. Database Server:
 DBMS: (e.g., MySQL, PostgreSQL)
 RAM: 4GB or more
3. Networking:
 Internet Connection: High-speed connection
4. Client Devices:
 Desktops, Laptops, Tablets, and Smartphones: Standard configurations

3.3.2 Software Requirements:

1. Server-Side:
 Operating System: Linux (e.g., Ubuntu) or Windows Server
 Java: JDK 8 or later
 Web Server: (e.g., Apache Tomcat, Jetty)
2. Database:
 Connector: JDBC Driver
3. Development Tools:
 IDE: (e.g., IntelliJ IDEA, Eclipse, VS Code)

6
Chapter 4: Result and Discussion

4.1 Java Code

Login.java file
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Login extends JFrame implements ActionListener{

JButton rules,back;
JTextField tfname;
Login(){
getContentPane().setBackground(Color.WHITE);
setLayout(null);
ImageIcon i1 = new ImageIcon(ClassLoader.getSystemResource("login.jpeg"));
JLabel image = new JLabel(i1);
image.setBounds(0,0,600,500);
add(image);

JLabel heading = new JLabel("Simple Minds");


heading.setBounds(750,60,300,45);
heading.setFont(new Font("Viner Hand ITC",Font.BOLD,40));
heading.setForeground(new Color(30,144,254));
add(heading);

JLabel name = new JLabel("Enter your name");


name.setBounds(800,150,300,20);
name.setFont(new Font("Mongolian Baiti",Font.BOLD,18));
name.setForeground(new Color(30,144,254));
add(name);

tfname = new JTextField();


tfname.setBounds(735,200,300,25);
tfname .setFont(new Font("Times New Roman",Font.BOLD,20));
add(tfname);

7
rules = new JButton("Rules");
rules.setBounds(735,270,120,25);
rules.setBackground(Color.BLUE);
rules.setForeground(Color.BLUE);
rules.setFont(new Font("Times New Roman",Font.BOLD,14));
rules.addActionListener(this);
add(rules);

back = new JButton("Back");


back.setBounds(915,270,120,25);
back.setBackground(Color.BLUE);
back.setForeground(Color.BLUE);
back.setFont(new Font("Times New Roman",Font.BOLD,14));
back.addActionListener(this);
add(back);

setSize(1200,500);
setLocation(150, 200);
setVisible(true);
}
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource() == rules)
{
String name = tfname.getText();
setVisible(false);
new Rules(name);
}
else if(ae.getSource() == back)
{
setVisible(false);
}
}
public static void main(String args[])
8
{
new Login();
}
}

Rules.java file
import javax.swing.*;
import java.awt.*;
public class Rules extends JFrame{
String name;
Rules(String name){
this.name = name;
getContentPane().setBackground(Color.WHITE);
setLayout(null);

JLabel heading = new JLabel("Welcome "+ name + " to Simple Minds");


heading.setBounds(50,20,700,30);
heading.setFont(new Font("Times New Roman",Font.BOLD,28));
heading.setForeground(new Color(30,144,254));
add(heading);

JLabel rules = new JLabel();


rules.setBounds(20,40,700,350);
rules.setFont(new Font("Tahoma",Font.PLAIN,16));
rules.setText(
"<html>"+ "1. You are trained to be a programmer so answer point to point"+"<br><br>"+
"2. No Cheating "+"<br><br>"+
"3. No Refernces"+"<br><br>"+
"4. Here,All questions are compulsory"+"<br><br>"+
"4. Good Luck"+"<br><br>"+"<html>"
);
add(rules);

setSize(800,650);
setLocation(350,100);
setVisible(true);
9
}
public static void main(String args[])
{
new Rules("User");
}
}

Quiz.java file
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class Quiz extends JFrame implements ActionListener {

String questions[][] = new String[10][5];


String answers[][] = new String[10][2];
String useranswers[][] = new String[10][1];
JLabel qno, question;
JRadioButton opt1, opt2, opt3, opt4;
ButtonGroup groupoptions;
JButton next, submit, lifeline;

public static int timer = 15;


public static int ans_given = 0;
public static int count = 0;
public static int score = 0;

String name;

Quiz(String name) {
this.name = name;
setBounds(50, 0, 1440, 850);
getContentPane().setBackground(Color.WHITE);
setLayout(null);

ImageIcon i1 = new ImageIcon(ClassLoader.getSystemResource("icons/quiz.jpg"));


10
JLabel image = new JLabel(i1);
image.setBounds(0, 0, 1440, 392);
add(image);

qno = new JLabel();


qno.setBounds(100, 450, 50, 30);
qno.setFont(new Font("Tahoma", Font.PLAIN, 24));
add(qno);

question = new JLabel();


question.setBounds(150, 450, 900, 30);
question.setFont(new Font("Tahoma", Font.PLAIN, 24));
add(question);

questions[0][0] = "Which is used to find and fix bugs in the Java programs.?";
questions[0][1] = "JVM";
questions[0][2] = "JDB";
questions[0][3] = "JDK";
questions[0][4] = "JRE";

questions[1][0] = "What is the return type of the hashCode() method in the Object class?";
questions[1][1] = "int";
questions[1][2] = "Object";
questions[1][3] = "long";
questions[1][4] = "void";

questions[2][0] = "Which package contains the Random class?";


questions[2][1] = "java.util package";
questions[2][2] = "java.lang package";
questions[2][3] = "java.awt package";
questions[2][4] = "java.io package";

questions[3][0] = "An interface with no fields or methods is known as?";


questions[3][1] = "Runnable Interface";
questions[3][2] = "Abstract Interface";
questions[3][3] = "Marker Interface";
11
questions[3][4] = "CharSequence Interface";

questions[4][0] = "In which memory a String is stored, when we create a string using new
operator?";
questions[4][1] = "Stack";
questions[4][2] = "String memory";
questions[4][3] = "Random storage space";
questions[4][4] = "Heap memory";

questions[5][0] = "Which of the following is a marker interface?";


questions[5][1] = "Runnable interface";
questions[5][2] = "Remote interface";
questions[5][3] = "Readable interface";
questions[5][4] = "Result interface";

questions[6][0] = "Which keyword is used for accessing the features of a package?";


questions[6][1] = "import";
questions[6][2] = "package";
questions[6][3] = "extends";
questions[6][4] = "export";

questions[7][0] = "In java, jar stands for?";


questions[7][1] = "Java Archive Runner";
questions[7][2] = "Java Archive";
questions[7][3] = "Java Application Resource";
questions[7][4] = "Java Application Runner";

questions[8][0] = "Which of the following is a mutable class in java?";


questions[8][1] = "java.lang.StringBuilder";
questions[8][2] = "java.lang.Short";
questions[8][3] = "java.lang.Byte";
questions[8][4] = "java.lang.String";

questions[9][0] = "Which of the following option leads to the portability and security of Java?";
questions[9][1] = "Bytecode is executed by JVM";
questions[9][2] = "The applet makes the Java code secure and portable";
12
questions[9][3] = "Use of exception handling";
questions[9][4] = "Dynamic binding between objects";

answers[0][1] = "JDB";
answers[1][1] = "int";
answers[2][1] = "java.util package";
answers[3][1] = "Marker Interface";
answers[4][1] = "Heap memory";
answers[5][1] = "Remote interface";
answers[6][1] = "import";
answers[7][1] = "Java Archive";
answers[8][1] = "java.lang.StringBuilder";
answers[9][1] = "Bytecode is executed by JVM";

opt1 = new JRadioButton();


opt1.setBounds(170, 520, 700, 30);
opt1.setBackground(Color.WHITE);
opt1.setFont(new Font("Dialog", Font.PLAIN, 20));
add(opt1);

opt2 = new JRadioButton();


opt2.setBounds(170, 560, 700, 30);
opt2.setBackground(Color.WHITE);
opt2.setFont(new Font("Dialog", Font.PLAIN, 20));
add(opt2);

opt3 = new JRadioButton();


opt3.setBounds(170, 600, 700, 30);
opt3.setBackground(Color.WHITE);
opt3.setFont(new Font("Dialog", Font.PLAIN, 20));
add(opt3);

opt4 = new JRadioButton();


opt4.setBounds(170, 640, 700, 30);
opt4.setBackground(Color.WHITE);
opt4.setFont(new Font("Dialog", Font.PLAIN, 20));
13
add(opt4);

groupoptions = new ButtonGroup();


groupoptions.add(opt1);
groupoptions.add(opt2);
groupoptions.add(opt3);
groupoptions.add(opt4);

next = new JButton("Next");


next.setBounds(1100, 550, 200, 40);
next.setFont(new Font("Tahoma", Font.PLAIN, 22));
next.setBackground(new Color(30, 144, 255));
next.setForeground(Color.WHITE);
next.addActionListener(this);
add(next);

lifeline = new JButton("50-50 Lifeline");


lifeline.setBounds(1100, 630, 200, 40);
lifeline.setFont(new Font("Tahoma", Font.PLAIN, 22));
lifeline.setBackground(new Color(30, 144, 255));
lifeline.setForeground(Color.WHITE);
lifeline.addActionListener(this);
add(lifeline);

submit = new JButton("Submit");


submit.setBounds(1100, 710, 200, 40);
submit.setFont(new Font("Tahoma", Font.PLAIN, 22));
submit.setBackground(new Color(30, 144, 255));
submit.setForeground(Color.WHITE);
submit.addActionListener(this);
submit.setEnabled(false);
add(submit);

start(count);

setVisible(true);
14
}

public void actionPerformed(ActionEvent ae) {


if (ae.getSource() == next) {
repaint();
opt1.setEnabled(true);
opt2.setEnabled(true);
opt3.setEnabled(true);
opt4.setEnabled(true);

ans_given = 1;
if (groupoptions.getSelection() == null) {
useranswers[count][0] = "";
} else {
useranswers[count][0] = groupoptions.getSelection().getActionCommand();
}

if (count == 8) {
next.setEnabled(false);
submit.setEnabled(true);
}

count++;
start(count);
} else if (ae.getSource() == lifeline) {
if (count == 2 || count == 4 || count == 6 || count == 8 || count == 9) {
opt2.setEnabled(false);
opt3.setEnabled(false);
} else {
opt1.setEnabled(false);
opt4.setEnabled(false);
}
lifeline.setEnabled(false);
} else if (ae.getSource() == submit) {
ans_given = 1;
if (groupoptions.getSelection() == null) {
15
useranswers[count][0] = "";
} else {
useranswers[count][0] = groupoptions.getSelection().getActionCommand();
}

for (int i = 0; i < useranswers.length; i++) {


if (useranswers[i][0].equals(answers[i][1])) {
score += 10;
} else {
score += 0;
}
}
setVisible(false);
new Score(name, score);
}
}

public void paint(Graphics g) {


super.paint(g);

String time = "Time left - " + timer + " seconds"; // 15


g.setColor(Color.RED);
g.setFont(new Font("Tahoma", Font.BOLD, 25));

if (timer > 0) {
g.drawString(time, 1100, 500);
} else {
g.drawString("Times up!!", 1100, 500);
}

timer--; // 14

try {
Thread.sleep(1000);
repaint();
} catch (Exception e) {
16
e.printStackTrace();
}

if (ans_given == 1) {
ans_given = 0;
timer = 15;
} else if (timer < 0) {
timer = 15;
opt1.setEnabled(true);
opt2.setEnabled(true);
opt3.setEnabled(true);
opt4.setEnabled(true);

if (count == 8) {
next.setEnabled(false);
submit.setEnabled(true);
}
if (count == 9) { // submit button
if (groupoptions.getSelection() == null) {
useranswers[count][0] = "";
} else {
useranswers[count][0] = groupoptions.getSelection().getActionCommand();
}

for (int i = 0; i < useranswers.length; i++) {


if (useranswers[i][0].equals(answers[i][1])) {
score += 10;
} else {
score += 0;
}
}
setVisible(false);
new Score(name, score);
} else { // next button
if (groupoptions.getSelection() == null) {
useranswers[count][0] = "";
17
} else {
useranswers[count][0] = groupoptions.getSelection().getActionCommand();
}
count++; // 0 // 1
start(count);
}
}

public void start(int count) {


qno.setText("" + (count + 1) + ". ");
question.setText(questions[count][0]);
opt1.setText(questions[count][1]);
opt1.setActionCommand(questions[count][1]);

opt2.setText(questions[count][2]);
opt2.setActionCommand(questions[count][2]);

opt3.setText(questions[count][3]);
opt3.setActionCommand(questions[count][3]);

opt4.setText(questions[count][4]);
opt4.setActionCommand(questions[count][4]);

groupoptions.clearSelection();
}

public static void main(String[] args) {


new Quiz("User");
}
}

Score.java file
import java.awt.*;
import javax.swing.*;
18
import java.awt.event.*;

public class Score extends JFrame implements ActionListener {

Score(String name, int score) {


setBounds(400, 150, 750, 550);
getContentPane().setBackground(Color.WHITE);
setLayout(null);

ImageIcon i1 = new ImageIcon(ClassLoader.getSystemResource("icons/score.png"));


Image i2 = i1.getImage().getScaledInstance(300, 250, Image.SCALE_DEFAULT);
ImageIcon i3 = new ImageIcon(i2);
JLabel image = new JLabel(i3);
image.setBounds(0, 200, 300, 250);
add(image);

JLabel heading = new JLabel("Thankyou " + name + " for playing Simple Minds");
heading.setBounds(45, 30, 700, 30);
heading.setFont(new Font("Tahoma", Font.PLAIN, 26));
add(heading);

JLabel lblscore = new JLabel("Your score is " + score);


lblscore.setBounds(350, 200, 300, 30);
lblscore.setFont(new Font("Tahoma", Font.PLAIN, 26));
add(lblscore);

JButton submit = new JButton("Play Again");


submit.setBounds(380, 270, 120, 30);
submit.setBackground(new Color(30, 144, 255));
submit.setForeground(Color.WHITE);
submit.addActionListener(this);
add(submit);

setVisible(true);
}

19
public void actionPerformed(ActionEvent ae) {
setVisible(false);
new Login();
}

public static void main(String[] args) {


new Score("User", 0);
}
}

4.2 Screenshots from the Application

20
21
22
Chapter 5: Conclusion and Future Scope

5.1 Conclusion

In conclusion, the quiz application represents a dynamic paradigm in educational technology,


seamlessly blending learning and entertainment. Its user-friendly interface, coupled with adaptive
features, creates an engaging platform suitable for learners of all levels. By providing instant
feedback, personalized experiences, and opportunities for friendly competition, the quiz application
goes beyond traditional assessment methods. The fusion of gamification elements, such as
leaderboards and achievements, cultivates a motivational atmosphere, driving users to actively
participate in the learning process.

Furthermore, the application's versatility accommodates a wide range of subjects and learning styles,
promoting a holistic approach to knowledge acquisition. As a result, it becomes a valuable resource
for self-assessment, skill enhancement, and fostering a community of knowledge enthusiasts.
Ongoing refinements, responsive design for various devices, and robust security measures contribute
to the application's longevity and relevance in the ever-evolving landscape of educational tools. In
essence, the quiz application stands as a beacon of innovation, embodying the fusion of technology
and education to create an interactive, enjoyable, and effective learning experience for users
worldwide.

5.2 Future Scope

The future scope of quiz applications is promising, with several potential developments and
advancements on the horizon:

Personalized Learning Paths:


Future quiz applications may leverage artificial intelligence and machine learning algorithms to
analyze user performance and preferences. This data can be used to tailor quizzes to individual
learning styles, creating personalized learning paths that cater to the unique needs of each user.

Integration of Augmented Reality (AR) and Virtual Reality (VR):


Incorporating AR and VR technologies can enhance the user experience by creating immersive quiz
environments. Users may find themselves exploring virtual spaces, solving problems in three-
dimensional settings, or interacting with virtual quiz elements, making learning more engaging and
interactive.

Adaptive and Intelligent Quizzing:


Quiz applications of the future may become even more adaptive, adjusting not only to the user's
proficiency level but also to real-time performance within a quiz session. Intelligent algorithms could
dynamically modify the difficulty of questions based on user responses, ensuring an optimal level of
challenge and learning.

23
Real-Time Collaborative Quizzing:
Collaborative learning is gaining prominence, and future quiz applications might facilitate real-time
collaborative quizzing. Users could join forces to answer questions collectively, fostering teamwork,
communication, and knowledge-sharing among participants.

Blockchain for Security and Integrity:


Implementing blockchain technology can enhance the security and integrity of quiz applications.
Blockchain can be used to secure user data, prevent cheating, and ensure the transparency and
authenticity of quiz results and rankings.

Gamification Enhancements:
The gamification elements in quiz applications may evolve with more sophisticated features, such as
advanced leaderboards, virtual rewards, and interactive storytelling. These enhancements could further
motivate users and create a more immersive learning and gaming experience.

Integration with Learning Management Systems (LMS):


Quiz applications could integrate seamlessly with educational platforms and learning management
systems. This integration would allow educators to track and assess students' progress, integrate
quizzes into course curricula, and provide a comprehensive overview of learning outcomes.

Globalized and Multilingual Quizzes:


To cater to a diverse audience, future quiz applications may offer quizzes in multiple languages,
facilitating global participation. This inclusivity would make educational content accessible to
individuals worldwide, promoting cross-cultural learning experiences.

Continuous Learning and Skill Development:


Quiz applications might extend beyond traditional knowledge assessments and focus on continuous
learning and skill development. This could involve the incorporation of quizzes that assess practical
skills, critical thinking, and problem-solving abilities.

Integration with Emerging Technologies: As new technologies emerge, quiz applications may
integrate with cutting-edge innovations such as natural language processing, voice recognition, and
gesture control. These integrations could enhance user interfaces and create more diverse and
accessible ways for users to interact with quizzes.

24
BIBLIOGRAPHY

Books-

Head First Java - Kathy Sierra & Bert Bates

Head First Design Patterns - Eric Freeman

Effective Java – Joshua Bloch

Websites-

https://www.w3schools.com/java/java_intro.asp

https://www.programiz.com/java-programming

https://www.digitalocean.com/community/tutorials/java-design-patterns-example-tutorial

https://www.geeksforgeeks.org/java-awt-tutorial/

25

You might also like