I made a cake yesterday
Negative: I did not make a cake yesterday
As the sentence is in past tense so we used. did not+V1 to change it into negative.
Interrogative: Did I make a cake yesterday?
In past tense , "Did" is used to change a sentence into an interrogation.