Hi Annika,
One way to do this could be to have two duplicate versions of the test yourself quiz on the course page, and use restrict access so that each one is only visible to one of two audiences.
You could then change the course completion requirements so that the user either needs to complete Test yourself quiz (Audience A) or Formal Assessment (Audience B).
You could also restrict access of Formal Assessment (Audience B) until the user had completed Test yourself quiz (Audience B).
If you use this option, I'd recommend you draw from a question bank for the duplicated quiz, so that you don't need to edit two quizzes if you want to tweak a question in the future.