Sathyabama: Automatic Question Paper Generator
Sathyabama: Automatic Question Paper Generator
By
SATHYABAMA
INSTITUTE OF SCIENCE AND TECHNOLOGY
JEPPIAAR NAGAR, RAJIV GANDHI SALAI,
CHENNAI – 600119, TAMILNADU
MARCH 2022
SATHYABAMA
INSTITUTE OF SCIENCE AND TECHNOLOGY
(DEEMED TO BE UNIVERSITY)
Accredited with Grade “A” by NAAC
(Established under Section 3 of UGC Act, 1956)
JEPPIAAR NAGAR, RAJIV GANDHI SALAI, CHENNAI– 600119
www.sathyabama.ac.in
This is to certify that this Project Report is the bonafade work of SARAVNAN.J
(Reg. No. 39290091) and SIVAPRIYAN.M (Reg. No. 39290096) who carried
out the project entitled “AUTOMATIC QUESTION PAPER GENERATOR” under
my supervision from December 2021 to March 2022.
Internal Guide
Dr. MOHANPRASAD
DATE:
I would like to express my sincere and deep sense of gratitude to my Project Guide
Dr. MOHANPRASAD, for his valuable guidance, suggestions and constant
encouragement paved way for the successful completion of my project work.
I wish to express my thanks to all Teaching and Non-teaching staff members of the
Department of Computer Science and Engineering who were helpful in many ways
For the Completion of the project.
ABSTRACT
1. INTRODUCTION
1.1 OVERVIEW OF THE PROJECT 1
1.2 MODULES USED IN THIS PROJECT 1
2. SYSTEM SPECIFICATION
2.1 HARDWARE REQUIREMENTS 2
2.2 SOFTWARE REQUIREMENTS 2
2.3 SOFTWARE DESCRIPTION 2
3. SYSTEM STUDY
3.1 EXISTING SYSTEM 7
3.2 PROPOSED SYSTEM 7
3.3 CHARACTERISTICS OF PROPOSED SYSTEM 7
4. SYSTEM DESIGN
4.1 MODULE DESCRIPTION 9
4.2 DATABASE DESIGN 9
4.3 DATA FLOW DIAGRAM 10
4.4 ENTITTY RELATIONSHIP DIAGRAM 12
4.5 TABLE STRUCTURE 15
4.6 INPUT OUTPUT DESIGN 18
5. SYSTEM TESTING AND SECURITY
5.1 SOFTWARE TESTING 20
5.2 SECURITY 23
6. SCOPE FOR FUTUTRE ENHANCEMENT 24
7. CONCLUSION 25
8. BIBILIOGRAPHY 26
APPENDIX
A. SCREENSHOTS 27
B. SOURCE CODE 30
1. INTRODUCTION
1.1 OBJECTIVES
Tasks performed by this system are automated and because of that storage
space, security is not a concern anymore. Proposed system works upon Natural
Language Processing and is fast due to computer Based automation, streamlined,
randomized and unbiased, secure and generates unique questions and overcomes
the problems of Human based paper generation.
1
2. SYSTEM SPECIFICATION
XAMPP SERVER
XAMPP is a free and open-source cross-platform web server solution stack
package developed by Apache Friends, consisting mainly of the Apache HTTP
Server, Maria DB database, and interpreters for scripts written in the PHP and Perl
programming languages.
2
mobile apps are opened up, is implemented by front End developers.
Responsiveness and performance are two main objectives of the Front
End. The developer must ensure that the site is responsive i.e. it appears correctly on devices of all sizes no
part of the website should behave abnormally irrespective of the size of the screen. Some of frontend
development tools are HTML, CSS and Java Script
3
Features of Front End
The part of a website that the user interacts with directly is termed the front
end. It is also referred to as the ‘client side’ of the application. It includes everything
that users experience directly: text colors and styles, images, graphs and tables,
buttons, colors, and navigation menu. HTML, CSS, and JavaScript are the
languages used for Front End development. The structure, design, behavior, and
content of everything seen on browser screens when websites, web applications, or
mobile apps are opened up, is implemented by front End developers.
Responsiveness and performance are two main objectives of the Front
4
End. The developer must ensure that the site is responsive i.e. it appears correctly
on devices of all sizes no part of the website should behave abnormally irrespective
of the size of the screen. Some of frontend development tools are HTML, CSS and
Java Script.
Features:
5
• PHP runs on various platforms (Windows, Linux, Unix, Mac OS, etc…)
• PHP is compatible with almost all servers used today (Apache, IIs etc…)
6
• PHP supports a wide range of databases.
• PHP is free. Download it from the official PHP resources: www.php.net.
• PHP is easy to learn and runs efficiently on the server side.
HTML5
HTML5 is a mark-up language used for structure and presenting contents for
the World Wide Web and a core technology of the Internet. It is the fifth revision of
the HTML standard (created in 1990 and standardized as HTML 4 as of 1997). Its
core aims have been to improve the language with support for the latest multimedia
while keeping it easily readable by humans and consistently understood by
computers and devices (web browser, parsers etc…) HTML5 is intended to
subsume not only HTML 4, but also XHTML1 and DOM level 2 HTML, HTML5 is
also cross-platform. It is designed to work whether you are using a PC, or a Tablet, a
Smartphone, or a TV.
Features:
7
CSS CASCADE STYLE SHEET
Cascading Style Sheet (CSS) is a style sheet language used for describing the look
and formatting of a document written in a mark-up language. While lost often used
to style web pages and interfaces written in HTML and XHTML, the language can
be applied to any kind of XML document, including plain XML, SVG, and CSS is a
cornerstone specification of the web and almost all web pages use CSS style sheet
to describe their presentation.
CSS helps web developers to create a uniform look across several pages of a
website. Instead of defining the style of each table and each block of text within a
page’s HTML, commonly used style needs to be defined only once in a CSS
document. Once the style is defined in cascading style sheet, it can be used by any
page that references the CSS file. CSS makes it easy to change styles across
several pages at once.
JavaScript
Features
8
Overview of Back End
MYSQL
MySQL is popular for web application and acts as the database component of
the LAMP, BAMP, MAMP, and WAMP platforms (Linux/BSD/Mac/Windows- apache-
MySQL- PHP-/Perl/Python), and for open-source bug tracking tools like Bugzilla. Its
popularity for use with web applications is closely tied to the popularity of PHP and
Ruby on Rails, which are often combined with MySQL, PHP and MySQL are
essential components for running popular contents management systems such as
Drupal, e107, Word Press and some Bit Torrent trackers.
9
3.SYSTEM STUDY
DRAWBACKS
• It is a human process.
• In this process repetition in paper may occur.
• Less Security.
• It is a slow process.
• It has less varieties of questions.
• The Automatic Question Paper Generator System is developed using the Natural
Language Processing, Html, CSS, Php and My SQL. In a fully functional system, there is
a repository of syllabus, questions and pattern of question papers. It takes a simple text,
a document or a pdf file as an input and provides a list of questions as an output
10
• It is an automated process.
• It is a random as well as unbiased process.
• Higher security.
• It is a faster process
11
• It is an automated process.
• It is a random as well as unbiased process.
• Higher security.
• It is a faster process.
• It has more varieties of questions.
12
4.SYSTEM DESIGN
* In this module, we will select the subject, enter the subject code, and
enter the number of questions and number of questions to be answered in
sections A, B, C.
* Then we will set marks for each section, and select the total marks.
* And then click the generate button.
* This module is the output page, this page displays the question paper
* We can view and print the question paper in this module.
13
their own datatype and value to be presented for it.
4.1 DATA FLOW DIAGRAM:
The DFD takes an input-process-output view of a system i.e. data objects flow
into the software, are transformed by processing elements, and resultant data
objects flow out of the software. Data objects represented by labelled arrows and
transformation are represented by circles also called as bubbles. DFD is presented
in a hierarchical fashion i.e. the first data flow model represents the system as a
whole. Subsequent DFD refine the context diagram (level 0 DFD), providing
increasing details with each subsequent level. The DFD enables the software
engineer to develop models of the information domain & functional domain at the
same time. As the DFD is refined into greater levels of details, the analyst performs
an implicit functional decomposition of the system. At the same time, the DFD
refinement results in a corresponding refinement of the data as it moves through the
process that embodies the applications. A context-level DFD for the system the
primary external entities produce information for use by the system and consume
information generated by the system. The labelled arrow represents data objects or
object hierarchy.
LEVEL 0.DFD:
DB 1 DB DB 3 DB
2 PROG IN 4
RDBM
S JAV C C+
A +
14
LEVEL 2. DFD
Question Paper
Creation using
PH
P
Question Paper
(Output )
This Data flow diagram represents the output procedure from the database. Using
the above flow diagram, the software produces the output.
15
4.4 ENTITY RELATIONSHIP DIAGRAM
16
A many to many (M:N) relationship, sometimes called non-specific, is when
for one instance of entity A, there are zero, one, or may instances of entity B and for
one instance of entity B there are zero, one, or many instance of entity A.
The connectivity of a relationship describes the mapping of associated.
ER Notations
Entities are represented by labelled rectangles. The label is the name of the
entity. Entity names should be singular nouns.
Relationships are represented by a solid line connecting two entities. The
name of the relationship is written above the line. Relationship names should
be verbs Attributes, when included, are listed inside the entity rectangle.
Attributes which are identifiers are underlined. Attribute names should be
singular nouns.
Cardinality of many is represented by a line ending in a crow's foot. If the
crow's foot is omitted, the cardinality is one.
Existence is represented by placing a circle or a perpendicular bar on the
line. Mandatory existence is shown by the bar (looks like a 1) next to the
entity for an instance is required. Optional existence is shown by placing a
circle next to the entity that is optional.
17
4.1 TABLE STRUCTURE
Database Table
A database consists of one or more tables. Each table is made up of rows and
columns. If you think of a table as a grid, the column go from left to right across the
grid and each entry of data is listed down as a row.
18
Each row in a relational is uniquely identified by a primary key. This can be by one or
more sets of column values. In most scenarios it is a single column, such as
employee ID.
Every relational table has one primary key. Its purpose is to uniquely identify each
row in the database. No two rows can have the same primary key value. The
practical result of this is that you can select every single row by just knowing its
primary key.
19
Question Table 3 (PROGRAMMING IN C):
20
4.6. INPUT DESIGN
This is the input design of this project, where we can set pattern of the question paper.
21
4.7 OUTPUT DESIGN:
This is the ouput design of this project, where we can view and print the question paper
22
5.SYSTEM TESTING AND SECURITY
Types of testing:
1. Unit testing
2. White-box testing
3. Black-box testing
4. Validation testing
5. Backend testing
Unit Testing:
Unit testing involves the design of test cases that validate that the internal program
logic is functioning properly, and that program input produces valid outputs. All
decision branches and internal code flow should be validated. It is the testing of
individual software units of the application .it is done after the completion of an
individual unit before integration.
This is a structural testing, that relies on knowledge of its construction and is
invasive. Unit tests perform basic tests at component level and test a specific
business process, application, and/or system configuration. Unit tests ensure that
each unique path of a business process performs accurately to the documented
specifications and contains clearly defined inputs and expected results.
23
White-box Testing:
It is a test case design method that uses the control structure of the procedural
design to drive test cases. Using white box testing methods it was guaranteed that
most of the independent paths within modules had been exercised at least once, all
logical decision on their true and false sides, executed all loops at their boundaries
and exercised internal data structures to ensure their data validity.
White box testing has been done to achieve the following objectives. Logic errors and
incorrect assumptions are inversely proportional to the probability that a program
path will be executed. Errors tend to creep into the work when design and
implementation functions, condition or control that is out of the mainstream. We often
believe that logical path is not likely to be executed when the fact it may be executed
on regular basis. When program is translated into programming language source
code, it is likely that some typing errors will occur. Many will be uncovered by syntax
and type checking mechanism but others may go undetected until testing begins.
Black-box Testing:
Although tests are designed to uncover errors, they are also used to demonstrate
that the software functions are operational, input is properly accepted and output is
correctly produced and that the integrity of external information is maintained. A black
box test examines some of fundamental aspects of a system with little regard for the
internal logical structure of the software.
All input screens were thoroughly tested for data validity and smoothness of data
entry operations. Test cases were so formulated to verify whether the system works
properly in rare conditions also. Error conditions were checked. Data entry
operations are to be user friendly and smooth. It would be easier for the operators if
they can enter data through key board only. Using mouse and keyboard alternatively
will affect the speed of data entry. Care was taken to make data entry as smooth as
possible. Flow of object was made convenient to the data entry operations. Testing
also tested wrong input for data value.
24
Validation Testing:
Validation testing can be defined as many, but a single definition is that validation
succeeds when the software functions in a manner that can be reasonable excepted
by the customer. After validation test have been conducted one of the two possible
conditions exists.
The function or performance characteristics are acceptable and confirmed to
specification. A decision from specification is uncovered and defining list is created.
System validation checks the quality of software in both simulated and live
environment. First the software goes through a phase in which errors and failures
based on simulated user requirements are verified and studied.
Back-end Testing:
Functional testing:
25
5.2 SECURITY
26
6. SCOPE FOR FUTURE ENHANCEMENT
It is a fully automated system which results in fast results. In this system there is no
need of transporting paper through police/security vans to all colleges. This system
provides unbiased results. The usage of this system reduces human effort and saves
time and resources to an extent.
This project can be further extended to generate yes/no type questions and fill in the blanks
type questions. Further automatic answer copy checking systems can be added for checking
the answer sheets and providing the result to the student
7. CONCLUSION
With the use of this system for question paper generation there are no
chances of exam paper getting 5 leaked as paper is generated just before the test. It
will save a lot of time for teachers and thus will improve efficiency. The implemented
process strives to solve the problems listed above in a positive way. The
implemented work narrates an automated system that heads away from the
traditional process of paper generation to an automated process, by giving controlled
entry to the resources that is attained by involving users and their roles in the
colleges.
8. BIBILOGRAPHY
BOOKS REFERENCES:
1. Himanshu Jethwani, Mohd Shahid Husain, Mohd Akbar, ISSN 2347 -
7911 “International Journal for Innovations in Engineering, Science and
Management” Available online at: www.ijiesm.com Volume 3, Issue 4,
April 2015
3. Paul DuBois, "MySQL Developer's Library", 4th ed, 2009 (5th ed is probably available).
4. Codd E. F., "A Relational Model of Data for Large Shared Data
Banks", Communications of the ACM, vol. 13, issue 6, pp. 377–
387, June 1970.
@http://download.oracle.com/javase/tutorial/jdbc/basics/index.html.
WEBSITES
28
related to W3C).
29
9. APPENDIX
10.1. SCREENSHOTS
This page is the first module, Importing question module. Here we can enter the
questions and it will be stored in the Question Bank (Database).
30
Pattern Setting Page:
This is the Input Design, Pattern Setting Module. Here we can set the question paper pattern
31
Output Page:
This is the Ouput Design, Question paper viewing module. Here we can view and
print the question paper.
32
10.2. SOURCE CODE:
Import Question.html
<!DOCTYPE html>
<html>
<style>
body {
background-color: #03dcf8;
}
h1 {text-align:
center;} label {font-
size: 20px;}
label {font-family: "Times New Roman", Times,
serif;} input[type=text], select {
width: 100%;
padding: 12px
20px; margin: 20px
0; display: inline-
block;
border: 1px solid rgb(45, 248,
18); border-radius: 4px;
box-sizing: border-box;
}
input[type=submit]
{ width: 25%;
background-color:
#10be2d; color: rgb(255,
255, 255); padding: 14px
20px; margin: 20px
550px; border: none;
33
border-radius: 4px;
34
cursor: pointer;
}
input[type=submit]:hover {
background-color:
#0cd2e0;
}
div {
border-radius: 5px;
background-color:
#03dcf8; padding: 20px;
}
</style>
<body>
<h1>Question Paper</h1>
<div>
<form action="import.php" method="POST">
<label for="Question_Paper">Subject</label>
<select id="Subject" name="Question_Paper">
<option value="null">Select Subject</option>
<option value="rdbms">RDBMS</option>
<option value="c_prog">C Program</option>
<option value="c_plusplus">C++ Program</option>
<option value="java">JAVA</option>
</select>
<label for="sa">Section-A</label>
<input type="text" id="sa" name="sectiona" placeholder="Enter the
Section- A Question...">
35
<label for="sb">Section-B</label>
<input type="text" id="sb" name="sectionb" placeholder="Enter the
Section- B Question...">
<label for="sc">Section-C</label>
<input type="text" id="sc" name="sectionc" placeholder="Enter the
Section- C Question...">
<input type="submit" value="Submit">
</form>
</div>
</body>
</html>
Question_Generator.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Question Paper Generator</title>
<style>
*{
margin:0;
padding:
0;
}
body{
background-image:
url(logo.png); margin-
top:40px;
36
background-position:center;
37
background-repeat : no-
repeat; background-
size:300px 300px; font-
family:sans-serif;
}
.regform{
width:800px;
background-
color:rgb(0,0,0,0.6);
margin:auto;
color:#FFFFFF;
padding:10px 0px 10px
0px; text-align:center;
border-radius:15px 15px 0px 0px ;
}
.main{
background-
color:rgb(0,0,0,0.7);
width:800px;
margin:auto;}
form{
padding:10px;
#name{
width:100%
;
height:100px
;
38
}
.name{
margin-left:25px;
39
margin-
top:30px; width:
110px;
color: white;
font-size:
16px;
font-weight: 700;}
.firstname{
position:
relative; left:150px;
top:-37px;
line-height: 40px;
border-radius:
6px; padding: 0
22px; font-size:
16px;
}
.lastname{
position:
relative; left:417px;
top:-80px;
line-height: 40px;
border-radius:
6px; padding: 0
22px; font-size:
16px; color:#555;
}
.firstlabel{
position:relativ
e;
color:#E5E5E5
40
;
text-transform:
capitalize; font-size:
14px;
left:150px;
41
top:-45px;
}
.lastlabel{
position:relativ
e; color:#E5E5E5;
text-
transform:capitalize;
font-size:14px;
left:480px;
top:-76px;
}
.company{
position:relativ
e; left:150px;
top:-37px;
line-height:
40px;
width:450px;
border-radius:
6px; padding: 0
22px; font-size:
16px; color: #555;
}
.email{
position:relativ
e; left:200px;
top:-37px;
line-height: 40px;
width:480px;
border-radius:
6px; padding: 0
22px; font-size:
42
16px; color: #555;
}
43
.Code{
position:relativ
e; left:150px;
top:-37px;
line-height: 40px;
width:95px;
border-radius:
6px; padding: 0
22px; font-size:
16px; color: #555;
}
.number{
position:relativ
e; left:140px;
top:-37px;
line-height: 40px;
width:95px;
border-radius:
6px; padding: 0
22px; font-size:
16px; color: #555;
}
.area-code{
position:relativ
e; color:#E5E5E5;
text-
transform:capitalize;
font-size:16px;
left:10px;
top:-2px;
44
}
.phone-number{
position:relativ
e; color:#E5E5E5;
text-
transform:capitalize;
font-size:16px;
left:-
10px;
top:-2px;
}
.option{
position:relativ
e; left:150px;
top:-30px;
line-height:
40px;
width:500px;
height:40px;
border-radius:
6px; padding: 0
22px; font-size:
16px; color: #555;
outline:none;
overflow:hidden;
}
.option option{
font-size:20px;
}
#coustomer{
margin-
left:25px; color:white;
45
font-size:18px;
46
}
.radio{
display:inline-
block; padding-
right:70px; font-
size:25px;
margin-
left:25px;
margin-
top:15px;
color:white;
}
.radio input{
width:20px;
height:20px;
border-
radius:50%;
cursor:pointer;
outline:none;
}
button{
background-
color:#3BAF9F;
display:block;
margin:20px 0px 0px
20px; text-align:center;
border-radius:12px;
border:2px solid
#366473; padding:14px
110px; outline:none;
color:white;
cursor:pointer;
47
transition:0.25p
x;
}
button:hover{
background-color:#5390F5;
48
}
</style>
</head>
<body>
<div class="regform">
<h1>Question Paper Automation</h1>
</div>
<div class="main">
<h2
class="name">
Section A</h2>
<input class="Code" type="number" name="SecALim">
<label class="area-code">Total No of Questions</label>
<input class="number" type="number" name="SecAAtt">
<label class="phone-number">No of question to be answered</label>
49
<h2
class="name"> Section
B</h2>
50
<input class="Code" type="number" name="SecBLim">
<label class="area-code">Total No of Questions</label>
<input class="number" type="number" name="SecBAtt">
<label class="phone-number">No of question to be answered</label>
<h2
class="name"> Section
C</h2>
<input class="Code" type="number" name="SecCLim">
<label class="area-code">Total No of Questions</label>
<input class="number" type="number" name="SecCAtt">
<label class="phone-number">No of question to be answered</label>
<h2
class="name">
Marks</h2>
<input class="Code" type="number" name="SecAMark">
<label class="area-code">Section A</label>
<input class="number" type="number" name="SecBMark">
<label class="phone-number">Section B</label>
<input class="number" type="number" name="SecCMark">
<label class="phone-number">Section C</label>
<h2
id="coustomer"> Total
Mark</h2>
<label class="radio">
<input class="radio-
one" type="radio" checked="checked" name="MaxMark" value = "100">
<span
class="checkmark"></span>
100
</label>
51
<label class="radio">
<input class="radio-two" type="radio" name="MaxMark" value = "50">
52
<span
class="checkmark"></span> 50
</label>
<button type="submit">Generate</button>
</form>
</div>
</body>
</html>
Output.php
<?php
$SecALim = $_POST['SecALim'];
$SecBLim = $_POST['SecBLim'];
$SecCLim = $_POST['SecCLim'];
$Sub_Name = $_POST['subject'];
$Sub_Code = $_POST['SubCode'];
$SecAAtt = $_POST['SecAAtt'];
$SecBAtt = $_POST['SecBAtt'];
$SecCAtt = $_POST['SecCAtt'];
$SecAMark = $_POST['SecAMark'];
$SecBMark = $_POST['SecBMark'];
$SecCMark = $_POST['SecCMark'];
$MaxMark =
$_POST['MaxMark'];
if($MaxMark==100)
$Time =
3; else
$Time =
2; echo
53
"<html>
54
<head><title>$Sub_Code _ $Sub_Name</title>
</head>
</html>";
echo "<CENTER><b>PSG College Of Arts And
Science</b></CENTER>"; echo "<CENTER><b>June
2021</b></CENTER>";
echo "<CENTER><b>",$Sub_Name,"</b></CENTER>";
echo "<CENTER><b> Subject Code -
",$Sub_Code,"</b></CENTER><br>"; echo "<div align ='right'>";
echo "<b>Max Mark :
",$MaxMark,".</b><br>"; echo "<b> Time :
",$Time," hrs.</b></div>";
if($Sub_Name =="Relational Database Management System")
{
$host='localhost';
$username='root';
$password='';
$conn=mysqli_connect($host,$username,$password,"question_
bank"); if(!$conn){
die('Could not Connect My Sql:' .mysql_error());
}
else
{
echo "<CENTER><b>SECTION A (",$SecAAtt," X ",$SecAMark," =
",$SecAAtt*$Se cAMark," Marks)</b></CENTER>";
echo"<b>Answer any $SecAAtt Question</b><br>";
$query = "SELECT Section_A FROM `question_bank`.`rdbms` ORDER BY
RAND() li mit $SecALim";
$result =
mysqli_query($conn,$query);
if($result = $conn->query($query))
{
55
$i = 1;
while ($row = $result->fetch_assoc())
56
{
$field1name =
$row["Section_A"]; echo
"<br>",$i,". ",$field1name;
$i=$i+1;
}
}
}
if(!$conn){
die('Could not Connect My Sql:' .mysql_error());
}
else
{
echo "<CENTER><b>SECTION B (",$SecBAtt," X ",$SecBMark," =
",$SecBAtt*$Sec BMark," Marks)</b></CENTER>";
echo"<b>Answer any $SecBAtt Question</b><br>";
$query1 = "SELECT Section_B FROM `question_bank`.`rdbms` ORDER BY
RAND() limit $SecBLim";
$result1 =
mysqli_query($conn,$query1);
if($result1 = $conn->query($query1))
{
while ($row1 = $result1->fetch_assoc())
{
$field2name =
$row1["Section_B"]; echo
"<br>",$i,". ",$field2name;
$i=$i+1;
}
}
}
if(!$conn){
57
die('Could not Connect My Sql:' .mysql_error());
}
58
else
{
echo "<CENTER><b>SECTION C (",$SecCAtt," X ",$SecCMark," =
",$SecCAtt*$Sec CMark," Marks)</b></CENTER>";
echo"<b>Answer any $SecCAtt Question</b><br>";
$query2 = "SELECT Section_C FROM `question_bank`.`rdbms` ORDER BY
RAND() limit $SecCLim";
$result2 =
mysqli_query($conn,$query2);
if($result2 = $conn->query($query2))
{
while ($row2 = $result2->fetch_assoc())
{
$field3name =
$row2["Section_C"]; echo
"<br>",$i,". ",$field3name;
$i=$i+1;
}
}
echo "<center><br><br>*********</center>";
}
}
elseif($Sub_Name =="Visual Basics")
{
$host2='localhost';
$username2='root';
$password2='';
$conn2=mysqli_connect($host2,$username2,$password2,"question
_bank"); if(!$conn2){
die('Could not Connect My Sql:' .mysql_error());
}
else
59
{
60
echo "<CENTER><b>SECTION A (",$SecAAtt," X ",$SecAMark," =
",$SecAAtt*$Se cAMark," Marks)</b></CENTER>";
echo"<b>Answer any $SecAAtt Question</b><br>";
$query2 = "SELECT Section_A FROM question_bank.c_prog ORDER BY
RAND() li mit $SecALim";
$result2 =
mysqli_query($conn2,$query2);
if($result2 = $conn2->query($query2))
{
$i = 1;
while ($row2 = $result2->fetch_assoc())
{
$field1name2 =
$row2["Section_A"]; echo
"<br>",$i,". ",$field1name2;
$i=$i+1;
}
}
}
if(!$conn2){
die('Could not Connect My Sql:' .mysql_error());
}
else
{
echo "<CENTER><b>SECTION B (",$SecBAtt," X ",$SecBMark," =
",$SecBAtt*$Sec BMark," Marks)</b></CENTER>";
echo"<b>Answer any $SecBAtt Question</b><br>";
$query12 = "SELECT Section_B FROM question_bank.c_prog ORDER BY
RAND() li mit $SecBLim";
$result12 =
mysqli_query($conn2,$query12);
if($result12 = $conn2->query($query12))
61
{
while ($row12 = $result12->fetch_assoc())
{
62
$field2name2 =
$row12["Section_B"]; echo
"<br>",$i,". ",$field2name2;
$i=$i+1;
}
}
}
if(!$conn2){
die('Could not Connect My Sql:' .mysql_error());
}
else
{
echo "<CENTER><b>SECTION C (",$SecCAtt," X ",$SecCMark," =
",$SecCAtt*$Sec CMark," Marks)</b></CENTER>";
echo"<b>Answer any $SecCAtt Question</b><br>";
$query22 = "SELECT Section_C FROM question_bank.c_prog ORDER BY
RAND() li mit $SecCLim";
$result22 =
mysqli_query($conn2,$query22);
if($result22 = $conn2-
>query($query22)){
while ($row22 = $result22->fetch_assoc())
{
$field3name2 =
$row22["Section_C"]; echo
"<br>",$i,". ",$field3name2;
$i=$i+1;
}
}
echo "<center><br><br>*********</center>";
}
}
63
elseif($Sub_Name =="Programming in C")
{
$host3='localhost';
64
$username3='root';
$password3='';
$conn3=mysqli_connect($host3,$username3,$password3,"question
_bank"); if(!$conn3){
die('Could not Connect My Sql:' .mysql_error());
}
else
{
echo "<CENTER><b>SECTION A (",$SecAAtt," X ",$SecAMark," =
",$SecAAtt*$SecAM ark," Marks)</b></CENTER>";
echo"<b>Answer any $SecAAtt Question</b><br>";
$query3 = "SELECT Section_A FROM `question_bank`.`c_plusplus` ORDER BY
RAND() l imit $SecALim";
$result3 =
mysqli_query($conn3,$query3);
if($result3 = $conn3->query($query3))
$i = 1;
while ($row3 = $result3->fetch_assoc())
{
$field1name3 =
$row3["Section_A"]; echo
"<br>",$i,". ",$field1name3;
$i=$i+1;
}
}
if(!$conn3){
die('Could not Connect My Sql:' .mysql_error());
}
else
{
echo "<CENTER><b>SECTION B (",$SecBAtt," X ",$SecBMark," =
",$SecBAtt*$SecBMa rk," Marks)</b></CENTER>";
65
echo"<b>Answer any $SecBAtt Question</b><br>";
66
$query13 = "SELECT Section_B FROM `question_bank`.`c_plusplus` ORDER BY
RAND() limit $SecBLim";
$result13 =
mysqli_query($conn3,$query13);
if($result13 = $conn3->query($query13))
while ($row13 = $result13->fetch_assoc())
{
$field2name3 =
$row13["Section_B"]; echo
"<br>",$i,". ",$field2name3;
$i=$i+1;
}
}
if(!$conn3){
die('Could not Connect My Sql:' .mysql_error());
}
else
{
echo "<CENTER><b>SECTION C (",$SecCAtt," X ",$SecCMark," =
",$SecCAtt*$SecCMa rk," Marks)</b></CENTER>";
echo"<b>Answer any $SecCAtt Question</b><br>";
$query23 = "SELECT Section_C FROM `question_bank`.`c_plusplus` ORDER BY
RAND() limit $SecCLim";
$result23 =
mysqli_query($conn3,$query23);
if($result23 = $conn3->query($query23))
while ($row23 = $result23->fetch_assoc())
{
$field3name3 =
$row23["Section_C"]; echo
"<br>",$i,". ",$field3name3;
$i=$i+1;
67
}
echo "<center><br><br>*********</center>";
}
}
68
elseif($Sub_Name =="Programming in C++")
{
$host4='localhost';
$username4='root';
$password4='';
$conn4=mysqli_connect($host4,$username4,$password4,"question
_bank"); if(!$conn4){
die('Could not Connect My Sql:' .mysql_error());
}
else
{
echo "<CENTER><b>SECTION A (",$SecAAtt," X ",$SecAMark," =
",$SecAAtt*$SecAM ark," Marks)</b></CENTER>";
echo"<b>Answer any $SecAAtt Question</b><br>";
$query4 = "SELECT Section_A FROM `question_bank`.`java` ORDER BY RAND()
limit $ SecALim";
$result4 =
mysqli_query($conn4,$query4);
if($result4 = $conn4->query($query4))
$i = 1;
while ($row4 = $result4->fetch_assoc())
{
$field1name4 =
$row4["Section_A"]; echo
"<br>",$i,". ",$field1name4;
$i=$i+1;
}
}
if(!$conn4){
die('Could not Connect My Sql:' .mysql_error());
}
else
69
{
70
echo "<CENTER><b>SECTION B (",$SecBAtt," X ",$SecBMark," =
",$SecBAtt*$SecBMa rk," Marks)</b></CENTER>";
echo"<b>Answer any $SecBAtt Question</b><br>";
$query14 = "SELECT Section_B FROM `question_bank`.`java` ORDER BY RAND() limit
$SecBLim";
$result14 =
mysqli_query($conn4,$query14);
if($result14 = $conn4->query($query14))
while ($row14 = $result14->fetch_assoc())
{
$field2name4 =
$row14["Section_B"]; echo
"<br>",$i,". ",$field2name4;
$i=$i+1;
}
}
if(!$conn4){
die('Could not Connect My Sql:' .mysql_error());
}
else
{
echo "<CENTER><b>SECTION C (",$SecCAtt," X ",$SecCMark," =
",$SecCAtt*$SecCMa rk," Marks)</b></CENTER>";
echo"<b>Answer any $SecCAtt Question</b><br>";
$query24 = "SELECT Section_C FROM `question_bank`.`java` ORDER BY RAND() limit
$SecCLim";
$result24 =
mysqli_query($conn4,$query24);
if($result24 = $conn4->query($query24))
while ($row24 = $result24->fetch_assoc())
{
$field3name4 =
71
$row24["Section_C"]; echo
"<br>",$i,". ",$field3name4;
$i=$i+1;
}
72
echo "<center><br><br>*********</center>";
}
}
else
{
$host5='localhost';
$username5='root';
$password5='';
$conn5=mysqli_connect($host5,$username5,$password5,"question
_bank"); if(!$conn5){
die('Could not Connect My Sql:' .mysql_error());
}
else
{
echo "<CENTER><b>SECTION A (",$SecAAtt," X ",$SecAMark," =
",$SecAAtt*$SecAM ark," Marks)</b></CENTER>";
echo"<b>Answer any $SecAAtt Question</b><br>";
$query5 = "SELECT Section_A FROM `question_bank`.`question_5` ORDER BY
RAND() l imit $SecALim";
$result5 =
mysqli_query($conn5,$query5);
if($result5 = $conn5->query($query5))
$i = 1;
while ($row5 = $result5->fetch_assoc())
{
$field1name5 =
$row5["Section_A"]; echo
"<br>",$i,". ",$field1name5;
$i=$i+1;
}
}
if(!$conn5){
73
die('Could not Connect My Sql:' .mysql_error());
74
}
else
{
echo "<CENTER><b>SECTION B (",$SecBAtt," X ",$SecBMark," =
",$SecBAtt*$SecBMa rk," Marks)</b></CENTER>";
echo"<b>Answer any $SecBAtt Question</b><br>";
$query15 = "SELECT Section_B FROM `question_bank`.`question_5` ORDER BY
RAND() limit $SecBLim";
$result15 =
mysqli_query($conn5,$query15);
if($result15 = $conn5->query($query15))
while ($row15 = $result15->fetch_assoc())
{
$field2name5 =
$row15["Section_B"]; echo
"<br>",$i,". ",$field2name5;
$i=$i+1;
}
}
if(!$conn5){
die('Could not Connect My Sql:' .mysql_error());
}
else
{
echo "<CENTER><b>SECTION C (",$SecCAtt," X ",$SecCMark," =
",$SecCAtt*$SecCMa rk," Marks)</b></CENTER>";
echo"<b>Answer any $SecCAtt Question</b><br>";
$query25 = "SELECT Section_C FROM `question_bank`.`question_5` ORDER BY
RAND() limit $SecCLim";
$result25 =
mysqli_query($conn5,$query25);
if($result25 = $conn5->query($query25))
75
while ($row25 = $result25->fetch_assoc())
{
$field3name5 = $row25["Section_C"];
76
echo "<br>",$i,". ",$field3name5;
$i=$i+1;
}
echo "<center><br><br>*********</center>";
}
}
?>
Config.PHP
<?php
define('DBSERVER','localhos
t');
define('DBUSERNAME','root')
; define('DBPASSWORD','');
define('DBNAME','question_bank');
// Create connection
$conn = mysqli_connect(DBSERVER, DBUSERNAME ,DBPASSWORD , DBNAME);
// Check
connection if
(!$conn) {
die("Connection failed: " . mysqli_connect_error);
} else {
echo "";
}
?>
77
78
10. PHP mother site @http://php.net/.
11. PHP Manual @ http://php.net/manual/en/.
12. PHP Language Reference @ http://php.net/manual/en/langref.php.
13. MySQL Mother Site @www.mysql.com.
14. MySQL 5.7 "Reference Manual" @http://dev.mysql.com/doc/.
15. MySQL 5.7 "SQL Statement Syntax"
@ http://dev.mysql.com/doc/refman/5.7/en/sql-syntax.html
79
.
80
1