The approaching exam loomed large in her mind.

Literal

Immediate [at-に] pressing exam [poss-の] matter [subj-が] her [poss-の] heart [at-に] greatly spread.

目前に迫った ('pressing close before one's eyes') is a vivid compound modifier. 迫る ('press close, approach') conveys urgency. ~のことが expands the topic beyond the bare noun — 'the matter of the exam.' 心に広がった ('spread in the heart') is a literary metaphor for anxiety filling one's mind.