In that case, add an 's to the noun that comes before the pronoun.
You don't have to add an 's to the pronoun my because it is already possessive without the apostrophe.
Bill's and my cat ate dog food.
The car is Elizabeth's and mine.
Today is Jeremy, Catherine's, and my last day of school.
ANSWER --> a) Mary and John's dog dug up my garden.
Since this dog belongs to both Mary and John, the apostrophe goes only after the noun John.
ANSWER --> b) Dan's and my cat chased their dog.
Since this has a noun and a possessive personal pronoun, the noun Dan needs to have an 's. The possessive personal pronoun my doesn't need an 's because it is already possessive.
If you want to teach or learn grammar the easy way, then follow a step-by-step program that clearly lays everything out for you and allows you to move at your own pace. The Get Smart program is presented in a logical sequence, so it's not an overwhelming mishmash of information. Before you know it, you'll be a grammar and sentence diagramming pro!