C. Regena
Matching
Quiz
This month's column presents a general matching-quiz program that can be adapted to any topic. It contains no graphics or sound, so it should be easy to translate to other computers. Feel free to add your own graphics and sound to enhance your particular quiz.
The sample program is a quiz of terms and their definitions. This particular quiz can be used in a computer literacy class for learning general computer terminology.
First the program prints a definition on the screen followed by 12 possible terms. The user must press the letter corresponding to the term defined. If the answer is correct, the program continues and that definition will not appear again. If the answer is incorrect, the program gives the correct answer and the definition will appear again.
The score is kept by keeping track of how many times an answer is attempted. A perfect score in this case would be 12. Each time a definition is shown, the score is incremented.
If you want to use this matching quiz for several different topics, type in and save the program consisting of lines 100 through 710. Now, to build a custom program, start with this basic structure and then add DATA statements starting at line 720. Then save the quiz on a different tape or with a different name on the disk. Different quizzes will simply have different DATA statements. You may also need to change the instructions.
Creating DATA Statements
Notice that each DATA statement contains two items separated by a comma. The first item is the term, and the second item is the corresponding definition. If the definition contains a comma, it must be surrounded by quotation marks. Otherwise, the computer will mistake the characters after the comma for another DATA element.
On a quiz for a different topic, use the same idea-put matching parts in the same DATA statement.
Line 110 DIMensions arrays for the quiz. Since this quiz has 12 definitions and terms, the numbers in the DIM statement are 12. You will need to adjust this for the number of items in your own quiz. Line 120 sets the variable N to 12 for the 12 items in this example program. If you have a different number of items, be sure to change this line.
Lines 130-200 clear the screen and print the instructions. Lines 210-230 READ from the DATA the 12 words (W$) and their corresponding definitions (D$). Within the FOR-NEXT loop, a counter with the variable name A varies from 1 to 12. Line 220 looks for DATA statements and reads in order first a word W$(A), then the definition D$(A). The number A keeps them matched up properly. Make sure when you type your DATA statements that you have matched pairs of items (separated by commas).
Program Setup
Lines 240-270 wait for the user to press ENTER before clearing the screen to start the quiz. Line 280 initializes the score (SC) to zero at the beginning of each quiz.
Lines 290-310 set up a temporary word file array, T$(A), which is the same as the original W$ array. This temporary array is used in choosing the terms for the quiz.
Lines 320-550 perform the quiz for the number of items to be matched, N, or in this case 12. Line 330 increments the score SC for each time a definition is shown.
Line 340 clears the screen. Lines 350-370 randomly choose one of the terms which has not previously been matched correctly. The term chosen is denoted by the number R. Line 380 prints the definition D$(R) corresponding to the term chosen.
Lines 390-420 print all of the terms possible for answers with a letter to indicate the answer. Line 430 sounds a prompting tone. Lines 440-460 accept the user's answer, making sure the key pressed is an acceptable letter of one of the terms, then prints the letter chosen.
Evaluating The Answer
Line 470 tests the user's response with the correct answer stored in R. If the answer is incorrect, lines 480-510 print the correct answer, wait for the user to press ENTER, then branch back to line 330 to increment the score and print the next definition. If the answer is correct, lines 520-540 print the message CORRECT!, set T$(R) equal to the null string so the term cannot be chosen again, and then wait for the user to press ENTER. Line 550 increments P for the loop counter to go to the next problem.
After the quiz is complete and all terms have been correctly matched, line 560 clears the screen. Lines 570-580 print the possible score and the user's score. Lines 590-600 print a message if there is a perfect score.
Lines 610-670 present the option to try the quiz again or to end the program.
Lines 680-710 contain the subroutine to wait for the user to press the ENTER key before continuing the program.
Lines 720-840 in this program contain the data for the quiz. Notice that some of the definitions contain extra spaces. These are used to print the definition on the 28-column screen without splitting words.
Customizing The Quiz
Now to change the topic of the quiz. Decide how many items will need to be matched. Keep in mind how it will look when printed on the 24-row screen. Change the DIMension statement of line 110 and the definition of N in line 120 to reflect the number of items.
Next add the DATA statements starting with line 720. For example, if you want a quiz on BASIC programming commands, a typical DATA statement might be:
720
DATA GOTO,Command to transfer program
control
control
A history quiz might contain:
720
DATA 1492,Columbus discovered America.
An algebra quiz could use:
720
DATA x=2,x+5=5x-3
A states and capitals quiz could use:
720
DATA Providence,Rhode Island
When typing the DATA statements, make sure there are matching pairs. If there are short words, you may put more than one matching pair in a DATA statement-just be sure to use commas to separate each item. With longer phrases, make sure you use spaces to print the phrase properly on the screen without splitting words.
Remember that you can add your own sound effects and graphics for positive reinforcements on correct answers. You may also wish to use graphics and sound as part of the matching process.
If you wish to save typing effort and obtain a copy of this program, send a blank cassette or disk, a stamped, self-addressed mailer, and $3 to:
C. Regena
P.O. Box 1502
Cedar City, UT 84720
Please be sure to specify the title of the program and the type of computer you use.
Matching Quiz For TI
Please refer to "COMPUTEI's Guide To Typing In Programs" before entering this listing.
100 REM MATCHING QUIZ
110 DIM W$(12),T$(12),D$(12)
120 N=12
130 CALL CLEAR
140 PRINT TAP(9);"CHAPTER 1"
150 PRINT :::"A DEFINITION WILL BE
GIVEN."
160 PRINT :"CHOOSE THE TERM WHICH"
170 PRINT :"MATCHES THE DEFINITION.
"
180 PRINT :"PRESS THE LETTER OF THE
"
190 PRINT :"ANSWER."
200 PRINT :"THERE WILL BE";N;"PROBL
EMS."
210 FOR A=1 TO N
220 READ W$(A),D$(A)
230 NEXT A
240 PRINT ::"PRESS <ENTER> TO START
."
250 CALL KEY(0,K,S)
260 IF K<>13 THEN 250
270 CALL CLEAR
280 SC=0
290 FOR A=1 TO N
300 T$(A)=W$(A)
310 NEXT A
320 FOR P=1 TO N
330 SC=SC+1
340 CALL CLEAR
350 RANDOMIZE
360 R=INT(N*RND)+1
370 IF T$(R)="" THEN 360
380 PRINT D$ (R)::
390 FOR A=1 TO N
400 PRINT CHR$(64+A);" ";W$(A)
410 NEXT A
420 PRINT
430 CALL SOUND(150,1500,2)
440 CALL KEY(0,K,S)
450 IF (K<65)+(K>64+N)THEN 440
460 PRINT CHR$(K)::
470 IF K-64=R THEN 520
480 PRINT "THE CORRECT ANSWER IS"
490 PRINT CHR$(R+64);"--";W$(R)
500 GOSUB 680
510 GOTO 330
520 PRINT "CORRECT!"
530 T$(R)=""
540 GOSUB 680
550 NEXT P
560 CALL CLEAR
570 PRINT "THERE WERE";N;"DEFINITIO
NS."
580 PRINT :"YOUR SCORE: ";SC;"ANSWE
RS":::
590 IF SC<>N THEN 610
600 PRINT "GOOD WORK!":::
610 PRINT "PRESS 1 TO TRY AGAIN"
620 PRINT "{6 SPACES}2 TO END PROGR
AM"
630 CALL KEY(0,K,S)
640 IF K=49 THEN 270,
650 IF K<>50 THEN 630
660 PRINT ::"2 END":::
670 STOP
680 PRINT :"PRESS <ENTER>.";
690 CALL KEY(0,K,S)
700 IF K<>13 THEN 690
710 RETURN
720 DATA DOCUMENTATION,THE BOOKS AN
D MANUALS THAT ACCOMPANY A COM
PUTER-RELATEDPRODUCT
730 DATA SYSTEM,A SET OR ARRANGEMEN
T OF{5 SPACES}PARTS ACTING TOGE
THER TO{4 SPACES}PERFORM A FUNC
TION
740 DATA INFORMATION SYSTEM,"A SYST
EM THAT TAKES INPUT, PROCESSES
IT, AND PRODUCES INFORMATION
AS OUTPUT"
750 DATA COMMUNICATION SYSTEM,"A SY
STEM THAT CONSISTS OF A SENDER,
A PHYSICAL CHANNEL, AND A RECE
IVER"
760 DATA HARDWARE,THE PHYSICAL COMP
ONENTS{5 SPACES}ASSOCIATED WITH
A COMPUTER OR OTHER SYSTEM
770 DATA SOFTWARE,PROGRAMS THAT CON
TROL THE{3 SPACES}FUNCTIONS OF
SYSTEMS
780 DATA NETWORK,TWO OR MORE COMMUN
ICATING{3 SPACES}DEVICES THAT A
RE CONNECTED TOGETHER
790 DATA APPLICATION,WHAT IS DONE W
ITH COMPUTERS
800 DATA CIRCUIT,AN INTERCONNECTED
SET OF{4 SPACES}COMPONENTS THAT
PERFORM AN ELECTRONIC FUNCTION
810 DATA BINARY SIGNAL,A COMPUTER C
IRCUIT THAT IS REPRESENTED BY
TWO DIFFERENTLEVELS OF CURRENT
820 DATA DATA,"FACTS, NUMBERS, AND
SYMBOLS PROCESSED BY A COMPUTER
TO PRODUCE INFORMATION"
830 DATA BINARY DIGIT (BIT),A BASIC
BUILDING BLOCK OR{3 SPACES}UNI
T OF INFORMATION USED IN COMPUT
ER SYSTEMS
840 END