<?xml version="1.0" ?>
<quiz>
<question type="category">
<category>
<text> $course/Quizzes-201630/$Quiz 4/</text>
</category>
</question>
<question type="description">
<name><text><![CDATA[001 Do this online reading: <a href="http://openbookproject.net/thinkcs/python/english3e/conditionals.html" target=newtab>Sections 5.5 through 5.7</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, doing the next set of questions while you do so.]]></text></name>
<questiontext format="html">
<text><![CDATA[Do this online reading: <a href="http://openbookproject.net/thinkcs/python/english3e/conditionals.html" target=newtab>Sections 5.5 through 5.7</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, doing the next set of questions while you do so.]]></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/201630/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/201630/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/201630/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/201630/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/201630/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/201630/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/201630/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/201630/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/201630/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/201630/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/201630/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/201630/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.  (For example, this function should return 2 + 4 + 6 + 8, which is 20, when n is 4.)]]></text></name>
<questiontext format="html">
<text><![CDATA[Choose the correct options to produce a function that returns the sum 2 + 4 + 6 + ... + 2n.  (For example, this function should return 2 + 4 + 6 + 8, which is 20, when n is 4.)]]></text>
</questiontext>
<subquestion>
<text><![CDATA[Line 1]]></text>
<answer>
<text><![CDATA[def add_them(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):]]></text>
</answer>
</subquestion>
<subquestion>
<text><![CDATA[Line 4]]></text>
<answer>
<text><![CDATA[&nbsp;&nbsp;total = total + (2 * (i + 1))]]></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 - 1):]]></text>
</answer>
</subquestion>
<subquestion>
<text><![CDATA[]]></text>
<answer>
<text><![CDATA[def add_them()]]></text>
</answer>
</subquestion>
<subquestion>
<text><![CDATA[]]></text>
<answer>
<text><![CDATA[total = n]]></text>
</answer>
</subquestion>
<shuffleanswers>false</shuffleanswers>
</question>
<question type="description">
<name><text><![CDATA[016 Watch <a href="http://www.rose-hulman.edu/class/csse/csse120/VideoFiles/04.7-FirstDoAConcreteExampleByHand/FirstDoAConcreteExampleByHand.mp4" target=newtab>First Solve a Concrete Example By Hand</a>.]]></text></name>
<questiontext format="html">
<text><![CDATA[Watch <a href="http://www.rose-hulman.edu/class/csse/csse120/VideoFiles/04.7-FirstDoAConcreteExampleByHand/FirstDoAConcreteExampleByHand.mp4" target=newtab>First Solve a Concrete Example By Hand</a>.]]></text>
</questiontext>
<shuffleanswers>true</shuffleanswers>
</question>
<question type="multichoice">
<name><text><![CDATA[017 True or False: To solve a problem by writing computer code for it, you must <em>understand</em> the problem that you are solving.]]></text></name>
<questiontext format="html">
<text><![CDATA[True or False: To solve a problem by writing computer code for it, you must <em>understand</em> the problem that you are solving.]]></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[018 True or False: One excellent way to figure out how to <em>code</em> the problem that you are solving is to <em>first solve a concrete example by hand.</em>.]]></text></name>
<questiontext format="html">
<text><![CDATA[True or False: One excellent way to figure out how to <em>code</em> the problem that you are solving is to <em>first solve a concrete example by hand.</em>.]]></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[019 In choosing a concrete example to solve by hand, you should (check all that apply):]]></text></name>
<questiontext format="html">
<text><![CDATA[In choosing a concrete example to solve by hand, you should (check all that apply):]]></text>
</questiontext>
<shuffleanswers>true</shuffleanswers>
<single>false</single><answer fraction="50.0">
<text><![CDATA[Choose numbers that make the calculations easy.]]></text>
</answer>
<answer fraction="0.0">
<text><![CDATA[Choose spicy foods.]]></text>
</answer>
<answer fraction="50.0">
<text><![CDATA[Avoid symmetry. ]]></text>
</answer>
<answer fraction="50.0">
<text><![CDATA[Avoid anything that may lead to a special case.]]></text>
</answer>
<answer fraction="0.0">
<text><![CDATA[Avoid carbonated drinks.]]></text>
</answer>
</question>
<question type="multichoice">
<name><text><![CDATA[020 As you solve the problem by hand, using the concrete example that you have chosen, you should (check all that apply):]]></text></name>
<questiontext format="html">
<text><![CDATA[As you solve the problem by hand, using the concrete example that you have chosen, you should (check all that apply):]]></text>
</questiontext>
<shuffleanswers>true</shuffleanswers>
<single>false</single><answer fraction="0.0">
<text><![CDATA[Listen to music by Beethovan.]]></text>
</answer>
<answer fraction="50.0">
<text><![CDATA[Give <em>names</em> to the relevant items.]]></text>
</answer>
<answer fraction="0.0">
<text><![CDATA[Write the relevant code.]]></text>
</answer>
<answer fraction="50.0">
<text><![CDATA[Keep track of <em>how</em> you calculated each item, or at least be able to figure out afterwards how you calculated it.]]></text>
</answer>
<answer fraction="0.0">
<text><![CDATA[Twist and shout &ldquo;Roll over, Beethovan.&rdquo;]]></text>
</answer>
</question>
<question type="description">
<name><text><![CDATA[021 Online Reading: <a href="http://www.rose-hulman.edu/class/csse/csse120/201630/Sessions/Session04/index.html" target=_newtab>What is Unit Testing?</a> (reading appears in the top image on the right-hand side of the page)]]></text></name>
<questiontext format="html">
<text><![CDATA[Online Reading: <a href="http://www.rose-hulman.edu/class/csse/csse120/201630/Sessions/Session04/index.html" target=_newtab>What is Unit Testing?</a> (reading appears in the top image on the right-hand side of the page)]]></text>
</questiontext>
<shuffleanswers>true</shuffleanswers>
</question>
<question type="essay">
<name><text><![CDATA[022 Explain briefly, in your own words: <strong>What is <em>unit testing</em>?</strong>]]></text></name>
<questiontext format="html">
<text><![CDATA[Explain briefly, in your own words: <strong>What is <em>unit testing</em>?</strong>]]></text>
</questiontext>
<shuffleanswers>true</shuffleanswers>
<answer fraction="0.0">
<text><![CDATA[]]></text>
</answer>
</question>
<question type="description">
<name><text><![CDATA[023 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[024 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 two approaches are equally fast.]]></text>
</answer>
</question>
<question type="truefalse">
<name><text><![CDATA[025 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>