In websites like YouTube one is able to choose between this or that resolution for the same video. Is each resolution of that video stored as a separate file? I mean, is there a file stored in the website's server for the 720p version of the video, another for the 480p, another for the 360p...? If not, how is one able to offer different resolutions for the same video? Sorry if this isn't the right place to ask.
Yes they are but there may be fewer resolutions than the interface is showing. You typically store a video at several resolutions for users of different bandwidths.
A playkback interface such as the YouTube video player typically offers you some choices of sizes but you can also embed it at custom resolutions. The server the selects the file which is the size of your player or larger. For this reason, sometimes when you change resolution in the middle of playback, the file gets rebuffered and others it just continues without a hiccup. In the former case, the server has to stream a higher-resolution file. In the latter, the file being played had enough resolution.