Yes, a squawk is a transponder code.
There are flight procedures published which cover pretty much every situation. The trouble is that loss of comms is not usually a simple, black or white situation - comms involves at least two parties and they will become aware of the loss at different times and often there are degrees of degraded comms. Nonetheless, in a well developed and 'mature' environment there are plenty of ways that comms failure can be handled.