For each of your practice sessions, log into a lab machine. There is the following program in the lab directory, which you call as follows:
/home/jplank/cs360/labs/Lab-0-Pointers/pointer-tester key action |
The key may be any string -- the string is used to generate a random test. If you use the action "Q", then it will print a test, in HTML, on standard output. Let's go ahead and generate a test with the key "binky":
UNIX> /home/jplank/cs360/labs/Lab-0-Pointers/pointer-tester binky Q > test.htmlYou can see the test here: test.html. The first line of the test tells you what its key is. For example, the first line of test.html is "Lab Zero. HTML file for key binky:".
The test is composed of 25 questions. Each time you generate a test, it will be similar in format, but the questions will be different. The content depends on the key given.
When you answer the questions, create a text file with the answers. The first line of an answer file should be the key. After that, each answer should go on its own line, and each line should be of the form:
number answer |
The number is the question number, and the answer is your answer. Take a look at the file answers.txt:
binky 0 0x12345678 1 12345678 12 0x91 |
As you can see, I have put the key "binky" as the first line. After that, I have answered questions 0, 1 and 12. I can tell you that the answer to questions 0 and 1 are incorrect. Question 1's answer is in the wrong format, too (it doesn't match the printf() statement in the question). The answer to question 12 is correct.
You can test your answers for correctness, by calling /home/jplank/cs360/labs/Lab-0-Pointers/pointer-tester with the same key that created the HTML file, but with a "T" (for "test") instead of a "Q" (for "questions"). Redirect standard input to come from your answer file. The program will report your answers and whether or not they are correct.
Here's our example:
UNIX> /home/jplank/cs360/labs/Lab-0-Pointers/pointer-tester binky T < answers.txt Question 0: Your answer: 0x12345678 -- Incorrect: +0 Question 1: Your answer: 12345678 -- Wrong number of characters. Check your formatting. Question 2: Your answer: -- Incorrect: +0 Question 3: Your answer: -- Incorrect: +0 Question 4: Your answer: -- Incorrect: +0 Question 5: Your answer: -- Incorrect: +0 Question 6: Your answer: -- Incorrect: +0 Question 7: Your answer: -- Incorrect: +0 Question 8: Your answer: -- Incorrect: +0 Question 9: Your answer: -- Incorrect: +0 Question 10: Your answer: -- Incorrect: +0 Question 11: Your answer: -- Incorrect: +0 Question 12: Your answer: 0x91 -- Correct: +4 Question 13: Your answer: -- Incorrect: +0 Question 14: Your answer: -- Incorrect: +0 Question 15: Your answer: -- Incorrect: +0 Question 16: Your answer: -- Incorrect: +0 Question 17: Your answer: -- Incorrect: +0 Question 18: Your answer: -- Incorrect: +0 Question 19: Your answer: -- Incorrect: +0 Question 20: Your answer: -- Incorrect: +0 Question 21: Your answer: -- Incorrect: +0 Question 22: Your answer: -- Incorrect: +0 Question 23: Your answer: -- Incorrect: +0 Question 24: Your answer: -- Incorrect: +0 Your score: 4 / 100 UNIX>If you want to see the answers, run the program with the action "A":
UNIX> /home/jplank/cs360/labs/Lab-0-Pointers/pointer-tester binky A Correct Answers: 0 : 0x496f7976 1 : 0x737a6a6c 2 : 0x6e 3 : 0x73 4 : 0x11 5 : 0x78 6 : 0x58ac1144 7 : 0x58ac114c 8 : 0x58ac1141 9 : 0x58ac1151 10 : zsPdZm 11 : xGDmjR 12 : 0x91 13 : 0xb5 14 : 0x4c 15 : 0xbf 16 : 0xa8 17 : 0x09 18 : 0x0008b0dc 19 : 0x5c6bf000 20 : 0xf8aff64f 21 : 0xa00df00d 22 : 0x08a00640 23 : 0x58a20642 24 : 0x50784555 UNIX>