ja5


  1. Write a Java Program to create the hash table that will maintain the mobile number and
    student name. Display the details of student using Enumeration interface. [15 M]
    import java.util.*;

public class StudentHashTable {
public static void main(String[] args) {
Hashtable<String, String> studentTable = new Hashtable<>();
studentTable.put("1234567890", "John");
studentTable.put("9876543210", "Alice");
studentTable.put("4567890123", "Bob");

    Enumeration<String> mobileNumbers = studentTable.keys();
    while (mobileNumbers.hasMoreElements()) {
        String mobileNumber = mobileNumbers.nextElement();
        String studentName = studentTable.get(mobileNumber);
        System.out.println("Mobile Number: " + mobileNumber + ", Student Name: " + studentName);
    }
}

}

  1. Create a JSP page for an online multiple choice test. The questions are randomly selected
    from a database and displayed on the screen. The choices are displayed using radio
    buttons. When the user clicks on next, the next question is displayed. When the user
    clicks on submit, display the total score on the screen.
    <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Online Multiple Choice Test</title> </head> <body> <form action="submitTest.jsp" method="post"> <% // Logic to retrieve questions and choices from the database String[] questions = {"Question 1", "Question 2", "Question 3"}; String[][] choices = { {"Option A1", "Option B1", "Option C1"}, {"Option A2", "Option B2", "Option C2"}, {"Option A3", "Option B3", "Option C3"} };
        // Display questions and choices using radio buttons
        for (int i = 0; i < questions.length; i++) {
            out.println("<p>" + questions[i] + "</p>");
            for (int j = 0; j < choices[i].length; j++) {
                out.println("<input type='radio' name='answer" + i + "' value='" + choices[i][j] + "'> " + choices[i][j] + "<br>");
            }
        }
    %>
    <input type="submit" value="Submit">
</form>
</body> </html>