I assume you mean senior year of college, because I don't think anyone is writing 40 page senior year papers in high school. But personally, a forty page thesis isn't that much. First, its broken down into micro papers that are written over the course of 9 months. You write like 3-5 pages a week and then have your advisor give you the red pen treatment. And then you re-write it and repeat the process until your advisor is satisfied with what you have and then you go forth with the next part of the process. For the first semester it was basically Introduction--Literature Review--Methods--Participants--Procedure...