PhD students take classes, and some of them do have written exam (in CS theory more than other parts of CS). In the US, where the PhD is 5 years, you spent a good portion of the first 2 years taking classes.
Before coming up with new knowledge you need to know what's already out there.