<!DOCTYPE quiz SYSTEM "ttxml.dtd">

<quiz id="CISC106 07F Final Exam (short answer)">

  <question breakQuestion="true">

    <fillInTheBlankQuestion>
    <text> 
    <p>On the next page, you'll find an incomplete listing of a  MATLAB function M-file called <code>removeNegatives.m</code>.  This function M-file takes a row vector as input, and returns a new vector that is the same as the old vector, but it has all the negative elements removed.</p>
<p>Below, you'll find a test script for that M-file, and sample output from that test script.</p>
<p>On a following page, you'll find a helper function for the test script called <code>performEqualTest.m</code>.</p>

<p>In a few places (indicated by comments in bold) code has been removed from the files.  Your job is to fill in the missing code.</p>  

    <p>Before the code was removed:</p>
<ul>
<li>the MATLAB function <code>removeNegatives()</code> correctly calculated the value of the maximum element in a row  vector, and returned that element.  If the vector was empty, the function returned the empty matrix.</li>
   <li>The function <code>performEqualTest</code> operated correctly on vector and/or scalar input, including the empty matrix, and printed out <code>passed</code> if its first two arguments are equal and <code>failed</code> if its first two arguments are not equal. The function does not have to work correctly if anything other than scalar or vector input is passed in for the first two arguments.</li></ul>
    </text>


   <url id="testRemoveNegatives.m">http://www.udel.edu/CIS/pconrad/thing/106/removeNegatives/testRemoveNegatives.m</url>
   <url id="testRemoveNegatives.txt">http://www.udel.edu/CIS/pconrad/thing/106/removeNegatives/testRemoveNegatives.txt</url>
   <url id="removeNegatives.m" suppress="true">http://www.udel.edu/CIS/pconrad/thing/106/removeNegatives/removeNegatives.m</url>
   <url id="performEqualTest.m">http://www.udel.edu/CIS/pconrad/thing/106/removeNegatives/performEqualTest.m</url>



    <showAnswer />


    </fillInTheBlankQuestion>
  </question>



  <question >

    <fillInTheBlankQuestion>
    <text> 
    <p>Below you will find a listings for a MATLAB function M-file (with some lines removed, as indicated by bold comments).  There is a also a test script for that M-file, and output from that test script.</p> 
    <p>Before the code was removed, the MATLAB function correctly calculated the value of the maximum element in a row or column vector, and returned that element.  If the vector was empty, the function returned the empty matrix.  You may assume that the function <code>performEqualTest</code> operates just as in the previous question.</p>
    <p>Fill in the missing code.</p>
    </text>

   <url id="testMyMax.m">http://www.udel.edu/CIS/pconrad/thing/106/maxOfArrayMatlab/testMyMax.m</url>
   <url id="testMyMax.txt">http://www.udel.edu/CIS/pconrad/thing/106/maxOfArrayMatlab/testMyMax.txt</url>
   <url id="myMax.m" suppress="true">http://www.udel.edu/CIS/pconrad/thing/106/maxOfArrayMatlab/myMax.m</url>


    <showAnswer />


    </fillInTheBlankQuestion>
  </question>



  <question breakQuestion="true">

    <fillInTheBlankQuestion>
    <text> 
    <p>Below you will find complete listings of a MATLAB function M-file, and 
      a test script for that M-file, except that 
    at a few places in the files code has been removed.</p>  
    <p>Before the code was removed, the MATLAB function correctly returned a logical value (true or false) depending on whether the first parameter x, appears in a row vector represented by the second parameter, v.  If  v is empty, the function returns false.</p>
   <p>You may assume that the function <code>performEqualTest</code> operates correctly.</p>
    <p>Fill in the missing code.</p>
    </text>

   <url id="testDoesXAppearInV.m">http://www.udel.edu/CIS/pconrad/thing/106/doesXAppearInV/testDoesXAppearInV.m</url>
   <url id="testDoesXAppearInV.txt">http://www.udel.edu/CIS/pconrad/thing/106/doesXAppearInV/testDoesXAppearInV.txt</url>
   <url id="doesXAppearInV.m" suppress="true">http://www.udel.edu/CIS/pconrad/thing/106/doesXAppearInV/doesXAppearInV.m</url>


    <showAnswer />


    </fillInTheBlankQuestion>
  </question>

  <question>

    <fillInTheBlankQuestion>
    <text> 
    <p>Below you will find listings of a C++ source file containing the function definition for the <code>printArray()</code> function, and a driver program that can be used to test that file.  In a few places, code has been removed.</p>  
    <p>Before the code was removed, the function correctly printed all the elements of an array, using recursion.</p>
  <p>Fill in the missing code.</p>
    </text>

   <url id="printArray.cc">http://www.udel.edu/CIS/pconrad/thing/106/CppRecursivePrintArray/printArray.cc</url>
   <url id="testPrintArray.cc">http://www.udel.edu/CIS/pconrad/thing/106/CppRecursivePrintArray/testPrintArray.cc</url>

    <showAnswer />


    </fillInTheBlankQuestion>
  </question>


</quiz>





