Yeah, it was clearly a punishment assignment.
So while Scotty's being punished for beaming Porthos into oblivion, why was Keenser there? What had he done that required punishment?
As an aside I'm certain in the real world Lt ranks are given after graduation in certain circumstances, I was actually offered this when applying to the UK Navy for engineering.
How much education a person has can influence what rank they star off as. My mother claimed that due to her university credits, she could have started off as a Captain (as in O-3 Captain) if she had joined the Army in her younger days.