Select the correct answer to each question.1. The correct answer to Question 2 is
A. B
B. C
C. D
D. A
2. The correct answer to Question 4 is
A. D
B. C
C. A
D. B
3. The first question for which C is the correct answer is
A. 4
B. 2
C. 3
D. 1
4. The number of questions for which B is the correct answer is
A. 1
B. 2
C. 3
D. 4
5. The number of even-numbered questions for which either B or C is the correct answer is
A. 1
B. 3
C. 0
D. 2
6. The last question for which A is the correct answer is
A. 6
B. 7
C. 5
D. 8
7. The number of instances where D is the correct answer for two consecutive questions is
A. 2
B. 0
C. 1
D. 3
8. The only letter which is the correct answer to exactly three questions is
A. C
B. D
C. B
D. A
For this problem the brute force method is the only way I know.
The following program goes through all the possibilities (the only simplifying logic being that the possible answer to 1 determines questions 2 and 4 as well). A through D are represented by 1 through 4 respectively.
CLS
FOR q1 = 1 TO 4
q2 = q1 MOD 4 + 1
SELECT CASE q2
CASE 1
q4 = 4
CASE 2
q4 = 3
CASE 3
q4 = 1
CASE 4
q4 = 2
END SELECT
FOR q3 = 1 TO 4
FOR q5 = 1 TO 4
FOR q6 = 1 TO 4
FOR q7 = 1 TO 4
FOR q8 = 1 TO 4
q(1) = q1
q(2) = q2
q(3) = q3
q(4) = q4
q(5) = q5
q(6) = q6
q(7) = q7
q(8) = q8
'eval q3
leastC = 0
FOR i = 1 TO 8
IF q(i) = 3 THEN leastC = i: EXIT FOR
NEXT
IF q3 = 1 AND leastC = 4 OR q3 = 2 AND leastC = 2 OR q3 = 3 AND leastC = 3 OR q3 = 4 AND leastC = 1 THEN
ctB = 0
FOR i = 1 TO 8
IF q(i) = 2 THEN ctB = ctB + 1
NEXT
IF ctB = q4 THEN
ctCB = 0
FOR i = 2 TO 8 STEP 2
IF q(i) = 2 OR q(i) = 3 THEN ctCB = ctCB + 1
NEXT
IF q5 = 1 AND ctCB = 1 OR q5 = 2 AND ctCB = 3 OR q5 = 3 AND ctCB = 0 OR q5 = 4 AND ctCB = 2 THEN
lastA = 0
FOR i = 1 TO 8
IF q(i) = 1 THEN lastA = i
NEXT
IF lastA = 6 AND q6 = 1 OR lastA = 7 AND q6 = 2 OR lastA = 5 AND q6 = 3 OR lastA = 8 AND q6 = 4 THEN
ctDD = 0
FOR i = 2 TO 8
IF q(i - 1) = 4 AND q(i) = 4 THEN ctDD = ctDD + 1
NEXT
IF 1 = 1 THEN
' IF q7 = 1 AND ctDD = 2 OR q7 = 2 AND ctDD = 0 OR q7 = 3 AND ctDD = 1 OR q7 = 4 AND ctDD = 3 THEN
REDIM ctA(4)
FOR i = 1 TO 8
ctA(q(i)) = ctA(q(i)) + 1
NEXT
ctr3 = 0
FOR i = 1 TO 4
IF ctA(i) = 3 THEN the3 = i: ctr3 = ctr3 + 1
NEXT
IF ctr3 = 1 THEN
IF q8 = 1 AND the3 = 3 OR q8 = 2 AND the3 = 4 OR q8 = 3 AND the3 = 2 OR q8 = 4 AND the3 = 1 THEN
FOR i = 1 TO 8
PRINT i, MID$("ABCD", q(i), 1)
NEXT
END IF
END IF
END IF
END IF
END IF
END IF
END IF
NEXT
NEXT
NEXT
NEXT
NEXT
NEXT
|
Posted by Charlie
on 2003-06-07 06:12:31 |