It's very similar to the code you used before, except now the function qa_question_create(...) takes an extra parameter at the end, which is the categoryid that you want (or null for none). You can find the categoryid for each category by examining the qa_categories table in your database.