📄 pq2.html
字号:
<span class="dialogueheader">Take Assessment: Practical Quiz 2</span><br><br>
<form name="Assm" id="Assm" method="post" action="https://seqcc.icarnegie.com:443/submitassmcmd.php" enctype="multipart/form-data">
<a name="top_of_page"></a><input name="object_id" id="object_id" value="657546" type="hidden"><table><tbody><tr>
</tr></tbody></table>
<table><tbody><tr>
<td width="5"><br></td> <td class="td0_instructions" align="left" valign="top">
<label class="instructions">Please answer the following question(s).<br>
If the assessment includes multiple-choice questions, click the "Submit Answers" button when you have completed those questions.</label></td>
</tr></tbody></table>
<input name="MAX_FILE_SIZE" id="MAX_FILE_SIZE" value="512000" type="hidden"><table><tbody><tr>
<td width="5"><br></td><script language="JavaScript">document.write('<td class=instructions>' + 'You have 120 minutes to take this assessment.' + '<br>' + 'Please complete this assessment by ' + ComputeLocalDate('2008-11-29 10:38:55 UTC') + '.' + '</td>');</script><td class="instructions">You have 120 minutes to take this assessment.<br>Please complete this assessment by Sat Nov 29 2008 18:38:55 GMT+0800.</td> <td width="5"><br></td></tr></tbody></table>
<a name="top_13653"></a><table><tbody><tr>
<td width="5"><br></td> <td class="td0_highlight-label" align="right" nowrap="nowrap" valign="top" width="12">
<label class="highlight-label">1.</label></td>
<td width="5"><br></td> <td class="td0_x" align="left" valign="top"> <a href="#13653">Go to bottom of question.</a> </td>
</tr></tbody></table>
<table><tbody><tr>
<td width="5"><br></td> <td class="td0_x" align="left" valign="top"> <!-- new pg 042903 ici -->
<h2 align="center"><cite>Debugging Class DNASequence</cite></h2>
<h3>Prerequisites, Goals, and Outcomes</h3>
<blockquote> <b><i>Prerequisites:</i></b> Before you begin this exercise, you
need mastery of the following:
<ul>
<li> <i>Debugger</i>:
<ul>
<li>Knowledge of a debugger tool</li>
<li>Knowledge of basic techniques of debugging</li>
</ul>
</li></ul>
<p> <b><i>Goals:</i></b> Reinforce your ability to debug and fix errors efficiently
</p><p> <b><i>Outcomes:</i></b> You will master the following skills:
</p><ul>
<li>Use a debugger tool to monitor the behavior of a program.
</li><li>Apply techniques of debugging to find and fix errors efficiently.
</li></ul>
</blockquote>
<h3>Background</h3>
<p>The purpose of this assessment is to practice your debugging skills using a
debugger. After you finish this assessment, you should be able to use a debugger
to monitor the execution of your code and fix errors more efficiently.</p>
<h3>Description</h3>
<p>The class <code>DNASequence</code> has methods to examine a DNA sequence.
DNA is a polymer composed of four molecules called nucleotides:
adenine (A), cytosine (C), guanine (G)
and thymine (T). In a computer, a DNA sequence can be represented
as a sequence of the characters <code>'A'</code>, <code>'C'</code>, <code>'G'</code>
and <code>'T'</code>:</p>
<p align="center"><code>"ACCCGGTTTGGCAAATGGGACGGGAGGACGGGGAAAATTACTACGGCATTAGC"</code></p>
<p>The class <code>DNASequence</code> stores the sequence of characters in an
object of class <a href="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" target="externalWindow"><code>String</code></a>.
<code>DNASequence</code> uses the following methods from <code>String</code>:</p>
<ul>
<li><code><a href="http://java.sun.com/j2se/1.5/docs/api/java/lang/StringBuffer.html#charAt%28int%29" target="externalWindow"><em>char
charAt(int index)</em></a></code>. Obtains the character indicated by the
<code>index</code> argument. The first character of a string buffer is at
index <code>0</code>. The <code>index</code> argument must be greater than
or equal to <code>0</code>.</li>
</ul>
<ul>
<li><code><a href="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html#length%28%29" target="externalWindow"><em>int
length()</em></a></code>. Obtains the number of characters in the string.</li>
</ul>
<p>In addition to the constructor and accessor methods, the class <code>DNASequence</code>
has the following methods:</p>
<ul>
<li><code><em>private void countNucleotides()</em></code>. Sets fields <code>numberOfA</code>,
<code>numberOfT</code>, <code>numberOfC</code> and <code>numberOfG</code>
to the number of occurrences of each nucleotide in the DNA sequence.
<p>For example, if the DNA sequence is <code>"ATCGAAC"</code>, after
call the method <code>countNucleotides,</code> field <code>numberOfA</code>
will have the value 3, field <code>numberOfT</code> will have the value
1, field <code>numberOfC</code> will have the value 2, and field <code>numberOfG</code>
will have the value 1.</p>
</li>
<li><code><em>public boolean twoConsecutive(char input)</em></code>. Indicates
whether the nucleotide specified by the argument <code>input</code> appears
in two consecutive locations in the DNA sequence.
<p>For example, if the DNA sequence is
<code>"ATCGAAC"</code>, the result of <code>twoConsecutive('A')</code>
will be <code>true</code> and the result of <code>twoConsecutive('C')</code>
will be <code>false</code>.</p>
</li>
</ul>
<h3>Files</h3>
<p>Following is a list of files needed to complete this assessment:</p>
<ul>
<li><cite><a href="/content/SSD/SSD3/4.2.0.1/normal/pg-class-dsgn/pg-java-apps/assm-qz-pr-debug/pool-pr-debug/qn-pr-debug-dna/handout/DNASequence.java" target="externalWindow">DNASequence.java</a></cite>.
This is a source file of class <code>DNASequence</code> that contains errors.</li>
<li><cite><a href="/content/SSD/SSD3/4.2.0.1/normal/pg-class-dsgn/pg-java-apps/assm-qz-pr-debug/pool-pr-debug/qn-pr-debug-dna/handout/DebuggingReport.txt" target="externalWindow">DebuggingReport.txt</a></cite>.
This is a template for reporting your diagnosis of each error and your solutions.</li>
</ul>
<h3>Tasks</h3>
<p>The implementation of class <code>DNASequence</code> has four errors. Use a
debugger to help you to debug the program and fix the errors. To locate each
error, you should follow the process described in page <a href="javascript:ContentByName('pg-debug');">1.1.8 Debugging</a>.</p>
<p> Maintain a record of your work in the file <cite><a href="/content/SSD/SSD3/4.2.0.1/normal/pg-class-dsgn/pg-java-apps/assm-qz-pr-debug/pool-pr-debug/qn-pr-debug-dna/handout/DebuggingReport.txt" target="externalWindow">DebuggingReport.txt</a></cite>.
Include your diagnosis of each error and your solutions.</p>
<h3>Submission</h3>
<p>Upon completion, submit <strong>only</strong> the following.</p>
<ol>
<li><code><cite>DNASequence.java</cite></code>. The "fixed" version of <em>DNASequence.java</em></li>
<li><code><cite>DebuggingReport.txt</cite></code>. Your debugging report</li>
</ol>
</td>
<td width="5"><br></td></tr></tbody></table>
<a name="13653"></a><table><tbody><tr>
<td width="5"><br></td> <td class="td0_x" align="left" valign="top"> <a href="#top_13653">Go to top of question.</a> </td>
<td width="5"><br></td></tr></tbody></table>
<hr><table><tbody><tr>
<td width="5"><br></td> <td class="td0_x" align="left" valign="top"><label class="lbl0-x" for="file_to_add_13653">File to submit:</label><br> <input class="x" name="file_to_add_13653" value="" size="20" maxlength="500" type="file"> </td>
<td width="5"><br></td><td valign="bottom"> <input class="x" value="Upload File" name="add_file" id="add_file" style="width: 12em;" onclick='return SetUploadTime("https://seqcc.icarnegie.com:443/takeassmcmd.php?question_id=13653", 13653, false)' type="submit"></td><td width="5"><br></td></tr></tbody></table>
<hr><input name="pr_state_13653" id="pr_state_13653" value="a:2:{i:0;s:10:"incomplete";i:1;a:0:{}}" type="hidden"><table><tbody><tr>
</tr></tbody></table>
<input name="max_mins_per_try" id="max_mins_per_try" value="120" type="hidden"> <input value="2008-11-29 10:38:55 UTC" id="end_date" name="end_date" type="hidden"> <input value="421063" id="course_section_id" name="course_section_id" type="hidden"> <input value="13650" id="assm_id" name="assm_id" type="hidden"> <input value="657546" id="template_id" name="template_id" type="hidden"> <input value="657547" id="record_id" name="record_id" type="hidden"> <input value="" id="client_time" name="client_time" type="hidden"><table><tbody><tr>
<td width="5"><br></td> <td class="td0_x" align="left" valign="top"> <a href="#top_of_page">Go to top of assessment.</a> </td>
</tr></tbody></table>
<table><tbody><tr>
<td width="5"><br></td> <td class="td0_copyright" align="left" valign="top"> ? Copyright 2006 iCarnegie, Inc. All rights reserved. </td>
</tr></tbody></table>
</form>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -