The program IQ.test
!User's IQ is estimated from the fraction
!of right answers given to the questions in
!sequential text files of "questions,right_answers"
!stored in the same folder. Examples:
!
!"question.file"
!"trivia"
!
!Stores wrong answers in a file named by user.
INPUT prompt "File containing the questions?":filein$ !name of question,answer file
OPEN #1: name filein$
INPUT prompt "File to store missed questions?":fileout$ ! eg: Jane Doe
OPEN #2: name fileout$, create newold
RESET #2: end
DO
INPUT #1: question$, answer$
LET total = total + 1
PRINT question$;
LINE INPUT reply$
IF reply$=answer$ then
LET right = right+1
PRINT"Correct!"
ELSE
PRINT "No, the correct answer is "; answer$; "."
PRINT #2: question$; ","; answer$
END IF
LOOP until end #1
PRINT "All done. You answered"; right; "out of"; total;
PRINT "questions correctly."
PRINT "Your IQ is estimated to be "; (right/total)*200
Print #2:"Your IQ is estimated to be ";(right/total)*200
END
Sample output
File containing the questions?trivia
File to store missed questions?Jane Doe
Which part of a lemon provides the zest? skin
Correct!
If Bill Gates were a country how would he rank in terms of wealth? 38
Correct!
What is a German motorway or freeway called? autobahn
No, the correct answer is Autobahn.
Which is the most populous country in the world? india
No, the correct answer is China.
What year did the SS Titanic sink? 1492
No, the correct answer is 1912.
What is the largest snake in South America? garter
No, the correct answer is Anaconda.
All done. You answered 2 out of 6 questions correctly.
Your IQ is estimated to be 66.6667
Jane Doe file produced on channel #2
What is a German motorway or freeway called,Autobahn
Which is the most populous country in the world,China
What year did the SS Titanic sink,1912
What is the largest snake in South America,Anaconda
Your IQ is estimated to be 66.6667
Contents of the file "trivia"
Which part of a lemon provides the zest, skin
If Bill Gates were a country how would he rank in terms of wealth, 38
What is a German motorway or freeway called, Autobahn
Which is the most populous country in the world, China
What year did the SS Titanic sink, 1912
What is the largest snake in South America, Anaconda