I plead ignorance in regards to the diving suit.
Looks like it though.
Frederik got his nickname Pingu/Pingo because there was a hole in his suit and it was half filled with water, making him waddle along like a penguin.
He was named after this endearing guy:
The cap is a graduation cap. In DK called a studenterhue = student-cap
It has been around and used by graduating students since 1850 or so.
Tradition dictates that you wear it during the summer after you have graduated.
Today variations of that cap is used not only by high school students but also students who have graduated from technical schools, profession schools and what not. It depends on the color.
The high school cap is deep red, like this one: