When I did Search and Rescue with my golden long ago, he definitely knew the difference between a training exercise and a real search. There was a lot of excitement, happiness, and silliness for training, but a real search was serious business. He’d come out of the truck ready to go to work, and would get quite impatient if there was a delay.
I found the same thing with our service dogs. They KNOW that they have a job to do and act accordingly. The example that really drove this home to me was a lab / Great Dane cross that we were training for balance / support work. He was a goofball in heel position when I would take him out for training. When we paired him with his partner, within 2 weeks he was walking carefully with each step at a slow pace that I never thought he would be able to maintain. But he knew his partner counted on him!