As a general rule QGIS always uses the dataset's coordinate system's units (the coordinate system is also referred to as CRS). So if you are not sure what units your CRS is using, or even what CRS has been entered for the dataset, then open the dataset's properties and check out the General tab, which lets you set the CRS.The string you would see indicates the units. In this case, for example, the mm stands for meters, and all your calculations would be returned in meters:
On the other hand you could also open the prj or qpj files (if available; the qpj would only be available if your dataset has been "saved as" from QGIS). Those would indicate the units as well.
The fact that QGIS does not let you choose the units when doing calculations is confusing to many who come from an ArcGIS background, where you can freely choose your output units. Yes, this can be annoying at first, but in the end it makes you more aware of what CRS you are using, which is a good thing!
As for how QGIS internally manages fToolsfTools, I am not sure, but you could look into the source code, it is open source after all! Of course, you would have to knowunderstand some (or a lot of) programming to understand the code. youYou could for example find all of the source code on the QGIS GitHub pageQGIS GitHub page.