ASP.Net
For this exercise, Create a short online quiz. Make sure the quiz has at least 3 questions and that each question has at least 3 possible answers. After the questions there should be a button web control that will display the users score. The correct answer should be shown for the ones the user get incorrect.
This needs to be done on visual studio using visual basic programming
HTML SOURCE CODE FOR VS.NET
<%@ Page Language="vb" AutoEventWireup="false"
CodeBehind="TestPage.aspx.vb" Inherits="WebApplication7.TestPage"
%>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<table style="width:100%;"> <tr> <td
colspan="2">QUIZ TEST </td>
</tr>
<tr>
<td colspan="2">
<asp:Label ID="LBq1" runat="server"
Text="Label"></asp:Label>
</td>
</tr>
<tr>
<td> <asp:RadioButton ID="option1" GroupName="option"
runat="server" /></td> <td>
</td>
</tr>
<tr>
<td>
<asp:RadioButton ID="option2" GroupName="option" runat="server"
/></td> <td> </td>
</tr>
<tr>
<td> <asp:RadioButton ID="option3" GroupName="option"
runat="server" /></td>
<td> </td>
</tr>
<tr>
<td><asp:Button ID="btnNext" runat="server" Text=" Next "
/> <asp:HiddenField ID="hdnQNo" runat="server" />
</td>
<td> </td>
</tr> </table>
<div id="divScore" runat="server"> </div>
</form>
</body>
</html>
VB CODE
Public Class TestPage
Inherits System.Web.UI.Page
Dim qList(4, 4) As String '' STORES QUESTION WITH POSSIBLE
ANSWER , MAXIMUM 3 QUESTION
Dim qAnswer(3, 2) As String '' STORES ACTUAL ANSWERS TO
QUESTIONS
Dim userResp(3) As String '' STORES WHAT USER HAVE GIVEN
RESPONSE
Dim qPosition As Integer '' CURRENT SL NO OF QUESTION
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
If Not IsPostBack Then
setQuestion() '' INITIALIZE THE QUESTION
'' AS ASP.NET IS STATELESS WE ARE USING VIEWSTATE TO STORE SOME
DATA
ViewState("score") = 0 '' STORE A BINARY VALUE TO JUST DETECT
WHETHER TO GET RESULT OR NOT
ViewState("userResp") = userResp '' STORE USER RESPONSE/ANSWERS
hdnQNo.Value = 0 '' FIRST QUESTION INDEX IS 0 , hdnQNo IS HIDDEN
FIELD
showQuestion() ' SHOW THE QUESTION
End If
End Sub
'' SET OF QUESTINS AND POSSIBLE ANSWERS INITIALIZED TO ARRAY AND
CORRECT ANSWER ALSO
Public Sub setQuestion()
'' SET QUESTION IN 2D ARRAY
'FIFRST QUESTION
qList(0, 0) = "size of int in java?"
qList(0, 1) = "1" '' PROBABLE ANSWER 1
qList(0, 2) = "2" '' PROBABLE ANSWER 2
qList(0, 3) = "4"
''SECOND QUESTION
qList(1, 0) = "Which of these classes is not included in
java.lang?"
qList(1, 1) = "Byte"
qList(1, 2) = "Integer"
qList(1, 3) = "Array"
qList(2, 0) = "Which of these is a super class of wrappers
Double & Integer?"
qList(2, 1) = "Number"
qList(2, 2) = "Digits"
qList(2, 3) = "Float"
'' ACTUAL ANSWER TO THE QUESTIONS
qAnswer(0, 0) = "size of int in java?"
qAnswer(0, 1) = "4"
qAnswer(1, 0) = "Which of these classes is not included in
java.lang?"
qAnswer(1, 1) = "Array"
qAnswer(2, 0) = "Which of these is a super class of wrappers
Double & Integer?"
qAnswer(2, 1) = "Number"
End Sub
Public Sub showQuestion()
'' IF ViewState("score") TURNS 1 THEN SHOW RESULT , INITIALY IT
IS 0
If Val(ViewState("score").ToString) = 1 Then
showResult()
End If
If hdnQNo.Value >= 3 Then
ViewState("score") = 1 '' AFTER VISTING ALL QUESTION
ViewState("score") BECOMES 1
btnNext.Text = " Display Score " '' BUTTON CAPTION CHANGES
Else
'' BEFORE LOADING QUESTION PRESENT RESPONSE CLEARED
option1.Checked = False
option2.Checked = False
option3.Checked = False
'' QUESTION ARE NOT SAVED IN STATE , THAT IS WHAY WE ARE
INITIALIZED AT EACH BUTTON CLICK
setQuestion()
'' SHOW QUESTION DETAILS
LBq1.Text = hdnQNo.Value + 1 & ": " & qList(hdnQNo.Value,
0) '' SHOW QUESTION BY THE SL POSTION FROM THE ARRAY
option1.Text = qList(hdnQNo.Value, 1)
option2.Text = qList(hdnQNo.Value, 2)
option3.Text = qList(hdnQNo.Value, 3)
End If
End Sub
Public Sub saveResp()
Dim ans As String = ""
''RETRIEVE PREV VALUE FROM STATE
userResp = ViewState("userResp")
'' GETS THE ANWSER BY USER
If option1.Checked = True Then
ans = option1.Text
ElseIf option2.Checked = True Then
ans = option2.Text
ElseIf option3.Checked = True Then
ans = option3.Text
End If
'' STORE RESPONSE TO ANSWER ARRAY INDEX
userResp(hdnQNo.Value) = ans
'' SAVED BACK TO STATE FOR FUTURE USE
ViewState("userResp") = userResp
End Sub
Protected Sub btnNext_Click(sender As Object, e As EventArgs)
Handles btnNext.Click
'' SAVE THE CURRENT RESPONSE.
saveResp()
'' SL NO INCREMENT AND NEW QUESTION COME
hdnQNo.Value = hdnQNo.Value + 1
showQuestion()
End Sub
Public Sub showResult()
Dim result As Integer = 0
''AGAIN LAODING QUESTION SET
setQuestion()
Dim tab As String = "" '' DISPLAYING DATA IN HTML TABLE
FORMAT
userResp = ViewState("userResp")
tab = tab & "<tr> <td colspan=2> Incorrect
Response </td> </tr>"
tab = tab & "<tr><td> Question </td>
<td> Actual Answer </td></tr>"
''ITERATE THROUGH USER RESPONSE
For i As Integer = 0 To 3
If userResp(i) = qAnswer(i, 1) Then
result = result + 1 '' INCREMENT FOR CORRECT RESPONSE
Else
tab = tab & "<tr><td> " & qAnswer(i, 0) & "
</td> <td> " & qAnswer(i, 1) & "
</td></tr>"
End If
Next
If result = 3 Then ''' IF SCORE IS 3 THEN ONLY DISPLAY IT
tab = "<table border=1><tr><td> <b> SCORE
</b> </td> <td> : <b>" & result & "
</b> </td></tr>"
Else '' ELSE DISPLAY SCORE ALONG WITH INCORRECT ANSWER WITH CORRECT
ONE
tab = "<table border=1><tr><td> <b> SCORE
</b> </td> <td> : <b>" & result & "
</b> </td></tr>" & tab
End If
tab = tab & "</table>"
'' LOAD THE COADED TABLE TO DIV , divScore IS DIVISION TAG
divScore.InnerHtml = tab
End Sub
End Class
SCREEN SHOT OF CODE
OUTPUT SCREENSHOT
ASP.Net For this exercise, Create a short online quiz. Make sure the quiz has at least...
Create a folder named "TrainerApp". In that folder create the following files. Create a PHP file, "insert-user-form.php", with a form that has the following fields: - First Name (text) - Last Name (text) - Email (text) - Password (text) - Submit button Create another PHP file, "insert-exercise-form.php" with a form that has the following fields: - Exercise Name (text) - Description (text) - Demonstration Image (file) - Submit button Create another PHP file, "login-user-form.php" with a form that has the...
Visual Basic zoow Driver's License Exam The local Registry of Motor Vehicles oflice has asked you to create an application that grades the written portion of the driver's license exam. The exam has 20 multiplc choice questions. Her ar the orrect answers to the questions: 6. A 7.13 8. A 9. C 10. D 16. С 12. C 13. D 14. A 15. D 2. D 3. A 5, C Your application should slore the correcl answers in an array....
see below: You will be creating a personal quiz that will provide a grade depending on the responses given. The quiz should contain at least three questions of the true/false or multiple-choice nature. You should select only one type of question to use. These questions should originate from Comprehension Check in your textbook (noting the chapter and page number) These questions and the correct answer identifier should be stored in a text file. A second table should contain the possible...
The questions below deal with Microsoft Visual Studio 2012 Reloaded, under the Visual Basic programming language. The book ISBN number that I am using is: 978-1-285-08416-9 or the UPC code is: 2-901285084168-1. Question 1 Visual Basic 2012 is an object-oriented programming language, which is a language that allows the programmer to use ____________________ to accomplish a program�s goal. Question 2 An application that has a Web user interface and runs on a server is called a(n) ____________________ application. Question 3...
Purpose of the assignment To apply simple JavaScript concepts to create a Fahrenheit to Celsius (and Celsius to Fahrenheit) conversion program. I need both please! What’s required of you. Having looked at some basic examples of JavaScript on http://www.w3schools.com and at the “simple math with forms/inputs and validation” example in detail , I would like you to now apply those concepts to create a simple page that lets users type in some temperature value in the Fahrenheit/Celsius scale and when...
Create a webpage (the last picture has three potential offers not just 2). Use html, JavaScript and CSS where needed. All information needed is supplied by the picture. Summary Create a dynamic web page that allows users to compare different financing offers for an automobile loan. Purchasers are often presented with different financing offers, and determining the best offer can be difficult. In particular, dealers often have promotions that offer either a lower interest rate or a cash incentive (sometimes...
Can you solve this proble by using C# application? C# is one of programming languages supported by Visual Studio 2015. It combines the features of Java and C ++ and is suitbale for rapid application development. A retail company must file a monthly sales tax report listing the total sales for the month, and the amount of state and county sales tax collected. The state sales tax rate is 4% and the county sales tax rate is 2%. Create an...
Multiple Choice will be done online in D2L Quiz - don't forgel! Short answers and problems. In the space provided, answer the following questions. Be sure to show any comptations. If a statement is to be prepared, it should be prepared in good form. Point values are shown for each question 1. (11 points total) Lattice Company sells product to customers on open account. They use the allowance method and determine the balance required in the allowance for doubtful accounts...
Please Read it all and carefully In visual basic(vba)do the following program Summary INGE Industry, Inc. needs a program in which the date and temperature in Celsius degrees of an industry laboratory are recorded and stored in a sequential file. In addition, you can see the recorded data and convert the temperatures in the following units: Fahrenheit, Kelvin and Rankine. In addition, they want to see a linear graph that reflects how the temperature has fluctuated day by day, for...