I don't have the test so you may have to clear some things up for me. If A is offside, I'm assuming it's a free kick. If so, accepting any live ball foul cancels the illegal touching privilege (6-1-3-c). Team B can either enforce the penalty at the previous spot, enforce the penalty at the dead ball spot if the ball belongs to Team B (6-1-8), or they can take the ball at the spot of illegal touching.