I changed my javascript function call to this
<a href="JavaScript:selectProgram(id[<%= i%>] = new Array('<%= childBean.getStudentId()%>'),
grp[<%= i%>] = new Array('<%= childBean.getGroupId()%>'),
sname[<%= i%>]= new Array('<%= childBean.getName()%>

'
);"
Now it dispalys complete value like this
ID =7
GRP = SOCKER
NAME = Phil
But still it displays the last element in an array.