Here is the sentence:
Emma Sue was delighted when Mr. Nguyen returned her perfect calculus test
with an ear-to-ear grin.
Very impressive! You recognized that too many words separate the modifier from its target. With an ear-to-ear grin, a prepositional phrase, is describing test when its target should be Mr. Nguyen.
To fix the problem, you should organize the sentence like this: With an ear-to-ear grin, Mr. Nguyen returned the perfect calculus test, which delighted Emma Sue.