They mean different things. The first is poor English but could mean that the exam took place at some time during the day. The second is good English and means that the exam took the whole day, but it is not fully clear.. does it mean 8 hours or 24 hours?