<?xml version="1.0" ?>
<quiz>
<question type="category">
<category>
<text> $course$/quiz5/</text>
</category>
</question>
<question type="description">
<name><text><![CDATA[001 Online reading: <a href="http://openbookproject.net/thinkcs/python/english3e/conditionals.html" target=newtab>Sections 5.1 through 5.10</a> of <a href="http://openbookproject.net/thinkcs/python/english3e/" target=newtab>How to Think Like a Computer Scientist: Learning with Python 3</a> by Peter Wentworth, Jeffrey Elkner, Allen B. Downey, and Chris Meyers. From the <a href="http://www.openbookproject.net/" target=newtab>Open Book Project</a>.]]></text></name>
<questiontext format="html">
<text><![CDATA[Online reading: <a href="http://openbookproject.net/thinkcs/python/english3e/conditionals.html" target=newtab>Sections 5.1 through 5.10</a> of <a href="http://openbookproject.net/thinkcs/python/english3e/" target=newtab>How to Think Like a Computer Scientist: Learning with Python 3</a> by Peter Wentworth, Jeffrey Elkner, Allen B. Downey, and Chris Meyers. From the <a href="http://www.openbookproject.net/" target=newtab>Open Book Project</a>.]]></text>
</questiontext>
<shuffleanswers>true</shuffleanswers>
</question>
<question type="multichoice">
<name><text><![CDATA[002 Consider the following code. <img src="http://www.rose-hulman.edu/class/csse/csse120/Images/for_quizzes/conditionals-1.png" alt="n = random.randrange(50) if ...: print('Banana')"> <p>What statement should be added in the box so the function prints Banana! only if the value of <strong>n</strong> is larger than 20? </p>]]></text></name>
<questiontext format="html">
<text><![CDATA[Consider the following code. <img src="http://www.rose-hulman.edu/class/csse/csse120/Images/for_quizzes/conditionals-1.png" alt="n = random.randrange(50) if ...: print('Banana')"> <p>What statement should be added in the box so the function prints Banana! only if the value of <strong>n</strong> is larger than 20? </p>]]></text>
</questiontext>
<shuffleanswers>true</shuffleanswers>
<answer fraction="0.0">
<text><![CDATA[&nbsp;if n<20:]]></text>
</answer>
<answer fraction="100.0">
<text><![CDATA[&nbsp;if n>20:]]></text>
</answer>
<answer fraction="0.0">
<text><![CDATA[&nbsp;elif n>20:]]></text>
</answer>
<answer fraction="0.0">
<text><![CDATA[&nbsp;else n>20:]]></text>
</answer>
</question>
<question type="matching">
<name><text><![CDATA[003 Consider the following code. <img src="http://www.rose-hulman.edu/class/csse/csse120/Images/for_quizzes/conditionals-2.png" alt="if [box A]: print('A won') elif [box B]" print('B won') else [box C]: print('Game tied"> <p>What statements should be in boxes A, B, and C so that the sequence correctly prints either 'A won', 'B won', or 'Game tied' given scoreA (the score of player A) and scoreB (the score of player B).</p>]]></text></name>
<questiontext format="html">
<text><![CDATA[Consider the following code. <img src="http://www.rose-hulman.edu/class/csse/csse120/Images/for_quizzes/conditionals-2.png" alt="if [box A]: print('A won') elif [box B]" print('B won') else [box C]: print('Game tied"> <p>What statements should be in boxes A, B, and C so that the sequence correctly prints either 'A won', 'B won', or 'Game tied' given scoreA (the score of player A) and scoreB (the score of player B).</p>]]></text>
</questiontext>
<subquestion>
<text><![CDATA[Box A]]></text>
<answer>
<text><![CDATA[if scoreA > scoreB:]]></text>
</answer>
</subquestion>
<subquestion>
<text><![CDATA[Box B]]></text>
<answer>
<text><![CDATA[elif scoreB > scoreA:]]></text>
</answer>
</subquestion>
<subquestion>
<text><![CDATA[Box C]]></text>
<answer>
<text><![CDATA[else:]]></text>
</answer>
</subquestion>
<subquestion>
<text><![CDATA[]]></text>
<answer>
<text><![CDATA[elif scoreB >= scoreA:]]></text>
</answer>
</subquestion>
<subquestion>
<text><![CDATA[]]></text>
<answer>
<text><![CDATA[else if scoreB > scoreA:]]></text>
</answer>
</subquestion>
<shuffleanswers>false</shuffleanswers>
</question>
<question type="description">
<name><text><![CDATA[004 For the following questions, consider Versions 1 and 2: <img src="http://www.rose-hulman.edu/class/csse/csse120/Images/for_quizzes/conditionals-3.png" alt="version 1: if-else, version 2: if-if">]]></text></name>
<questiontext format="html">
<text><![CDATA[For the following questions, consider Versions 1 and 2: <img src="http://www.rose-hulman.edu/class/csse/csse120/Images/for_quizzes/conditionals-3.png" alt="version 1: if-else, version 2: if-if">]]></text>
</questiontext>
<shuffleanswers>true</shuffleanswers>
</question>
<question type="truefalse">
<name><text><![CDATA[005 Versions 1 and 2 will print the same thing given the same x and y.]]></text></name>
<questiontext format="html">
<text><![CDATA[Versions 1 and 2 will print the same thing given the same x and y.]]></text>
</questiontext>
<shuffleanswers>true</shuffleanswers>
<answer fraction="100.0">
<text><![CDATA[true]]></text>
</answer>
<answer fraction="0.0">
<text><![CDATA[false]]></text>
</answer>
</question>
<question type="multichoice">
<name><text><![CDATA[006 Which of the versions runs faster?]]></text></name>
<questiontext format="html">
<text><![CDATA[Which of the versions runs faster?]]></text>
</questiontext>
<shuffleanswers>true</shuffleanswers>
<answer fraction="100.0">
<text><![CDATA[Version 1]]></text>
</answer>
<answer fraction="0.0">
<text><![CDATA[Version 2]]></text>
</answer>
<answer fraction="0.0">
<text><![CDATA[Neither (they run equally fast)]]></text>
</answer>
</question>
<question type="multichoice">
<name><text><![CDATA[007 Which of the versions is better?]]></text></name>
<questiontext format="html">
<text><![CDATA[Which of the versions is better?]]></text>
</questiontext>
<shuffleanswers>true</shuffleanswers>
<answer fraction="100.0">
<text><![CDATA[Version 1]]></text>
</answer>
<answer fraction="0.0">
<text><![CDATA[Version 2]]></text>
</answer>
<answer fraction="0.0">
<text><![CDATA[Neither (they are equally good)]]></text>
</answer>
</question>
<question type="description">
<name><text><![CDATA[008 Watch <a href="http://www.rose-hulman.edu/class/csse/csse120/VideoFiles/06.1-TheAccumulatorPattern-Part2/TheAccumulatorPattern.mp4" target=newtab>The Accumulator Pattern (revisited)</a>.]]></text></name>
<questiontext format="html">
<text><![CDATA[Watch <a href="http://www.rose-hulman.edu/class/csse/csse120/VideoFiles/06.1-TheAccumulatorPattern-Part2/TheAccumulatorPattern.mp4" target=newtab>The Accumulator Pattern (revisited)</a>.]]></text>
</questiontext>
<shuffleanswers>true</shuffleanswers>
</question>
<question type="shortanswer">
<name><text><![CDATA[009 What is the value of <b>x</b> after the following code executes? <img src="http://www.rose-hulman.edu/class/csse/csse120/Images/for_quizzes/accumulators-1.png" alt="x = 2  x = x + 1  x = x + 2  x = x + 3">]]></text></name>
<questiontext format="html">
<text><![CDATA[What is the value of <b>x</b> after the following code executes? <img src="http://www.rose-hulman.edu/class/csse/csse120/Images/for_quizzes/accumulators-1.png" alt="x = 2  x = x + 1  x = x + 2  x = x + 3">]]></text>
</questiontext>
<shuffleanswers>true</shuffleanswers>
<answer fraction="100.0">
<text><![CDATA[8]]></text>
</answer>
</question>
<question type="shortanswer">
<name><text><![CDATA[010 What is the value of <b>y</b> after the following code executes? <img src="http://www.rose-hulman.edu/class/csse/csse120/Images/for_quizzes/accumulators-2.png" alt="y = 2  y = y * 2  y = y * 3">]]></text></name>
<questiontext format="html">
<text><![CDATA[What is the value of <b>y</b> after the following code executes? <img src="http://www.rose-hulman.edu/class/csse/csse120/Images/for_quizzes/accumulators-2.png" alt="y = 2  y = y * 2  y = y * 3">]]></text>
</questiontext>
<shuffleanswers>true</shuffleanswers>
<answer fraction="100.0">
<text><![CDATA[12]]></text>
</answer>
</question>
<question type="description">
<name><text><![CDATA[011 Consider the following code: <img src="http://www.rose-hulman.edu/class/csse/csse120/Images/for_quizzes/accumulators-3.png" alt="x = 1  y = 2  z = x + y  x = x + 2  y = y * 2  z = z + x + y  x = x + 3  y = y * 3  z = z + x + y">]]></text></name>
<questiontext format="html">
<text><![CDATA[Consider the following code: <img src="http://www.rose-hulman.edu/class/csse/csse120/Images/for_quizzes/accumulators-3.png" alt="x = 1  y = 2  z = x + y  x = x + 2  y = y * 2  z = z + x + y  x = x + 3  y = y * 3  z = z + x + y">]]></text>
</questiontext>
<shuffleanswers>true</shuffleanswers>
</question>
<question type="shortanswer">
<name><text><![CDATA[012 What is the value of <b>x</b> after the above code executes?]]></text></name>
<questiontext format="html">
<text><![CDATA[What is the value of <b>x</b> after the above code executes?]]></text>
</questiontext>
<shuffleanswers>true</shuffleanswers>
<answer fraction="100.0">
<text><![CDATA[6]]></text>
</answer>
</question>
<question type="shortanswer">
<name><text><![CDATA[013 What is the value of <b>y</b> after the above code executes?]]></text></name>
<questiontext format="html">
<text><![CDATA[What is the value of <b>y</b> after the above code executes?]]></text>
</questiontext>
<shuffleanswers>true</shuffleanswers>
<answer fraction="100.0">
<text><![CDATA[12]]></text>
</answer>
</question>
<question type="shortanswer">
<name><text><![CDATA[014 What is the value of <b>z</b> after the above code executes?]]></text></name>
<questiontext format="html">
<text><![CDATA[What is the value of <b>z</b> after the above code executes?]]></text>
</questiontext>
<shuffleanswers>true</shuffleanswers>
<answer fraction="100.0">
<text><![CDATA[28]]></text>
</answer>
</question>
<question type="matching">
<name><text><![CDATA[015 Choose the correct options to produce a function that returns the sum 2 + 4 + 6 + ... + 2n.]]></text></name>
<questiontext format="html">
<text><![CDATA[Choose the correct options to produce a function that returns the sum 2 + 4 + 6 + ... + 2n.]]></text>
</questiontext>
<subquestion>
<text><![CDATA[Line 1]]></text>
<answer>
<text><![CDATA[def add_n(n):]]></text>
</answer>
</subquestion>
<subquestion>
<text><![CDATA[Line 2]]></text>
<answer>
<text><![CDATA[&nbsp;total = 0]]></text>
</answer>
</subquestion>
<subquestion>
<text><![CDATA[Line 3]]></text>
<answer>
<text><![CDATA[&nbsp;for i in range(n+1):]]></text>
</answer>
</subquestion>
<subquestion>
<text><![CDATA[Line 4]]></text>
<answer>
<text><![CDATA[&nbsp;&nbsp;total = total + 2 * i]]></text>
</answer>
</subquestion>
<subquestion>
<text><![CDATA[Line 5]]></text>
<answer>
<text><![CDATA[&nbsp;return total]]></text>
</answer>
</subquestion>
<subquestion>
<text><![CDATA[]]></text>
<answer>
<text><![CDATA[&nbsp;&nbsp;total = 2 * i]]></text>
</answer>
</subquestion>
<subquestion>
<text><![CDATA[]]></text>
<answer>
<text><![CDATA[&nbsp;&nbsp;total = total + 2]]></text>
</answer>
</subquestion>
<subquestion>
<text><![CDATA[]]></text>
<answer>
<text><![CDATA[&nbsp;for i in range(n):]]></text>
</answer>
</subquestion>
<subquestion>
<text><![CDATA[]]></text>
<answer>
<text><![CDATA[def add_n()]]></text>
</answer>
</subquestion>
<shuffleanswers>false</shuffleanswers>
</question>
<question type="description">
<name><text><![CDATA[016 Online Reading: <a href="http://www.rose-hulman.edu/class/csse/csse120/201610/Sessions/Session04/index.html" target=newtab>UNIT TESTING Fundamentals</a>, and <a href="http://stackoverflow.com/questions/1383/what-is-unit-testing/" target=newtab>a question on Unit Testing in Stack Overflow</a>.]]></text></name>
<questiontext format="html">
<text><![CDATA[Online Reading: <a href="http://www.rose-hulman.edu/class/csse/csse120/201610/Sessions/Session04/index.html" target=newtab>UNIT TESTING Fundamentals</a>, and <a href="http://stackoverflow.com/questions/1383/what-is-unit-testing/" target=newtab>a question on Unit Testing in Stack Overflow</a>.]]></text>
</questiontext>
<shuffleanswers>true</shuffleanswers>
</question>
<question type="essay">
<name><text><![CDATA[017 What is unit testing?]]></text></name>
<questiontext format="html">
<text><![CDATA[What is unit testing?]]></text>
</questiontext>
<shuffleanswers>true</shuffleanswers>
<answer fraction="0.0">
<text><![CDATA[]]></text>
</answer>
</question>
<question type="description">
<name><text><![CDATA[018 Online Reading: <a href="http://www.extremeprogramming.org/rules/testfirst.html" target=newtab>Code the Unit Test First</a>.]]></text></name>
<questiontext format="html">
<text><![CDATA[Online Reading: <a href="http://www.extremeprogramming.org/rules/testfirst.html" target=newtab>Code the Unit Test First</a>.]]></text>
</questiontext>
<shuffleanswers>true</shuffleanswers>
</question>
<question type="multichoice">
<name><text><![CDATA[019 Which of the following is typically faster?]]></text></name>
<questiontext format="html">
<text><![CDATA[Which of the following is typically faster?]]></text>
</questiontext>
<shuffleanswers>true</shuffleanswers>
<answer fraction="100.0">
<text><![CDATA[Code the unit tests for a function, then code the function itself.]]></text>
</answer>
<answer fraction="0.0">
<text><![CDATA[Code the function, then code the unit tests for that function.]]></text>
</answer>
<answer fraction="0.0">
<text><![CDATA[The other two approaches are equally fast.]]></text>
</answer>
</question>
<question type="truefalse">
<name><text><![CDATA[020 Writing the unit tests first helps you better understand the problem for which you are writing code.]]></text></name>
<questiontext format="html">
<text><![CDATA[Writing the unit tests first helps you better understand the problem for which you are writing code.]]></text>
</questiontext>
<shuffleanswers>true</shuffleanswers>
<answer fraction="100.0">
<text><![CDATA[true]]></text>
</answer>
<answer fraction="0.0">
<text><![CDATA[false]]></text>
</answer>
</question>
</quiz>