Examination Apps in JavaScript with Source Code

Examination Apps in JavaScript with Source Code

This Examination Apps in JavaScript Project is a simple project designed in JavaScript language using HTML and CSS platform. This is a simple examination program in JavaScript using multidimensional array, this is just a CBT computer-based test, but it is a prototype.

A simple mini project for Examination Apps in JavaScript is complete and totally error free and  also includes a downloadable Source Code for free, just find the downloadable source code below and click to start downloading. Before you start to click the download now first you must click the Run Quick Scan for secure Download. 

I have here a suggested list of Best JavaScript Projects with Source Code Free to download and I’m sure this can help you to improve your skills in JavaScript programming and web development as a whole.

Anyway if you want level up your knowledge in programming especially JavaScript Programming, try this new article I’ve made for you Best JavaScript Projects With Source Code For Beginners 2021.

To start creating a Examination Apps in JavaScript with Source Code, make sure that you have any platform in creating a JavaScriptbootstrap, and HTML installed in your computer, in my case I will use Sublime Text.

Examination Apps in JavaScript Steps on How to Create a Project

Time needed: 5 minutes

Here’s the Steps on How to Create a Examination Application in JavaScript with Source Code

  • Step 1: Open Sublime Text.

    First, installing sublime text IDE, click “open” to start.
    Examination Application in JavaScript with Source Code

  • Step 2: Create a HTML file.

    Next, click “file” and select “save as” and named it “index.html“.

  • Step 3: Create a JavaScript file.

    Last, click “file” and select “save as” and named it “script.js“.

  • Step 4: The actual code.

    Finally, You are free to copy the code given below and paste to your different file created.

Code for the index.html in Examination Apps in JavaScript

In the code given below, which is the code contains the interface of the application. This code will show the form that will be use in html.

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Itsourcecode Examination Application</title>
<style type="text/css">
div#test{ border:#000 1px solid; padding:10px 40px 40px 40px; width:640px; margin:auto; border-radius:12px; background-color: blue; color: white;}
</style>
<center><h1 style="background-color: blue; color: white;">CHMSC Examination Apps System</h1></center>
<script language="javascript" type="text/javascript" src="script.js"></script>


</head>
<body>
	 <h2 id="test_status" style="text-align:center;"></h2>
	 <div id="test"></div>
</body>
</html>

Code for the script.js in Examination Apps in JavaScript

In the code given below, which is the code contains the interface function of the application. This code will show the function of the form that will be use in html.

var pos = 0, test, test_status, questions,  choice, choices, chA, chB, chC, correct = 0; 
	var questions = [
		["Who created python flask?", "Armin Ronacher", "Jude Suares", "Adrian Mercurio", "A" ],
		["Who created javascript?", "Brendan Eich", "Kimmy Matillano", "Saxon Ong", "A"],
		["Who created java?", "James Gosling", "Princely Ceasar", "July King Kadayuna", "A"],
		["Who created c# language?", "Microsoft Corporation", "Google Company", "You Tube Corporation", "A"],
		["Who created php?", "Rasmus Lerdorf", "Grace Patulada", "Nikko Curaza", "A"],
		["Who created itsourcecode.com?", "Charlotte Villanueva", "Joken Villanueva", "Niko Embang", "B"],
		["Who created laravel?", "Boknoi Villaflor", "Taylor Otwell", "Ryan Manaay", "B"],
		["Who created database?", "Edgar Frank Codd", "Paul Niar", "Given Bariacto", "A"],
		["Who created c++ language?", "Kirk Eriman", "Bjarne Stroustrup", "Jomhel Dulla", "B"],	
		["Who created c language?", "Dennis Ritchie", "Daniel Bandiola", "Carlan Pellobello", "A"]
	];
	function _(x){
		return document.getElementById(x);
	}
	function renderQuestion(){
		test = _("test");
		if(pos >= questions.length){
			test.innerHTML = "<h3>You got "+correct+" of "+questions.length+" questions correct</h3>";
			_("test_status").innerHTML = "Exam Completed";
			pos = 0;
			correct =0;
			return false;
		}
		_("test_status").innerHTML = "Question "+(pos+1)+" of "+questions.length;
		question = questions[pos][0];
		chA = questions[pos][1];
		chB = questions[pos][2];
		chC = questions[pos][3];
		
		
		test.innerHTML = "<h3>"+question+"</h3>";
		test.innerHTML += "<input type='radio' name='choices' value='A'> "+chA+"<br>";
		test.innerHTML += "<input type='radio' name='choices' value='B'> "+chB+"<br>";
		test.innerHTML += "<input type='radio' name='choices' value='C'> "+chC+"<br><br>";

		test.innerHTML += "<button onclick='checkAnswer()'>Submit Answer</button>";	
	}
	function checkAnswer(){
		choices = document.getElementsByName("choices");
		for(var i=0; i<choices.length; i++){
			if(choices[i].checked){
				choice = choices[i].value;
			}
		}
		if (choice == questions[pos][4]){
			correct++;
		}
		pos++;
		renderQuestion();
	}
	window.addEventListener("load", renderQuestion, false);
ABOUT PROJECTPROJECT DETAILS
Project Name :Examination Apps in JavaScript
Project Platform :JavaScript
Programming Language Used:php,javascript,html,css
Developer Name :itsourcecode.com
IDE Tool (Recommended):Sublime
Project Type :Web Application
Database:None
Upload Date:February 26, 2021

Downloadable Source Code

Summary

In summary, this 2022 Examination Apps in JavaScript with Source Code can be useful to students or professional who wants to learn web development using JavaScript programming language and it is used html and css platform. This project can also be modified to fit your personal requirements. Hope this project will help you to improve your skills. Happy coding!

Inquiries

If you have any questions or suggestions about Examination Apps in JavaScript with Source Code, please feel free to leave a comment below.

Leave a Comment