public int saveQuiz(ArrayList<Question> quiz){
		try{
			Class.forName(classname);
		    connect = DriverManager.getConnection(url,un,pwd);  
		    st = connect.createStatement();
		    int quizid=0;
		    if(quiz==null ||(quiz!=null && quiz.isEmpty())){
		    	st.close();
		    	return -1;
		    }
		    Question q = quiz.get(0);
		    st.executeUpdate("insert into quiz(qid,weight) values ("+q.getQid()+","+q.getWeight()+"); ");
		    ResultSet rs = st.executeQuery("select quiz_id from quiz ORDER BY quiz_id DESC LIMIT 1; ");
		    if(rs.next()){
		    	quizid = rs.getInt(1);
		    }
		    quiz.remove(q);
		    int i=0;
		    for(Question qs : quiz){
		    	i = st.executeUpdate("insert into quiz values ("+quizid+","+qs.getQid()+","+qs.getWeight()+"); ");
		    }
		    st.close();
		    if(i==1)
		    	return quizid;
		    return -1;
		}
		catch(Exception e){
			System.out.println("error in saveQuiz ");
			e.printStackTrace();
		}
		finally{
			if(connect!=null){
				try {
					connect.close();
				} catch (Exception e) {
					System.out.println("Error during connection closing in saveQuiz");
				}
			}
		}
		return -1;
	}