Is query executed when mysql server has gone away? How can I be sure that a query was not executed?

For example, I try to execute  

update `table` set `a`='b' 


and got the error 2006 server has gone away
Don't run the SQL statement :-)

If you want the mysql client to stop you running it, there is a --safe-updates aka --i-am-a-dummy option.

If you want the server to rollback, use innodb tables that provide transactional support.

For the error see gone away.