"I had a test yesterday."
Translation:Ich hatte gestern eine Prüfung.
yes, that'd be wrong because the time element "Gestern" needs to be next to the verb "habe"
Not a rule; merely a tendency. "Eine Prüfung gestern" is fine but sounds kind of odd unless you really want to emphasize "gestern."
"Gestern habe ich eine Prüfung gehabt" was my answer and it was an accepted solution.
Although there are free resources online, I firmly believe that this course should have a lesson on 'Word Order'.
It is something I would say (that doesn't mean it's right :) ). Which section of Duo is this? Were they looking for use of a certain tense? For example, if this is in the past tense section, they might not accept the use of present perfect to express past. Maybe?
See here: http://en.wikibooks.org/wiki/German/Grammar/Sentences#Time "Ich hatte eine Prüfung gestern" is grammatically possible but sounds a bit unnatural. I'm not sure whether to call it "not idiomatic" or not. I guess you'll hear it sometimes from German speakers but to my ears it still sounds a bit flawed. Better put the 'gestern' at the beginning: 'Gestern hatte ich eine Prüfung'.
because the time element in a sentence should generally be right next to the verb, either right before or right after
I wrote "Ich hat gestern eine Prüfung geschrieben" based on another lesson and that is apparently wrong. Could somebody comment
You just used the wrong form of 'haben'. "Ich habe gestern eine Prüfung geschrieben" is what you would need to have written.