There are 4 tests that get switched out through the course of the day, tests A, B, C, and D. Which means there are anywhere from 25 - 100 different questions that the DMV has written, placing 25 of them at random on any given test.
If for any reason you flunk the test to get your permit they mark which test you took on that day, and on your return to take the test again they will assign you with a different test.
If you fail again for another reason on your return date they will then give you the option of the written test, or a visual test, which is made up of 25 questions at random, just like the written test, with pictures.
Best of luck!