Not sure what is going on here. Yes this is the brand new kitchen cabinet over the brand new kitchen sink in the brand new kitchen of a brand new house! Yes, to answer your next question, you have seen this house many times recently! This is a new construction inspection, one of the most instructive ever!
Now, there are various ways to find a stud in the wall, even behind a kitchen cabinet. While it might not be possible through the cabinet, a stud finder can be employed on the wall above and below it!
Personally I would NOT suggest finding the nail with a nail gun. And, if I was so, um, creative in using my nail gun in this way, I would NOT leave the nails and their holes so visible inside the cabinet. If you feel so compelled to use a nail gun, maybe you could also use a little putty?
Happily, I was impressed to see they used proper screws and rims to secure the cabinet to the wall! So I am guessing that this, um, method of creative nail gun use was not to hang the cabinet on the wall.
Maybe they used the nail gun to secure the kitchen vent tubing inside the wall RIGHT BEHIND THIS CABINET?
No, I am NOT kidding!*
My recommendation: it is surprising to open kitchen cabinet doors sometimes on new construction inspections and see what is to be seen. But I always do. And if you are walking through your brand new house for the final walk through with your builder, you will want to do that too...
* You might also think I somehow stage all this stuff! No, no I don't.