Given a test with n questions, 3 choices each, where a question contributes to the score with 1/n if correct, r/n if wrong (-1 < r < 0), and 0 if not answered, and k·n is needed to pass the exam (0 < k < 1/n). Say also that a student can only guess (has no clue of the matter to be examined), what would be her chances (best choice) to pass the exam?
Update: let n be around 50, since this matters for approximating the distribution.
Here is a computational solution.
In general, given a fixed number of questions $N=50$ and a fixed probability $p=1/3$ that a student's guess is correct, and one point for each correct answer, the probability that a student passes depends on the following variables:
We can eliminate one of these variables $Q$ by assuming the student behaves optimally: For a given value of $R$ (penalty) and $T$ (passing threshold), we can find the value of $Q$ that maximizes the probability of passing, whatever it is. Then we can use that value of $Q$ as a benchmark— a student can do no better than the optimal strategy.
As a result of assuming the student chooses the optimal strategy, the probability that a student passes by guessing becomes a function of only two variables: $R$ (penalty for incorrect guess) and $T$ (passing threshold). We can brute-force compute the values for penalty values $0 \leq R \leq 1$ and threshold values $0\leq T \leq N$, as a sum of binomial-type probabilities.
The result is a chart like the following:
Here, the x-axis records the number of points $T$ required to pass — $T$ only goes as high as 25 (requiring at least half of the responses to be correct answers), because beyond that the probability of success by guessing is negligible no matter the penalty.
The y-axis records the penalty $R$ for guessing.
This chart allows you to see how you can set the penalty for guessing and the threshold for passing so as to control the probability that a completely random guesser passes.
Please feel free to use or double-check my Python code: https://pastebin.com/yT8hqd6y
Edit: Roughly speaking, for reasonable threshold levels, the relationship between $R$ and $T$ is approximately linear: if $p=\frac{1}{3}$ is the probability that a student answers a question correctly, then a student has a 50% chance of passing when the penalty and threshold are set according to
$$T = pN (1-2R)$$
Here, $pN$ is the expected number of correct answers when guessing on all of the questions. In particular, note that when there is no penalty $R=0$, this implies that the student is more likely to fail than succeed if the threshold for points is greater than the expected number of correct answers when guessing on everything.