So the scherzo starts out in D major, but oddly enough on Mi. Bars 1-8 mark the first phrase, ending on a PAC. The second phrase begins in bar 9 with a clear shift to the key of A major. Here's the thing--I don't know if I would call this a modulation to the dominant, or a simple tonicization of the dominant. Because it lasts for 8 bars, I'll go with the modulation. So there you have it, from bars 9-16 we're in the key of A major and again we end with a PAC.
Bar 17 brings us back to our original key of D major reprising the A section. We're in D major until 24, ending with a PAC. This leads us back to the dominant A major for the next 8 bars...yes, there's a PAC at the end. how did you guess? These 4 phrases form a parallel symmetric period. A (1-8) B (9-16) A (17-24) B (25-32). At the return of A it's not exactly the same material, but the only thing that is different is an added note to the chord. I don't think this is enough change to signify a development of A. Therefore, this entire parallel symmetric period is expository.
Measures 33-48 are a transitional phrase group. The phrases are 4 bars long with a melodic motive in the bass line. This section is suddenly pp and crescendos throughout the transition to a forte, but before returning to the A section descrescendos again to end on a fermata on a half cadence in the key of D major.
Measure 49 brings us to the repeat of the A section, but this time it is being developed a bit more with added notes to the chord. A is played at a piano dynamic and ends on a PAC in measure 56. We again repeat the A section motive, but with a fuller chord, from measures 57 to the end having a cadential extension from measures 65 to the end. We end on a PAC. I really like the deceptive quality of having the minor i chord in measure 64, just when we're expecting a cadence. This leads quite nicely to the cadential extension.