On a Mac the pair is Q to quit an app and W to close a window. The difference matters more than on Windows, because closing the last window does not quit the app: it stays running, with a dot under its icon in the Dock, ready to open a new window instantly.

Alt+F4 itself does nothing. On a MacBook keyboard, F4 opens Spotlight or Launchpad depending on the model, and ⌥F4 is not bound to anything.

When an app stops responding, ⌘Q may not work. Esc opens the Force Quit window, the Mac's Ctrl+Alt+Del, where you can end it.