Can 404 pages affect rankings?
404 means page doesn't exist. actually it wont affect the page ranking.
Yes, it affects the keywords only related to that page not for the whole keywords related to site.
Yes it effects the keyword ranking of your webpage that is 404.