The exam has 18 questions and each question has 3 possible answers, of which one is right
1. In how many ways one can answer without getting something right?
2. In how many ways one can answer without getting all right?
For someone getting every answer wrong there are 2 options for each of the 18 questions so there are 2^{18} ways of answering all wrong.
In total there are 3^{18} ways of answering, only 1 of those is getting all questions correct so the number of ways they can get not all correct is 3^{18} -1