Both sentences are passive, that is: to be + past participle verb + by or implied by
1.I was surprised by how well the students did in the test.
2.The lady was surprised by what happened to her pet.
Active would be:
I surprised my students by telling a funny story.
That lady surprised me when she came into the store.
To be surprised AT is also passive here. In this case, to be surprised at and by have the same meaning. There would be no difference in meaning. There would also be no difference in terms of a passive having an AGENT, usually with by, not always.
here is an adjectival use of surprised:
The surprised teacher exclaimed, "Why haven't you done your homework?"