<%@ page language="java" import="java.util.*" session="true"%> Vocabulary Proficiency Test <% String studentname=""; boolean reset=false; try { String SS=(request.getParameterValues("reset")[0]).trim(); if (SS!=null && SS.equals("1")) reset=true; } catch (Exception e111) {} if (reset) { session.putValue("voc_answered",new int[14]); session.putValue("voc_count","0"); } try { studentname=(request.getParameterValues("studentname")[0]).trim(); if (studentname==null) studentname=""; } catch (Exception ee) { studentname=""; } String [] question=null; if (question==null) { question=new String [14]; question[0]="Delete the word that doesn't belong."; question[1]="One of these shouldn't be here!"; question[2]="Hmm. There's a problem here."; question[3]="Which word doesn't belong?"; question[4]="Okay. Which word is it?"; question[5]="Which word should be taken out?"; question[6]="Find the word that is different from the rest."; question[7]="Find the word that doesn't belong."; question[8]="Hmm. One of these looks strange."; question[9]="Oh. Which word does not belong?"; question[10]="Which one should we delete?"; question[11]="Which word is different from the others?"; question[12]="Hmm. Select the word that is different."; question[13]="Give me a question!"; session.putValue("vocabulary_question",question); } Vector voc_ans=new Vector(); String [] temp=new String[5]; temp[0]="nude"; temp[1]="bare"; temp[2]="undressed"; temp[3]="contrary"; temp[4]="naked"; voc_ans.addElement(temp); temp=new String[5]; temp[0]="believe"; temp[1]="primary"; temp[2]="assume"; temp[3]="presume"; temp[4]="suppose"; voc_ans.addElement(temp); temp=new String[5]; temp[0]="smooth"; temp[1]="silly"; temp[2]="ridiculous"; temp[3]="foolish"; temp[4]="absurd"; voc_ans.addElement(temp); temp=new String[5]; temp[0]="wonderful"; temp[1]="great"; temp[2]="amazing"; temp[3]="marvelous"; temp[4]="uncertain"; voc_ans.addElement(temp); temp=new String[5]; temp[0]="fragment"; temp[1]="piece"; temp[2]="fearful"; temp[3]="splinter"; temp[4]="chip"; voc_ans.addElement(temp); temp=new String[5]; temp[0]="destroy"; temp[1]="spoil"; temp[2]="decent"; temp[3]="wreck"; temp[4]="ruin"; voc_ans.addElement(temp); temp=new String[5]; temp[0]="charge"; temp[1]="make"; temp[2]="create"; temp[3]="manufacture"; temp[4]="produce"; voc_ans.addElement(temp); temp=new String[5]; temp[0]="edge"; temp[1]="boundary"; temp[2]="ignore"; temp[3]="border"; temp[4]="margin"; voc_ans.addElement(temp); temp=new String[5]; temp[0]="disaster"; temp[1]="calamity"; temp[2]="doubt"; temp[3]="catastrophe"; temp[4]="tragedy"; voc_ans.addElement(temp); temp=new String[5]; temp[0]="tender"; temp[1]="supply"; temp[2]="mild"; temp[3]="soft"; temp[4]="gentle"; voc_ans.addElement(temp); temp=new String[5]; temp[0]="announce"; temp[1]="declare"; temp[2]="chastise"; temp[3]="proclaim"; temp[4]="publish"; voc_ans.addElement(temp); temp=new String[5]; temp[0]="hinder"; temp[1]="obstruct"; temp[2]="precious"; temp[3]="halt"; temp[4]="prevent"; voc_ans.addElement(temp); temp=new String[5]; temp[0]="origin"; temp[1]="soaked"; temp[2]="drenched"; temp[3]="wet"; temp[4]="soggy"; voc_ans.addElement(temp); temp=new String[5]; temp[0]="various"; temp[1]="organize"; temp[2]="control"; temp[3]="manage"; temp[4]="direct"; voc_ans.addElement(temp); session.putValue("voc_ans",voc_ans); String count="0"; count=(String)session.getValue("voc_count"); boolean finished=false; if (count==null || reset==true) { count="0"; } Random r=new Random(); int [] voc_question=new int [5]; int [] voc_answered=new int [14]; voc_answered=(int []) session.getValue("voc_answered"); if (voc_answered==null || reset==true) { voc_answered=new int [14]; count="0"; } int index=0; try { index=Integer.parseInt(count); } catch (Exception e1) { index=0; } int ran=0; int ran1=0; int rr=0; int i=0; int []tmp =new int[4]; if (index==10) { while (i<4) { ran=r.nextInt(14); if (voc_answered[ran]==0) { voc_question[i]=ran; voc_answered[ran]=2; i++; } } boolean b=false; while (!b) { ran1=r.nextInt(14); boolean done=true; for (int k=0;k<4;k++) { if (voc_question[k]==ran1) done=false; } if (done) { voc_question[4]=ran1; b=true; } } } else { if (index==0) { voc_answered=new int[14]; } if (index==15) { finished=true; } else { i=0; while (i<5) { rr=r.nextInt(14); if (voc_answered[rr]==0) { voc_question[i]=rr; voc_answered[rr]=2; i++; } } } } int [] voc_q_display=new int [5]; for (int ii=00;ii<5;ii++) { int ra=r.nextInt(14); voc_q_display[ii]=ra; } session.putValue("voc_answered",voc_answered); %>
Vocabulary Proficiency Test
<% if (!finished) { String voc_q=voc_question[0]+"-"+voc_question[1]+"-"+voc_question[2]+"-"+voc_question[3]+"-"+voc_question[4]; %>
<% for (int a=0;a<5;a++) { String q=question[voc_q_display[a]]; temp=(String [])voc_ans.elementAt(voc_question[a]); String fieldname="question"+a; %> <% } %>
 
Please enter your name:
 
Quiz Questions:
 
<%=(a+1)%>. <%=q%> value="<%=q%>">
  value="<%=temp[0]%>"> <%=temp[0]%>
  value="<%=temp[1]%>"> <%=temp[1]%>
  value="<%=temp[2]%>"> <%=temp[2]%>
  value="<%=temp[3]%>"> <%=temp[3]%>
  value="<%=temp[4]%>"> <%=temp[4]%>
 
>
<% } else { %>
 


Congratulations! <%=studentname%> , you have finished all vocabulary tests.


<% } %>