CPS 1 (Ramm) Spring 1995 25 January 1995 Quiz #2 Name _______________________ Section _____ (Note: Getting your Name and Section right is worth one point. If we can't decipher your name, it's wrong.) A. The following Pascal program asked the user to type a string and the person typed DECEMBER. Then it asked for another string and the person typed FEBRUARY. What did the program print after that? program pres; WRITE OUTPUT BELOW WRITE INPUT BELOW var ------------------ ------------------ last, next, again: string; begin writeln('Last month?'); readln(last); writeln('Next one?'); readln(next); again := last; writeln(last); writeln(next); writeln(again); writeln('again'); end. B. Here are some simple rules defining Pascal objects. #1 -> //a sequence of letters// (where // indicates italics) #2 -> '//any string of printable characters//' #3 -> writeln() #4 -> readln() #5 -> begin //a sequence of s each followed by a semicolon// end Show how these rules can be used to generate the following Pascal program fragment. Identify the rule used at each stage. Continue on back as needed. begin readln(resp); writeln('Thanks for your answer.'); end Start with: #5 ->