In my undergrad CS coursework, we were graded largely on projects, not exams.
If the solution isn't short (more than 200 lines), ChatGPT and Copilot can help but cannot solve the problem completely. The more complex the project, the harder it will be for someone to generate it whole cloth with an AI, and even if someone is using an AI to help they'll still need to understand the concepts well enough in order to get good results.