Online Examination

I am doing it in JSP and Ms access .
But am not knowing the idea and logic of generating and picking question randomly from the database.
and also want to know how to implement Clock for exam on page for time limit.

Please help me about the above query and also if possible give me some example related with the same.

Please please help me on this.