#!perl $temp=$ENV{'QUERY_STRING'}; @pairs=split(/&/,$temp); foreach $item(@pairs) { ($key,$content)=split (/=/,$item,2); $content=~tr/+/ /; $content=~ s/%(..)/pack("c",hex($1))/ge; $fields{$key}=$content; } ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); $user = $fields{'name'}; if ($user) { &PrintResponsePage; &WriteOut; } else { &NoName; } # subroutines sub PrintResponsePage { print <Music 190W Chapter 14 Quiz Response

Music 190W Chapter 14 Quiz Results

Hi there, $fields{'name'}, whose e-mail address is <$fields{'email'}>.

ENDPRINT $q = 0; # number of questions answered correctly $t = 20; # total number of questions $score = 0; # score on the test to be converted into percent $x = 1; # the question number $a = 0; # the answer number # be sure to update answer key for each new week @ans = ("f","b","b","c","b","d","a","b","b","d","b","a","b","d","a","a","d","c","b","c"); while ($x != 21) { if ($fields{$x} eq @ans[$a]) { print "Question $x is correct.

\n"; ++$q; } else { print "Question $x is incorrect.

\n"; } ++$x; ++$a; } $score = $q / $t; $score = int $score * 100; print "Your score on this quiz is $score%.\n"; if ($score != 100) { print <Please review the questions you missed and try this quiz again in order to reach the writing assignment prompts.

Use Netscape's Back button to return to your quiz.

E-mail Prof. Murphy if you have questions

ENDPRINT } else { print < Choose one prompt and write a 1-page essay, which will be due on Wednesday, Dec. 9. This is your last weekly essay; there is no essay for week 15. The only remaining writing assignment is concert report 3, which is due at the final exam.

The prompts for week 14:

  1. David Willoughby asks on p. 309: "Is new and experimental music worthy music, and is traditional, noninnovative music unworthy music?" How do you answer this question? What is "worthy" music, from your point of view? Refer to specific pieces from this chapter or previous chapters in your essay.

  2. Choose music from this chapter and listen to it with a friend who's not in this class. What can you explain about the music to help your friend appreciate it more? Did it work? Did having to explain it help you listen any better?

  3. How do you perceive dissonance in music? Do you perceive the music for this chapter as any more dissonant than other music we've studied so far? What, to your ears, is dissonant music?

E-mail Prof. Murphy if you have questions

ENDPRINT } print "\n"; } sub NoName { print <No Name Entered

You can take the quiz as many times as you like.

I do ask, however, that you enter your name at the top of the quiz form.

Netscape's Back button will return you to your quiz.

Prof. Murphy

ENDPRINT print "\n"; } sub WriteOut { $when = localtime(time); open(OUTFILE, ">>$fields{'name'}.wk14log") || die "Sorry, I couldn't open that file for writing\n"; print OUTFILE "$fields{'name'}, whose SSN is $fields{'ssn'}, has taken the chapter 14 quiz at $when.\n"; &PrintOutResponse; close(OUTFILE); open(REPORTFILE,">>quiz14log.txt") || die "Sorry, I couldn't open the log file.\n"; print REPORTFILE "$fields{'name'} | $score% | $when | $ENV{'HTTP_USER_AGENT'}\n"; close REPORTFILE; } sub PrintOutResponse { $q = 0; # number of questions answered correctly $t = 20; # total number of questions $score = 0; # score on the test to be converted into percent $x = 1; # the question number $a = 0; # the answer number @ans = ("f","b","b","c","b","d","a","b","b","d","b","a","b","d","a","a","d","c","b","c"); while ($x != 21) { if ($fields{$x} eq @ans[$a]) { print OUTFILE "Question $x is correct.\n"; ++$q; } else { print OUTFILE "Question $x is incorrect.\n"; } ++$x; ++$a; } $score = $q / $t; $score = int $score * 100; print OUTFILE "The score on this quiz is $score%.\n\n"; }