In my opinion this is what should happen
If the category already exists in the course we are restoring to, we restore to that category.
Otherwise, if the category exists in another course, that other category is a published category, and if we have permission to restore questions into that other course, then we restore to that category.
Otherwise, we create a new category in the current course, using the category name, etc. from the backup file, ask to the user if this new category will be published and restore to that.
It does a similar version stamp comparison when restoring each question.
so if the date or version of a cuestion is older than the actual question we should inform the user about that and ask to the user for a confirmation ginvin the option of repeat the answer for al the questions in the same state
So this all works as it should except that, if you restore a quiz to the same server, using question from a published category that you don't have the rights to restore to, then you will get a copy of the question.
if the version of the question in that category is diferent from the question in the backup we should inform the user about that and ask to the user if he/she want to get that question or create a local version of the question with the one in the backup