This is one of the strengths of deterministic parsing. There is unique parse tree that is generated by the parse table for a LL or LR grammar regardless whether that word is accepted or not. The exam problem you are considering is asking for that derivation/parse tree, and the final result whether it was accepting or not.