Depends on a book type I suppose. Most have "index" section, which is just a list of tags. In recipe books I find it more useful than ToC actually.
I think it depends on your goal. If I want to browse new chicken recipes, I am going to open the table of contents, find the section on poultry and start flipping through recipes. On the other hand, if I want to cook a chicken curry, I am going to go to the index and look up curry, then find the relevant page.
Folders are great for when you don't know what you want and just want to browse or explore based on broad topics. Tags/indexes are better when you know basically what you want, and you just need a way to find it or items similar to it.
Al entry should go in a single category, chapter or folder. The index should provide a useful overview. Tags you may have in any amount. More is usually better.
A tag with a single entry is useful. Chapters should never have a single entry.
With limited entries of text or code you can just have them all on one page. Slightly more requires a folder or category system. If you have even more you need tags you should also keep the categories (everything must sit in a single category), If you have even more you need categories, tags and search. Trying to use one of those for the wrong volume just creates clutter.
That is just dumbing yourself down in favor of machine classification or search algorithms while a simple solution exists for this problem for higher order classification and context, which tags alone fail to provide, even with sorting.