Gratuitous means "without cause" or "unnecessary." Telling ridiculous jokes at a somber occasion would be a display of gratuitous humor.
Gratuitous can be used to refer to something that’s unnecessary and mildly annoying. If a friend frequently gives you fashion tips, even though you’ve expressed no interest in receiving them, you’d be correct in labeling her advice as gratuitous. In addition, gratuitous can be used to indicate that something is not only unnecessary but also inappropriate. Some people claim that some films and video games contain gratuitous violence — that is, violence that is excessive and offensive.