The answer to this question is basically a combination of a few concepts:
Google often doesn't rank sites based on exact keywords but based on concepts derived from latent semantic analysis. So for the purposes of determining page topic, the latent semantic analysis algorithm will treat the phrases "HTML Exercises", "HTML Quiz", etc. as highly related concepts with a small conceptual distance between them. They have a lot of conceptual overlap.
Google ranks and categorizes pages based on off-site information just as much as on-site information. The topics of all the sites that link to your site, and the link anchor text, are just as important as the topic your site is actually about.
The higher a page's "seo juice" (formerly Page Rank), the more likely it is to be recommended for search intents that are more loosely related. That's how you get SEO behemoths like W3Schools outranking other pages that have exact matches for the search terms. The way to improve this is through good old fashioned SEO, covered by the answers here.
In short, Google ranks pages based on LSA of the page itself and the anchor text of incoming links. It doesn't only use the page itself, and it doesn't always care about exact keywords because a lot of the algorithm runs on LSA. To improve SEO from this standpoint, don't overly worry about exact match keywords (though they certainly do have a place), and above all make sure you're being linked to as much as possible from related, high-authority sites.
HTML Challenge
, where "Challenge" does not appear on the page at all in the returned result. However, w3schools would appear to be highly optimized forHTML Quiz
(just as much asHTML Exercises
) andQuestion
appears on theHTML Quiz
page, which is the page returned in the SERPs.