I was studying for an exam and a practice problem asked about the similarities between the Torah and the Code of Hammurabi, and asked what is the most likely reason for them. It was multiple choice format. The practice booklet said the “correct” answer is that the Torah (Hebrew Bible) borrowed from Hammurabi, clearly an idea that goes against everything Judaism stands for.
If the questions comes up on the exam, how should I answer it? One of the other options was that the Code of Hammurabi was influenced by the Torah (which they marked incorrect since they said Hammurabi was before the Torah). Is it permitted to answer the answer the exam is looking for. Especially since a machine reads the answers and no one would ever connect it to me, or any Jew? What should I do?
Your situation is problematic, because we are not allowed to express ourselves as if we believe in heresy or heretical statements. In fact the Shulchan Aruch Y:D 157-2, says that if a gentile asks us if we are a Jew or not, to say that one is a gentile is like saying that we believe in avoda zara and yeharog u’al ya’avor. Therefore, you cannot answer the heretical answer, even if it will only be seen by a computer. There is an idea that you might be able to do, depending on the how the exam works. That is to “doctor up” the exam, and you can write before the answer that they want you to write, “You want me to answer, (and make an X by the answer that they want) but the truth is not that way”. This might work for certain types of multiple choice tests. If it won’t work, then just get that question wrong, and you will know that you sanctified H-shem’s name and you will be rewarded for it, much more than the loss of the few points of the exam.
As a side point one has to be careful not to take college courses that force the student to study heretical ideas.