Lesson 4 Homework Solution
Copyright 2007 Shoptalk Systems
All rights reserved

Return to Table of Contents

  print "Multiple choice test taker"
  print

[askNext]
  read question$
  if question$ = "EndOfData" then [gradeTest]
  print "Q: "; question$
  answers$ = ""
  for x = 1 to 4
    read anAnswer$
    answers$ = answers$ + anAnswer$ + ","
  next x
  radiogroup #pickOne, answers$, ""
  link #acceptChoice, "Accept", [accept]
  print
  print
  wait

[accept]
  read theAnswer$
  if theAnswer$ = #pickOne selection$() then correctTally = correctTally + 1
  questionsAnswered = questionsAnswered + 1
  goto [askNext]

[gradeTest]
  print
  print "Thanks for taking the test."
  print "You scored "; correctTally; " of "; questionsAnswered; " correct."
  end

  data "How many volts are in a 9 volt battery?"
  data "1.5", "3", "9", "12"
  data "9"

  data "A bluebird is what kind of animal?"
  data "dog", "fish", "bird", "pet rock"
  data "bird"

  data "The Earth orbits around which body?"
  data "Sun", "Milky Way", "Halley's Comet", "Paris Hilton"
  data "Sun"

  data "EndOfData"