you can solve this problem like this
add a HIDDEN control in your HTML:<INPUT type="hidden" id="hid" runat="server">
javascript code is like this:
<script language="jscript">
function myfun()
{
  if(document.Form1.hid.value==0)
  {
    alert("begin exam!");
    xx();
    myvar=1;
  }
}
function xx()
{
  alert("the next function");
}
</script>
when you calculate the score during click the button,change the hid's value
you may use following codes:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        hid.Value = 1
    End Sub