<div class="xblock xblock-public_view xblock-public_view-vertical" data-has-score="False" data-runtime-class="LmsRuntime" data-request-token="66e5f01c684311ef860c0214bd5530e3" data-usage-id="block-v1:MITx+6.005.1x+3T2016+type@vertical+block@Instructions" data-block-type="vertical" data-graded="True" data-init="VerticalStudentView" data-course-id="course-v1:MITx+6.005.1x+3T2016" data-runtime-version="1">
<h2 class="hd hd-2 unit-title">Instructions</h2>
<div class="vert-mod">
<div class="vert vert-0" data-id="block-v1:MITx+6.005.1x+3T2016+type@html+block@html_90482c758bb8">
<div class="xblock xblock-public_view xblock-public_view-html xmodule_display xmodule_HtmlBlock" data-has-score="False" data-runtime-class="LmsRuntime" data-request-token="66e5f01c684311ef860c0214bd5530e3" data-usage-id="block-v1:MITx+6.005.1x+3T2016+type@html+block@html_90482c758bb8" data-block-type="html" data-graded="True" data-init="XBlockToXModuleShim" data-course-id="course-v1:MITx+6.005.1x+3T2016" data-runtime-version="1">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "HTMLModule"}
</script>
<link href="/assets/courseware/v1/9fab367942e94f98d32835b3ef4df11d/asset-v1:MITx+6.005.1x+3T2016+type@asset+block/prism-edx-v1.css" rel="stylesheet" type="text/css" />
<p><strong>There is no time limit for this exam. Just submit your answers before the deadline.</strong></p>
<p>This exam is designed to take about an hour. You can start the exam whenever convenient for you, and work on it for as long as you want, but you must submit all your answers by the deadline.</p>
<p>This is an individual exam. It is not OK to communicate about the exam to other peopleĀ until the exam deadline passed. But it is OK to use any resources on the course website during the exam, to use Eclipse on your personal computer, and to use other resources on the Internet.</p>
<p>During the exam period, the discussion forum is shut down, to avoid any accidental discussion of exam material. You will be able to see past posts but not ask questions. The forum will reopen at the end of the exam period.</p>
<p>If you want to go back and study some more before starting this exam you can certainly do so.</p>
<p>Good luck!</p>
</div>
</div>
</div>
</div>
<div class="xblock xblock-public_view xblock-public_view-vertical" data-has-score="False" data-runtime-class="LmsRuntime" data-request-token="66e5f01c684311ef860c0214bd5530e3" data-usage-id="block-v1:MITx+6.005.1x+3T2016+type@vertical+block@Part_1" data-block-type="vertical" data-graded="True" data-init="VerticalStudentView" data-course-id="course-v1:MITx+6.005.1x+3T2016" data-runtime-version="1">
<h2 class="hd hd-2 unit-title">Part 1</h2>
<div class="vert-mod">
<div class="vert vert-0" data-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-01-kinds-of-checking-3">
<div class="xblock xblock-public_view xblock-public_view-problem xmodule_display xmodule_ProblemBlock" data-has-score="True" data-runtime-class="LmsRuntime" data-request-token="66e5f01c684311ef860c0214bd5530e3" data-usage-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-01-kinds-of-checking-3" data-block-type="problem" data-graded="True" data-init="XBlockToXModuleShim" data-course-id="course-v1:MITx+6.005.1x+3T2016" data-runtime-version="1">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "Problem"}
</script>
<div id="problem_exam-01-kinds-of-checking-3" class="problems-wrapper" role="group"
aria-labelledby="exam-01-kinds-of-checking-3-problem-title"
data-problem-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-01-kinds-of-checking-3" data-url="/courses/course-v1:MITx+6.005.1x+3T2016/xblock/block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-01-kinds-of-checking-3/handler/xmodule_handler"
data-problem-score="0.0"
data-problem-total-possible="1.0"
data-attempts-used="0"
data-content="
<h3 class="hd hd-3 problem-header" id="exam-01-kinds-of-checking-3-problem-title" aria-describedby="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-01-kinds-of-checking-3-problem-progress" tabindex="-1">
Checking 1
</h3>
<div class="problem-progress" id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-01-kinds-of-checking-3-problem-progress"></div>
<div class="problem">
<div>
<p>This Java code has a bug. Is it caught statically, dynamically, or not at all?</p>
<pre>
double oneThird = 1/3;
</pre>
<div class="wrapper-problem-response" tabindex="-1" aria-label="Question 1" role="group"><div class="choicegroup capa_inputtype" id="inputtype_exam-01-kinds-of-checking-3_2_1">
<fieldset aria-describedby="status_exam-01-kinds-of-checking-3_2_1">
<div class="field">
<input type="radio" name="input_exam-01-kinds-of-checking-3_2_1" id="input_exam-01-kinds-of-checking-3_2_1_choice_0" class="field-input input-radio" value="choice_0"/><label id="exam-01-kinds-of-checking-3_2_1-choice_0-label" for="input_exam-01-kinds-of-checking-3_2_1_choice_0" class="response-label field-label label-inline" aria-describedby="status_exam-01-kinds-of-checking-3_2_1"> static error
</label>
</div>
<div class="field">
<input type="radio" name="input_exam-01-kinds-of-checking-3_2_1" id="input_exam-01-kinds-of-checking-3_2_1_choice_1" class="field-input input-radio" value="choice_1"/><label id="exam-01-kinds-of-checking-3_2_1-choice_1-label" for="input_exam-01-kinds-of-checking-3_2_1_choice_1" class="response-label field-label label-inline" aria-describedby="status_exam-01-kinds-of-checking-3_2_1"> dynamic error
</label>
</div>
<div class="field">
<input type="radio" name="input_exam-01-kinds-of-checking-3_2_1" id="input_exam-01-kinds-of-checking-3_2_1_choice_2" class="field-input input-radio" value="choice_2"/><label id="exam-01-kinds-of-checking-3_2_1-choice_2-label" for="input_exam-01-kinds-of-checking-3_2_1_choice_2" class="response-label field-label label-inline" aria-describedby="status_exam-01-kinds-of-checking-3_2_1"> no error, wrong answer
</label>
</div>
<span id="answer_exam-01-kinds-of-checking-3_2_1"/>
</fieldset>
<div class="indicator-container">
<span class="status unanswered" id="status_exam-01-kinds-of-checking-3_2_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
</div>
</div></div>
<div class="solution-span">
<span id="solution_exam-01-kinds-of-checking-3_solution_1"/>
</div></div>
<div class="action">
<input type="hidden" name="problem_id" value="Checking 1" />
<div class="submit-attempt-container">
<button type="button" class="submit btn-brand" data-submitting="Submitting" data-value="Submit" data-should-enable-submit-button="True" aria-describedby="submission_feedback_exam-01-kinds-of-checking-3" >
<span class="submit-label">Submit</span>
</button>
<div class="submission-feedback" id="submission_feedback_exam-01-kinds-of-checking-3">
<span class="sr">Some problems have options such as save, reset, hints, or show answer. These options follow the Submit button.</span>
</div>
</div>
<div class="problem-action-buttons-wrapper">
</div>
</div>
<div class="notification warning notification-gentle-alert
is-hidden"
tabindex="-1">
<span class="icon fa fa-exclamation-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-01-kinds-of-checking-3-problem-title">
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification warning notification-save
is-hidden"
tabindex="-1">
<span class="icon fa fa-save" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-01-kinds-of-checking-3-problem-title">None
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification general notification-show-answer
is-hidden"
tabindex="-1">
<span class="icon fa fa-info-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-01-kinds-of-checking-3-problem-title">Answers are displayed within the problem
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
</div>
"
data-graded="True">
<p class="loading-spinner">
<i class="fa fa-spinner fa-pulse fa-2x fa-fw"></i>
<span class="sr">Loading…</span>
</p>
</div>
</div>
</div>
<div class="vert vert-1" data-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-01-kinds-of-checking-4">
<div class="xblock xblock-public_view xblock-public_view-problem xmodule_display xmodule_ProblemBlock" data-has-score="True" data-runtime-class="LmsRuntime" data-request-token="66e5f01c684311ef860c0214bd5530e3" data-usage-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-01-kinds-of-checking-4" data-block-type="problem" data-graded="True" data-init="XBlockToXModuleShim" data-course-id="course-v1:MITx+6.005.1x+3T2016" data-runtime-version="1">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "Problem"}
</script>
<div id="problem_exam-01-kinds-of-checking-4" class="problems-wrapper" role="group"
aria-labelledby="exam-01-kinds-of-checking-4-problem-title"
data-problem-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-01-kinds-of-checking-4" data-url="/courses/course-v1:MITx+6.005.1x+3T2016/xblock/block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-01-kinds-of-checking-4/handler/xmodule_handler"
data-problem-score="0.0"
data-problem-total-possible="1.0"
data-attempts-used="0"
data-content="
<h3 class="hd hd-3 problem-header" id="exam-01-kinds-of-checking-4-problem-title" aria-describedby="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-01-kinds-of-checking-4-problem-progress" tabindex="-1">
Checking 2
</h3>
<div class="problem-progress" id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-01-kinds-of-checking-4-problem-progress"></div>
<div class="problem">
<div>
<p>This Java code has a bug. Is it caught statically, dynamically, or not at all?</p>
<pre>
int sum = 0;
int n = 0;
int average = sum/n;
</pre>
<div class="wrapper-problem-response" tabindex="-1" aria-label="Question 1" role="group"><div class="choicegroup capa_inputtype" id="inputtype_exam-01-kinds-of-checking-4_2_1">
<fieldset aria-describedby="status_exam-01-kinds-of-checking-4_2_1">
<div class="field">
<input type="radio" name="input_exam-01-kinds-of-checking-4_2_1" id="input_exam-01-kinds-of-checking-4_2_1_choice_0" class="field-input input-radio" value="choice_0"/><label id="exam-01-kinds-of-checking-4_2_1-choice_0-label" for="input_exam-01-kinds-of-checking-4_2_1_choice_0" class="response-label field-label label-inline" aria-describedby="status_exam-01-kinds-of-checking-4_2_1"> static error
</label>
</div>
<div class="field">
<input type="radio" name="input_exam-01-kinds-of-checking-4_2_1" id="input_exam-01-kinds-of-checking-4_2_1_choice_1" class="field-input input-radio" value="choice_1"/><label id="exam-01-kinds-of-checking-4_2_1-choice_1-label" for="input_exam-01-kinds-of-checking-4_2_1_choice_1" class="response-label field-label label-inline" aria-describedby="status_exam-01-kinds-of-checking-4_2_1"> dynamic error
</label>
</div>
<div class="field">
<input type="radio" name="input_exam-01-kinds-of-checking-4_2_1" id="input_exam-01-kinds-of-checking-4_2_1_choice_2" class="field-input input-radio" value="choice_2"/><label id="exam-01-kinds-of-checking-4_2_1-choice_2-label" for="input_exam-01-kinds-of-checking-4_2_1_choice_2" class="response-label field-label label-inline" aria-describedby="status_exam-01-kinds-of-checking-4_2_1"> no error, wrong answer
</label>
</div>
<span id="answer_exam-01-kinds-of-checking-4_2_1"/>
</fieldset>
<div class="indicator-container">
<span class="status unanswered" id="status_exam-01-kinds-of-checking-4_2_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
</div>
</div></div>
<div class="solution-span">
<span id="solution_exam-01-kinds-of-checking-4_solution_1"/>
</div></div>
<div class="action">
<input type="hidden" name="problem_id" value="Checking 2" />
<div class="submit-attempt-container">
<button type="button" class="submit btn-brand" data-submitting="Submitting" data-value="Submit" data-should-enable-submit-button="True" aria-describedby="submission_feedback_exam-01-kinds-of-checking-4" >
<span class="submit-label">Submit</span>
</button>
<div class="submission-feedback" id="submission_feedback_exam-01-kinds-of-checking-4">
<span class="sr">Some problems have options such as save, reset, hints, or show answer. These options follow the Submit button.</span>
</div>
</div>
<div class="problem-action-buttons-wrapper">
</div>
</div>
<div class="notification warning notification-gentle-alert
is-hidden"
tabindex="-1">
<span class="icon fa fa-exclamation-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-01-kinds-of-checking-4-problem-title">
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification warning notification-save
is-hidden"
tabindex="-1">
<span class="icon fa fa-save" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-01-kinds-of-checking-4-problem-title">None
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification general notification-show-answer
is-hidden"
tabindex="-1">
<span class="icon fa fa-info-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-01-kinds-of-checking-4-problem-title">Answers are displayed within the problem
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
</div>
"
data-graded="True">
<p class="loading-spinner">
<i class="fa fa-spinner fa-pulse fa-2x fa-fw"></i>
<span class="sr">Loading…</span>
</p>
</div>
</div>
</div>
<div class="vert vert-2" data-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-01-documenting-assumptions-2">
<div class="xblock xblock-public_view xblock-public_view-problem xmodule_display xmodule_ProblemBlock" data-has-score="True" data-runtime-class="LmsRuntime" data-request-token="66e5f01c684311ef860c0214bd5530e3" data-usage-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-01-documenting-assumptions-2" data-block-type="problem" data-graded="True" data-init="XBlockToXModuleShim" data-course-id="course-v1:MITx+6.005.1x+3T2016" data-runtime-version="1">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "Problem"}
</script>
<div id="problem_exam-01-documenting-assumptions-2" class="problems-wrapper" role="group"
aria-labelledby="exam-01-documenting-assumptions-2-problem-title"
data-problem-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-01-documenting-assumptions-2" data-url="/courses/course-v1:MITx+6.005.1x+3T2016/xblock/block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-01-documenting-assumptions-2/handler/xmodule_handler"
data-problem-score="0.0"
data-problem-total-possible="3.0"
data-attempts-used="0"
data-content="
<h3 class="hd hd-3 problem-header" id="exam-01-documenting-assumptions-2-problem-title" aria-describedby="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-01-documenting-assumptions-2-problem-progress" tabindex="-1">
Assumptions
</h3>
<div class="problem-progress" id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-01-documenting-assumptions-2-problem-progress"></div>
<div class="problem">
<div>
<p>In Java, which of the following assumptions could be documented by type declarations and statically checked by the Java compiler?</p>
<div class="wrapper-problem-response" tabindex="-1" aria-label="Question 1" role="group"><div class="choicegroup capa_inputtype" id="inputtype_exam-01-documenting-assumptions-2_2_1">
<fieldset aria-describedby="status_exam-01-documenting-assumptions-2_2_1">
<div class="field">
<input type="checkbox" name="input_exam-01-documenting-assumptions-2_2_1[]" id="input_exam-01-documenting-assumptions-2_2_1_choice_0" class="field-input input-checkbox" value="choice_0"/><label id="exam-01-documenting-assumptions-2_2_1-choice_0-label" for="input_exam-01-documenting-assumptions-2_2_1_choice_0" class="response-label field-label label-inline" aria-describedby="status_exam-01-documenting-assumptions-2_2_1"> the variable <code>animal</code> must point to an object with <code>weight</code> and <code>species</code> instance variables (or else be null)
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-01-documenting-assumptions-2_2_1[]" id="input_exam-01-documenting-assumptions-2_2_1_choice_1" class="field-input input-checkbox" value="choice_1"/><label id="exam-01-documenting-assumptions-2_2_1-choice_1-label" for="input_exam-01-documenting-assumptions-2_2_1_choice_1" class="response-label field-label label-inline" aria-describedby="status_exam-01-documenting-assumptions-2_2_1"> <code>animal</code> is not <code>null</code>
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-01-documenting-assumptions-2_2_1[]" id="input_exam-01-documenting-assumptions-2_2_1_choice_2" class="field-input input-checkbox" value="choice_2"/><label id="exam-01-documenting-assumptions-2_2_1-choice_2-label" for="input_exam-01-documenting-assumptions-2_2_1_choice_2" class="response-label field-label label-inline" aria-describedby="status_exam-01-documenting-assumptions-2_2_1"> <code>animal.weight</code> must be a nonnegative number
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-01-documenting-assumptions-2_2_1[]" id="input_exam-01-documenting-assumptions-2_2_1_choice_3" class="field-input input-checkbox" value="choice_3"/><label id="exam-01-documenting-assumptions-2_2_1-choice_3-label" for="input_exam-01-documenting-assumptions-2_2_1_choice_3" class="response-label field-label label-inline" aria-describedby="status_exam-01-documenting-assumptions-2_2_1"> <code>animal.weight</code> must be a floating-point number
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-01-documenting-assumptions-2_2_1[]" id="input_exam-01-documenting-assumptions-2_2_1_choice_4" class="field-input input-checkbox" value="choice_4"/><label id="exam-01-documenting-assumptions-2_2_1-choice_4-label" for="input_exam-01-documenting-assumptions-2_2_1_choice_4" class="response-label field-label label-inline" aria-describedby="status_exam-01-documenting-assumptions-2_2_1"> <code>animal.species</code> must be a string
</label>
</div>
<span id="answer_exam-01-documenting-assumptions-2_2_1"/>
</fieldset>
<div class="indicator-container">
<span class="status unanswered" id="status_exam-01-documenting-assumptions-2_2_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
</div>
</div></div>
<div class="solution-span">
<span id="solution_exam-01-documenting-assumptions-2_solution_1"/>
</div></div>
<div class="action">
<input type="hidden" name="problem_id" value="Assumptions" />
<div class="submit-attempt-container">
<button type="button" class="submit btn-brand" data-submitting="Submitting" data-value="Submit" data-should-enable-submit-button="True" aria-describedby="submission_feedback_exam-01-documenting-assumptions-2" >
<span class="submit-label">Submit</span>
</button>
<div class="submission-feedback" id="submission_feedback_exam-01-documenting-assumptions-2">
<span class="sr">Some problems have options such as save, reset, hints, or show answer. These options follow the Submit button.</span>
</div>
</div>
<div class="problem-action-buttons-wrapper">
</div>
</div>
<div class="notification warning notification-gentle-alert
is-hidden"
tabindex="-1">
<span class="icon fa fa-exclamation-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-01-documenting-assumptions-2-problem-title">
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification warning notification-save
is-hidden"
tabindex="-1">
<span class="icon fa fa-save" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-01-documenting-assumptions-2-problem-title">None
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification general notification-show-answer
is-hidden"
tabindex="-1">
<span class="icon fa fa-info-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-01-documenting-assumptions-2-problem-title">Answers are displayed within the problem
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
</div>
"
data-graded="True">
<p class="loading-spinner">
<i class="fa fa-spinner fa-pulse fa-2x fa-fw"></i>
<span class="sr">Loading…</span>
</p>
</div>
</div>
</div>
<div class="vert vert-3" data-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-02-nq">
<div class="xblock xblock-public_view xblock-public_view-problem xmodule_display xmodule_ProblemBlock" data-has-score="True" data-runtime-class="LmsRuntime" data-request-token="66e5f01c684311ef860c0214bd5530e3" data-usage-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-02-nq" data-block-type="problem" data-graded="True" data-init="XBlockToXModuleShim" data-course-id="course-v1:MITx+6.005.1x+3T2016" data-runtime-version="1">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "Problem"}
</script>
<div id="problem_exam-02-nq" class="problems-wrapper" role="group"
aria-labelledby="exam-02-nq-problem-title"
data-problem-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-02-nq" data-url="/courses/course-v1:MITx+6.005.1x+3T2016/xblock/block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-02-nq/handler/xmodule_handler"
data-problem-score="0.0"
data-problem-total-possible="2.0"
data-attempts-used="0"
data-content="
<h3 class="hd hd-3 problem-header" id="exam-02-nq-problem-title" aria-describedby="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-02-nq-problem-progress" tabindex="-1">
Java Types
</h3>
<div class="problem-progress" id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-02-nq-problem-progress"></div>
<div class="problem">
<div>
<p>Which of the following are legal Java types?</p>
<div class="wrapper-problem-response" tabindex="-1" aria-label="Question 1" role="group"><div class="choicegroup capa_inputtype" id="inputtype_exam-02-nq_2_1">
<fieldset aria-describedby="status_exam-02-nq_2_1">
<div class="field">
<input type="checkbox" name="input_exam-02-nq_2_1[]" id="input_exam-02-nq_2_1_choice_0" class="field-input input-checkbox" value="choice_0"/><label id="exam-02-nq_2_1-choice_0-label" for="input_exam-02-nq_2_1_choice_0" class="response-label field-label label-inline" aria-describedby="status_exam-02-nq_2_1"> ArrayList&lt;String&gt;
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-02-nq_2_1[]" id="input_exam-02-nq_2_1_choice_1" class="field-input input-checkbox" value="choice_1"/><label id="exam-02-nq_2_1-choice_1-label" for="input_exam-02-nq_2_1_choice_1" class="response-label field-label label-inline" aria-describedby="status_exam-02-nq_2_1"> String[]
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-02-nq_2_1[]" id="input_exam-02-nq_2_1_choice_2" class="field-input input-checkbox" value="choice_2"/><label id="exam-02-nq_2_1-choice_2-label" for="input_exam-02-nq_2_1_choice_2" class="response-label field-label label-inline" aria-describedby="status_exam-02-nq_2_1"> List[int]
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-02-nq_2_1[]" id="input_exam-02-nq_2_1_choice_3" class="field-input input-checkbox" value="choice_3"/><label id="exam-02-nq_2_1-choice_3-label" for="input_exam-02-nq_2_1_choice_3" class="response-label field-label label-inline" aria-describedby="status_exam-02-nq_2_1"> List&lt;List&lt;Integer&gt;&gt;
</label>
</div>
<span id="answer_exam-02-nq_2_1"/>
</fieldset>
<div class="indicator-container">
<span class="status unanswered" id="status_exam-02-nq_2_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
</div>
</div></div>
<div class="solution-span">
<span id="solution_exam-02-nq_solution_1"/>
</div></div>
<div class="action">
<input type="hidden" name="problem_id" value="Java Types" />
<div class="submit-attempt-container">
<button type="button" class="submit btn-brand" data-submitting="Submitting" data-value="Submit" data-should-enable-submit-button="True" aria-describedby="submission_feedback_exam-02-nq" >
<span class="submit-label">Submit</span>
</button>
<div class="submission-feedback" id="submission_feedback_exam-02-nq">
<span class="sr">Some problems have options such as save, reset, hints, or show answer. These options follow the Submit button.</span>
</div>
</div>
<div class="problem-action-buttons-wrapper">
</div>
</div>
<div class="notification warning notification-gentle-alert
is-hidden"
tabindex="-1">
<span class="icon fa fa-exclamation-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-02-nq-problem-title">
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification warning notification-save
is-hidden"
tabindex="-1">
<span class="icon fa fa-save" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-02-nq-problem-title">None
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification general notification-show-answer
is-hidden"
tabindex="-1">
<span class="icon fa fa-info-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-02-nq-problem-title">Answers are displayed within the problem
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
</div>
"
data-graded="True">
<p class="loading-spinner">
<i class="fa fa-spinner fa-pulse fa-2x fa-fw"></i>
<span class="sr">Loading…</span>
</p>
</div>
</div>
</div>
</div>
</div>
<div class="xblock xblock-public_view xblock-public_view-vertical" data-has-score="False" data-runtime-class="LmsRuntime" data-request-token="66e5f01c684311ef860c0214bd5530e3" data-usage-id="block-v1:MITx+6.005.1x+3T2016+type@vertical+block@Part_2" data-block-type="vertical" data-graded="True" data-init="VerticalStudentView" data-course-id="course-v1:MITx+6.005.1x+3T2016" data-runtime-version="1">
<h2 class="hd hd-2 unit-title">Part 2</h2>
<div class="vert-mod">
<div class="vert vert-0" data-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-02-nq2">
<div class="xblock xblock-public_view xblock-public_view-problem xmodule_display xmodule_ProblemBlock" data-has-score="True" data-runtime-class="LmsRuntime" data-request-token="66e5f01c684311ef860c0214bd5530e3" data-usage-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-02-nq2" data-block-type="problem" data-graded="True" data-init="XBlockToXModuleShim" data-course-id="course-v1:MITx+6.005.1x+3T2016" data-runtime-version="1">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "Problem"}
</script>
<div id="problem_exam-02-nq2" class="problems-wrapper" role="group"
aria-labelledby="exam-02-nq2-problem-title"
data-problem-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-02-nq2" data-url="/courses/course-v1:MITx+6.005.1x+3T2016/xblock/block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-02-nq2/handler/xmodule_handler"
data-problem-score="0.0"
data-problem-total-possible="3.0"
data-attempts-used="0"
data-content="
<h3 class="hd hd-3 problem-header" id="exam-02-nq2-problem-title" aria-describedby="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-02-nq2-problem-progress" tabindex="-1">
DRY
</h3>
<div class="problem-progress" id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-02-nq2-problem-progress"></div>
<div class="problem">
<div>
<p>Which of the following are true about Don't Repeat Yourself (DRY)?</p>
<div class="wrapper-problem-response" tabindex="-1" aria-label="Question 1" role="group"><div class="choicegroup capa_inputtype" id="inputtype_exam-02-nq2_2_1">
<fieldset aria-describedby="status_exam-02-nq2_2_1">
<div class="field">
<input type="checkbox" name="input_exam-02-nq2_2_1[]" id="input_exam-02-nq2_2_1_choice_0" class="field-input input-checkbox" value="choice_0"/><label id="exam-02-nq2_2_1-choice_0-label" for="input_exam-02-nq2_2_1_choice_0" class="response-label field-label label-inline" aria-describedby="status_exam-02-nq2_2_1"> A loop is not DRY because it runs repeatedly.
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-02-nq2_2_1[]" id="input_exam-02-nq2_2_1_choice_1" class="field-input input-checkbox" value="choice_1"/><label id="exam-02-nq2_2_1-choice_1-label" for="input_exam-02-nq2_2_1_choice_1" class="response-label field-label label-inline" aria-describedby="status_exam-02-nq2_2_1"> Copy-and-paste is a good way to make DRY code.
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-02-nq2_2_1[]" id="input_exam-02-nq2_2_1_choice_2" class="field-input input-checkbox" value="choice_2"/><label id="exam-02-nq2_2_1-choice_2-label" for="input_exam-02-nq2_2_1_choice_2" class="response-label field-label label-inline" aria-describedby="status_exam-02-nq2_2_1"> Helper methods can make code more DRY.
</label>
</div>
<span id="answer_exam-02-nq2_2_1"/>
</fieldset>
<div class="indicator-container">
<span class="status unanswered" id="status_exam-02-nq2_2_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
</div>
</div></div>
<div class="solution-span">
<span id="solution_exam-02-nq2_solution_1"/>
</div></div>
<div class="action">
<input type="hidden" name="problem_id" value="DRY" />
<div class="submit-attempt-container">
<button type="button" class="submit btn-brand" data-submitting="Submitting" data-value="Submit" data-should-enable-submit-button="True" aria-describedby="submission_feedback_exam-02-nq2" >
<span class="submit-label">Submit</span>
</button>
<div class="submission-feedback" id="submission_feedback_exam-02-nq2">
<span class="sr">Some problems have options such as save, reset, hints, or show answer. These options follow the Submit button.</span>
</div>
</div>
<div class="problem-action-buttons-wrapper">
</div>
</div>
<div class="notification warning notification-gentle-alert
is-hidden"
tabindex="-1">
<span class="icon fa fa-exclamation-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-02-nq2-problem-title">
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification warning notification-save
is-hidden"
tabindex="-1">
<span class="icon fa fa-save" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-02-nq2-problem-title">None
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification general notification-show-answer
is-hidden"
tabindex="-1">
<span class="icon fa fa-info-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-02-nq2-problem-title">Answers are displayed within the problem
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
</div>
"
data-graded="True">
<p class="loading-spinner">
<i class="fa fa-spinner fa-pulse fa-2x fa-fw"></i>
<span class="sr">Loading…</span>
</p>
</div>
</div>
</div>
<div class="vert vert-1" data-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-02-leap-year-code-review">
<div class="xblock xblock-public_view xblock-public_view-problem xmodule_display xmodule_ProblemBlock" data-has-score="True" data-runtime-class="LmsRuntime" data-request-token="66e5f01c684311ef860c0214bd5530e3" data-usage-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-02-leap-year-code-review" data-block-type="problem" data-graded="True" data-init="XBlockToXModuleShim" data-course-id="course-v1:MITx+6.005.1x+3T2016" data-runtime-version="1">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "Problem"}
</script>
<div id="problem_exam-02-leap-year-code-review" class="problems-wrapper" role="group"
aria-labelledby="exam-02-leap-year-code-review-problem-title"
data-problem-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-02-leap-year-code-review" data-url="/courses/course-v1:MITx+6.005.1x+3T2016/xblock/block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-02-leap-year-code-review/handler/xmodule_handler"
data-problem-score="0.0"
data-problem-total-possible="2.0"
data-attempts-used="0"
data-content="
<h3 class="hd hd-3 problem-header" id="exam-02-leap-year-code-review-problem-title" aria-describedby="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-02-leap-year-code-review-problem-progress" tabindex="-1">
Reading Java
</h3>
<div class="problem-progress" id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-02-leap-year-code-review-problem-progress"></div>
<div class="problem">
<div>
<pre class="code">
public static boolean leap(int y) {
String tmp = String.valueOf(y);
if (tmp.charAt(2) == '1' || tmp.charAt(2) == '3' || tmp.charAt(2) == 5
|| tmp.charAt(2) == '7' || tmp.charAt(2) == '9') {
if (tmp.charAt(3)=='2'||tmp.charAt(3)=='6') return true; /*R1*/
else
return false; /*R2*/
}else{
if (tmp.charAt(2) == '0' &amp;&amp; tmp.charAt(3) == '0') {
return false; /*R3*/
}
if (tmp.charAt(3)=='0'||tmp.charAt(3)=='4'||tmp.charAt(3)=='8')return true; /*R4*/
}
return false; /*R5*/
}
</pre>
<p>What happens when you call:</p>
<pre class="code">
leap(2015)
</pre>
<div class="wrapper-problem-response" tabindex="-1" aria-label="Question 1" role="group"><div class="choicegroup capa_inputtype" id="inputtype_exam-02-leap-year-code-review_2_1">
<fieldset aria-describedby="status_exam-02-leap-year-code-review_2_1">
<div class="field">
<input type="radio" name="input_exam-02-leap-year-code-review_2_1" id="input_exam-02-leap-year-code-review_2_1_choice_0" class="field-input input-radio" value="choice_0"/><label id="exam-02-leap-year-code-review_2_1-choice_0-label" for="input_exam-02-leap-year-code-review_2_1_choice_0" class="response-label field-label label-inline" aria-describedby="status_exam-02-leap-year-code-review_2_1"> returns true on line R1
</label>
</div>
<div class="field">
<input type="radio" name="input_exam-02-leap-year-code-review_2_1" id="input_exam-02-leap-year-code-review_2_1_choice_1" class="field-input input-radio" value="choice_1"/><label id="exam-02-leap-year-code-review_2_1-choice_1-label" for="input_exam-02-leap-year-code-review_2_1_choice_1" class="response-label field-label label-inline" aria-describedby="status_exam-02-leap-year-code-review_2_1"> returns false on line R2
</label>
</div>
<div class="field">
<input type="radio" name="input_exam-02-leap-year-code-review_2_1" id="input_exam-02-leap-year-code-review_2_1_choice_2" class="field-input input-radio" value="choice_2"/><label id="exam-02-leap-year-code-review_2_1-choice_2-label" for="input_exam-02-leap-year-code-review_2_1_choice_2" class="response-label field-label label-inline" aria-describedby="status_exam-02-leap-year-code-review_2_1"> returns false on line R3
</label>
</div>
<div class="field">
<input type="radio" name="input_exam-02-leap-year-code-review_2_1" id="input_exam-02-leap-year-code-review_2_1_choice_3" class="field-input input-radio" value="choice_3"/><label id="exam-02-leap-year-code-review_2_1-choice_3-label" for="input_exam-02-leap-year-code-review_2_1_choice_3" class="response-label field-label label-inline" aria-describedby="status_exam-02-leap-year-code-review_2_1"> returns true on line R4
</label>
</div>
<div class="field">
<input type="radio" name="input_exam-02-leap-year-code-review_2_1" id="input_exam-02-leap-year-code-review_2_1_choice_4" class="field-input input-radio" value="choice_4"/><label id="exam-02-leap-year-code-review_2_1-choice_4-label" for="input_exam-02-leap-year-code-review_2_1_choice_4" class="response-label field-label label-inline" aria-describedby="status_exam-02-leap-year-code-review_2_1"> returns false on line R5
</label>
</div>
<div class="field">
<input type="radio" name="input_exam-02-leap-year-code-review_2_1" id="input_exam-02-leap-year-code-review_2_1_choice_5" class="field-input input-radio" value="choice_5"/><label id="exam-02-leap-year-code-review_2_1-choice_5-label" for="input_exam-02-leap-year-code-review_2_1_choice_5" class="response-label field-label label-inline" aria-describedby="status_exam-02-leap-year-code-review_2_1"> error before program starts
</label>
</div>
<div class="field">
<input type="radio" name="input_exam-02-leap-year-code-review_2_1" id="input_exam-02-leap-year-code-review_2_1_choice_6" class="field-input input-radio" value="choice_6"/><label id="exam-02-leap-year-code-review_2_1-choice_6-label" for="input_exam-02-leap-year-code-review_2_1_choice_6" class="response-label field-label label-inline" aria-describedby="status_exam-02-leap-year-code-review_2_1"> error while program is running
</label>
</div>
<span id="answer_exam-02-leap-year-code-review_2_1"/>
</fieldset>
<div class="indicator-container">
<span class="status unanswered" id="status_exam-02-leap-year-code-review_2_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
</div>
</div></div>
<div class="solution-span">
<span id="solution_exam-02-leap-year-code-review_solution_1"/>
</div></div>
<div class="action">
<input type="hidden" name="problem_id" value="Reading Java" />
<div class="submit-attempt-container">
<button type="button" class="submit btn-brand" data-submitting="Submitting" data-value="Submit" data-should-enable-submit-button="True" aria-describedby="submission_feedback_exam-02-leap-year-code-review" >
<span class="submit-label">Submit</span>
</button>
<div class="submission-feedback" id="submission_feedback_exam-02-leap-year-code-review">
<span class="sr">Some problems have options such as save, reset, hints, or show answer. These options follow the Submit button.</span>
</div>
</div>
<div class="problem-action-buttons-wrapper">
</div>
</div>
<div class="notification warning notification-gentle-alert
is-hidden"
tabindex="-1">
<span class="icon fa fa-exclamation-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-02-leap-year-code-review-problem-title">
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification warning notification-save
is-hidden"
tabindex="-1">
<span class="icon fa fa-save" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-02-leap-year-code-review-problem-title">None
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification general notification-show-answer
is-hidden"
tabindex="-1">
<span class="icon fa fa-info-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-02-leap-year-code-review-problem-title">Answers are displayed within the problem
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
</div>
"
data-graded="True">
<p class="loading-spinner">
<i class="fa fa-spinner fa-pulse fa-2x fa-fw"></i>
<span class="sr">Loading…</span>
</p>
</div>
</div>
</div>
<div class="vert vert-2" data-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-03-partitioning">
<div class="xblock xblock-public_view xblock-public_view-problem xmodule_display xmodule_ProblemBlock" data-has-score="True" data-runtime-class="LmsRuntime" data-request-token="66e5f01c684311ef860c0214bd5530e3" data-usage-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-03-partitioning" data-block-type="problem" data-graded="True" data-init="XBlockToXModuleShim" data-course-id="course-v1:MITx+6.005.1x+3T2016" data-runtime-version="1">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "Problem"}
</script>
<div id="problem_exam-03-partitioning" class="problems-wrapper" role="group"
aria-labelledby="exam-03-partitioning-problem-title"
data-problem-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-03-partitioning" data-url="/courses/course-v1:MITx+6.005.1x+3T2016/xblock/block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-03-partitioning/handler/xmodule_handler"
data-problem-score="0.0"
data-problem-total-possible="2.0"
data-attempts-used="0"
data-content="
<h3 class="hd hd-3 problem-header" id="exam-03-partitioning-problem-title" aria-describedby="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-03-partitioning-problem-progress" tabindex="-1">
Partitioning
</h3>
<div class="problem-progress" id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-03-partitioning-problem-progress"></div>
<div class="problem">
<div>
<p>Consider the following specification:</p>
<pre class="code">
/**
* Reverses the end of a string.
*
* 012345 012345
* For example: reverseEnd("Hello, world", 5) returns "Hellodlrow ,"
* &lt;-----&gt; &lt;-----&gt;
*
* With start == 0, reverses the entire text.
* With start == text.length(), reverses nothing.
*
* @param text non-null String that will have its end reversed
* @param start the index at which the remainder of the input is reversed,
* requires 0 &lt;= start &lt;= text.length()
* @return input text with the substring from start to the end of the string reversed
*/
public static String reverseEnd(String text, int start)
</pre>
<p>Which of the following are reasonable partitions for the start parameter? Check all that apply.</p>
<div class="wrapper-problem-response" tabindex="-1" aria-label="Question 1" role="group"><div class="choicegroup capa_inputtype" id="inputtype_exam-03-partitioning_2_1">
<fieldset aria-describedby="status_exam-03-partitioning_2_1">
<div class="field">
<input value="choice_0" class="field-input input-checkbox" id="input_exam-03-partitioning_2_1_choice_0" name="input_exam-03-partitioning_2_1[]" type="checkbox"/><label class="response-label field-label label-inline" id="exam-03-partitioning_2_1-choice_0-label" aria-describedby="status_exam-03-partitioning_2_1" for="input_exam-03-partitioning_2_1_choice_0"> start = 0, start = 5, start = 100
</label>
</div>
<div class="field">
<input value="choice_1" class="field-input input-checkbox" id="input_exam-03-partitioning_2_1_choice_1" name="input_exam-03-partitioning_2_1[]" type="checkbox"/><label class="response-label field-label label-inline" id="exam-03-partitioning_2_1-choice_1-label" aria-describedby="status_exam-03-partitioning_2_1" for="input_exam-03-partitioning_2_1_choice_1"> start &lt; 0, start = 0, start &gt; 0
</label>
</div>
<div class="field">
<input value="choice_2" class="field-input input-checkbox" id="input_exam-03-partitioning_2_1_choice_2" name="input_exam-03-partitioning_2_1[]" type="checkbox"/><label class="response-label field-label label-inline" id="exam-03-partitioning_2_1-choice_2-label" aria-describedby="status_exam-03-partitioning_2_1" for="input_exam-03-partitioning_2_1_choice_2"> start = 0, 0 &lt; start &lt; text.length(), start = text.length()
</label>
</div>
<div class="field">
<input value="choice_3" class="field-input input-checkbox" id="input_exam-03-partitioning_2_1_choice_3" name="input_exam-03-partitioning_2_1[]" type="checkbox"/><label class="response-label field-label label-inline" id="exam-03-partitioning_2_1-choice_3-label" aria-describedby="status_exam-03-partitioning_2_1" for="input_exam-03-partitioning_2_1_choice_3"> start &lt; text.length(), start = text.length(), start &gt; text.length()
</label>
</div>
<span id="answer_exam-03-partitioning_2_1"/>
</fieldset>
<div class="indicator-container">
<span class="status unanswered" id="status_exam-03-partitioning_2_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
</div>
</div></div>
<div class="solution-span">
<span id="solution_exam-03-partitioning_solution_1"/>
</div></div>
<div class="action">
<input type="hidden" name="problem_id" value="Partitioning" />
<div class="submit-attempt-container">
<button type="button" class="submit btn-brand" data-submitting="Submitting" data-value="Submit" data-should-enable-submit-button="True" aria-describedby="submission_feedback_exam-03-partitioning" >
<span class="submit-label">Submit</span>
</button>
<div class="submission-feedback" id="submission_feedback_exam-03-partitioning">
<span class="sr">Some problems have options such as save, reset, hints, or show answer. These options follow the Submit button.</span>
</div>
</div>
<div class="problem-action-buttons-wrapper">
</div>
</div>
<div class="notification warning notification-gentle-alert
is-hidden"
tabindex="-1">
<span class="icon fa fa-exclamation-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-03-partitioning-problem-title">
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification warning notification-save
is-hidden"
tabindex="-1">
<span class="icon fa fa-save" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-03-partitioning-problem-title">None
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification general notification-show-answer
is-hidden"
tabindex="-1">
<span class="icon fa fa-info-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-03-partitioning-problem-title">Answers are displayed within the problem
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
</div>
"
data-graded="True">
<p class="loading-spinner">
<i class="fa fa-spinner fa-pulse fa-2x fa-fw"></i>
<span class="sr">Loading…</span>
</p>
</div>
</div>
</div>
<div class="vert vert-3" data-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-03-nq">
<div class="xblock xblock-public_view xblock-public_view-problem xmodule_display xmodule_ProblemBlock" data-has-score="True" data-runtime-class="LmsRuntime" data-request-token="66e5f01c684311ef860c0214bd5530e3" data-usage-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-03-nq" data-block-type="problem" data-graded="True" data-init="XBlockToXModuleShim" data-course-id="course-v1:MITx+6.005.1x+3T2016" data-runtime-version="1">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "Problem"}
</script>
<div id="problem_exam-03-nq" class="problems-wrapper" role="group"
aria-labelledby="exam-03-nq-problem-title"
data-problem-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-03-nq" data-url="/courses/course-v1:MITx+6.005.1x+3T2016/xblock/block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-03-nq/handler/xmodule_handler"
data-problem-score="0.0"
data-problem-total-possible="4.0"
data-attempts-used="0"
data-content="
<h3 class="hd hd-3 problem-header" id="exam-03-nq-problem-title" aria-describedby="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-03-nq-problem-progress" tabindex="-1">
sin(x)
</h3>
<div class="problem-progress" id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-03-nq-problem-progress"></div>
<div class="problem">
<div>
<p>Which of the following are reasonable partitions for <code>sin(x)</code>?</p>
<div class="wrapper-problem-response" tabindex="-1" aria-label="Question 1" role="group"><div class="choicegroup capa_inputtype" id="inputtype_exam-03-nq_2_1">
<fieldset aria-describedby="status_exam-03-nq_2_1">
<div class="field">
<input type="checkbox" name="input_exam-03-nq_2_1[]" id="input_exam-03-nq_2_1_choice_0" class="field-input input-checkbox" value="choice_0"/><label id="exam-03-nq_2_1-choice_0-label" for="input_exam-03-nq_2_1_choice_0" class="response-label field-label label-inline" aria-describedby="status_exam-03-nq_2_1"> the return value is negative, positive, or zero
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-03-nq_2_1[]" id="input_exam-03-nq_2_1_choice_1" class="field-input input-checkbox" value="choice_1"/><label id="exam-03-nq_2_1-choice_1-label" for="input_exam-03-nq_2_1_choice_1" class="response-label field-label label-inline" aria-describedby="status_exam-03-nq_2_1"> x = 0, x = &#960;, x = -&#960;
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-03-nq_2_1[]" id="input_exam-03-nq_2_1_choice_2" class="field-input input-checkbox" value="choice_2"/><label id="exam-03-nq_2_1-choice_2-label" for="input_exam-03-nq_2_1_choice_2" class="response-label field-label label-inline" aria-describedby="status_exam-03-nq_2_1"> the lines that EclEmma turns green, yellow, or red
</label>
</div>
<span id="answer_exam-03-nq_2_1"/>
</fieldset>
<div class="indicator-container">
<span class="status unanswered" id="status_exam-03-nq_2_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
</div>
</div></div>
<p>Which of the following are boundary values for <code>sin(x)</code>?</p>
<div class="wrapper-problem-response" tabindex="-1" aria-label="Question 2" role="group"><div class="choicegroup capa_inputtype" id="inputtype_exam-03-nq_3_1">
<fieldset aria-describedby="status_exam-03-nq_3_1">
<div class="field">
<input type="checkbox" name="input_exam-03-nq_3_1[]" id="input_exam-03-nq_3_1_choice_0" class="field-input input-checkbox" value="choice_0"/><label id="exam-03-nq_3_1-choice_0-label" for="input_exam-03-nq_3_1_choice_0" class="response-label field-label label-inline" aria-describedby="status_exam-03-nq_3_1"> x = 0
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-03-nq_3_1[]" id="input_exam-03-nq_3_1_choice_1" class="field-input input-checkbox" value="choice_1"/><label id="exam-03-nq_3_1-choice_1-label" for="input_exam-03-nq_3_1_choice_1" class="response-label field-label label-inline" aria-describedby="status_exam-03-nq_3_1"> x = &#960;
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-03-nq_3_1[]" id="input_exam-03-nq_3_1_choice_2" class="field-input input-checkbox" value="choice_2"/><label id="exam-03-nq_3_1-choice_2-label" for="input_exam-03-nq_3_1_choice_2" class="response-label field-label label-inline" aria-describedby="status_exam-03-nq_3_1"> x = &#960;/2
</label>
</div>
<span id="answer_exam-03-nq_3_1"/>
</fieldset>
<div class="indicator-container">
<span class="status unanswered" id="status_exam-03-nq_3_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
</div>
</div></div>
<div class="solution-span">
<span id="solution_exam-03-nq_solution_1"/>
</div></div>
<div class="action">
<input type="hidden" name="problem_id" value="sin(x)" />
<div class="submit-attempt-container">
<button type="button" class="submit btn-brand" data-submitting="Submitting" data-value="Submit" data-should-enable-submit-button="True" aria-describedby="submission_feedback_exam-03-nq" >
<span class="submit-label">Submit</span>
</button>
<div class="submission-feedback" id="submission_feedback_exam-03-nq">
<span class="sr">Some problems have options such as save, reset, hints, or show answer. These options follow the Submit button.</span>
</div>
</div>
<div class="problem-action-buttons-wrapper">
</div>
</div>
<div class="notification warning notification-gentle-alert
is-hidden"
tabindex="-1">
<span class="icon fa fa-exclamation-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-03-nq-problem-title">
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification warning notification-save
is-hidden"
tabindex="-1">
<span class="icon fa fa-save" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-03-nq-problem-title">None
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification general notification-show-answer
is-hidden"
tabindex="-1">
<span class="icon fa fa-info-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-03-nq-problem-title">Answers are displayed within the problem
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
</div>
"
data-graded="True">
<p class="loading-spinner">
<i class="fa fa-spinner fa-pulse fa-2x fa-fw"></i>
<span class="sr">Loading…</span>
</p>
</div>
</div>
</div>
<div class="vert vert-4" data-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-03-testing-techniques">
<div class="xblock xblock-public_view xblock-public_view-problem xmodule_display xmodule_ProblemBlock" data-has-score="True" data-runtime-class="LmsRuntime" data-request-token="66e5f01c684311ef860c0214bd5530e3" data-usage-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-03-testing-techniques" data-block-type="problem" data-graded="True" data-init="XBlockToXModuleShim" data-course-id="course-v1:MITx+6.005.1x+3T2016" data-runtime-version="1">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "Problem"}
</script>
<div id="problem_exam-03-testing-techniques" class="problems-wrapper" role="group"
aria-labelledby="exam-03-testing-techniques-problem-title"
data-problem-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-03-testing-techniques" data-url="/courses/course-v1:MITx+6.005.1x+3T2016/xblock/block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-03-testing-techniques/handler/xmodule_handler"
data-problem-score="0.0"
data-problem-total-possible="3.0"
data-attempts-used="0"
data-content="
<h3 class="hd hd-3 problem-header" id="exam-03-testing-techniques-problem-title" aria-describedby="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-03-testing-techniques-problem-progress" tabindex="-1">
Test-First Programming
</h3>
<div class="problem-progress" id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-03-testing-techniques-problem-progress"></div>
<div class="problem">
<div>
<p>Which of these techniques are useful for choosing test cases in test-first programming, before any code is written? Check all that apply.</p>
<div class="wrapper-problem-response" tabindex="-1" aria-label="Question 1" role="group"><div class="choicegroup capa_inputtype" id="inputtype_exam-03-testing-techniques_2_1">
<fieldset aria-describedby="status_exam-03-testing-techniques_2_1">
<div class="field">
<input type="checkbox" name="input_exam-03-testing-techniques_2_1[]" id="input_exam-03-testing-techniques_2_1_choice_0" class="field-input input-checkbox" value="choice_0"/><label id="exam-03-testing-techniques_2_1-choice_0-label" for="input_exam-03-testing-techniques_2_1_choice_0" class="response-label field-label label-inline" aria-describedby="status_exam-03-testing-techniques_2_1"> black box
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-03-testing-techniques_2_1[]" id="input_exam-03-testing-techniques_2_1_choice_1" class="field-input input-checkbox" value="choice_1"/><label id="exam-03-testing-techniques_2_1-choice_1-label" for="input_exam-03-testing-techniques_2_1_choice_1" class="response-label field-label label-inline" aria-describedby="status_exam-03-testing-techniques_2_1"> boundaries
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-03-testing-techniques_2_1[]" id="input_exam-03-testing-techniques_2_1_choice_2" class="field-input input-checkbox" value="choice_2"/><label id="exam-03-testing-techniques_2_1-choice_2-label" for="input_exam-03-testing-techniques_2_1_choice_2" class="response-label field-label label-inline" aria-describedby="status_exam-03-testing-techniques_2_1"> coverage
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-03-testing-techniques_2_1[]" id="input_exam-03-testing-techniques_2_1_choice_3" class="field-input input-checkbox" value="choice_3"/><label id="exam-03-testing-techniques_2_1-choice_3-label" for="input_exam-03-testing-techniques_2_1_choice_3" class="response-label field-label label-inline" aria-describedby="status_exam-03-testing-techniques_2_1"> partitioning
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-03-testing-techniques_2_1[]" id="input_exam-03-testing-techniques_2_1_choice_4" class="field-input input-checkbox" value="choice_4"/><label id="exam-03-testing-techniques_2_1-choice_4-label" for="input_exam-03-testing-techniques_2_1_choice_4" class="response-label field-label label-inline" aria-describedby="status_exam-03-testing-techniques_2_1"> regression
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-03-testing-techniques_2_1[]" id="input_exam-03-testing-techniques_2_1_choice_5" class="field-input input-checkbox" value="choice_5"/><label id="exam-03-testing-techniques_2_1-choice_5-label" for="input_exam-03-testing-techniques_2_1_choice_5" class="response-label field-label label-inline" aria-describedby="status_exam-03-testing-techniques_2_1"> static typing
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-03-testing-techniques_2_1[]" id="input_exam-03-testing-techniques_2_1_choice_6" class="field-input input-checkbox" value="choice_6"/><label id="exam-03-testing-techniques_2_1-choice_6-label" for="input_exam-03-testing-techniques_2_1_choice_6" class="response-label field-label label-inline" aria-describedby="status_exam-03-testing-techniques_2_1"> white box
</label>
</div>
<span id="answer_exam-03-testing-techniques_2_1"/>
</fieldset>
<div class="indicator-container">
<span class="status unanswered" id="status_exam-03-testing-techniques_2_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
</div>
</div></div>
<div class="solution-span">
<span id="solution_exam-03-testing-techniques_solution_1"/>
</div></div>
<div class="action">
<input type="hidden" name="problem_id" value="Test-First Programming" />
<div class="submit-attempt-container">
<button type="button" class="submit btn-brand" data-submitting="Submitting" data-value="Submit" data-should-enable-submit-button="True" aria-describedby="submission_feedback_exam-03-testing-techniques" >
<span class="submit-label">Submit</span>
</button>
<div class="submission-feedback" id="submission_feedback_exam-03-testing-techniques">
<span class="sr">Some problems have options such as save, reset, hints, or show answer. These options follow the Submit button.</span>
</div>
</div>
<div class="problem-action-buttons-wrapper">
</div>
</div>
<div class="notification warning notification-gentle-alert
is-hidden"
tabindex="-1">
<span class="icon fa fa-exclamation-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-03-testing-techniques-problem-title">
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification warning notification-save
is-hidden"
tabindex="-1">
<span class="icon fa fa-save" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-03-testing-techniques-problem-title">None
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification general notification-show-answer
is-hidden"
tabindex="-1">
<span class="icon fa fa-info-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-03-testing-techniques-problem-title">Answers are displayed within the problem
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
</div>
"
data-graded="True">
<p class="loading-spinner">
<i class="fa fa-spinner fa-pulse fa-2x fa-fw"></i>
<span class="sr">Loading…</span>
</p>
</div>
</div>
</div>
<div class="vert vert-5" data-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-03-nq2">
<div class="xblock xblock-public_view xblock-public_view-problem xmodule_display xmodule_ProblemBlock" data-has-score="True" data-runtime-class="LmsRuntime" data-request-token="66e5f01c684311ef860c0214bd5530e3" data-usage-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-03-nq2" data-block-type="problem" data-graded="True" data-init="XBlockToXModuleShim" data-course-id="course-v1:MITx+6.005.1x+3T2016" data-runtime-version="1">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "Problem"}
</script>
<div id="problem_exam-03-nq2" class="problems-wrapper" role="group"
aria-labelledby="exam-03-nq2-problem-title"
data-problem-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-03-nq2" data-url="/courses/course-v1:MITx+6.005.1x+3T2016/xblock/block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-03-nq2/handler/xmodule_handler"
data-problem-score="0.0"
data-problem-total-possible="2.0"
data-attempts-used="0"
data-content="
<h3 class="hd hd-3 problem-header" id="exam-03-nq2-problem-title" aria-describedby="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-03-nq2-problem-progress" tabindex="-1">
Regression Testing
</h3>
<div class="problem-progress" id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-03-nq2-problem-progress"></div>
<div class="problem">
<div>
<p>A regression test case:</p>
<div class="wrapper-problem-response" tabindex="-1" aria-label="Question 1" role="group"><div class="choicegroup capa_inputtype" id="inputtype_exam-03-nq2_2_1">
<fieldset aria-describedby="status_exam-03-nq2_2_1">
<div class="field">
<input type="checkbox" name="input_exam-03-nq2_2_1[]" id="input_exam-03-nq2_2_1_choice_0" class="field-input input-checkbox" value="choice_0"/><label id="exam-03-nq2_2_1-choice_0-label" for="input_exam-03-nq2_2_1_choice_0" class="response-label field-label label-inline" aria-describedby="status_exam-03-nq2_2_1"> is chosen from partitions
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-03-nq2_2_1[]" id="input_exam-03-nq2_2_1_choice_1" class="field-input input-checkbox" value="choice_1"/><label id="exam-03-nq2_2_1-choice_1-label" for="input_exam-03-nq2_2_1_choice_1" class="response-label field-label label-inline" aria-describedby="status_exam-03-nq2_2_1"> fails at first
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-03-nq2_2_1[]" id="input_exam-03-nq2_2_1_choice_2" class="field-input input-checkbox" value="choice_2"/><label id="exam-03-nq2_2_1-choice_2-label" for="input_exam-03-nq2_2_1_choice_2" class="response-label field-label label-inline" aria-describedby="status_exam-03-nq2_2_1"> can come out of black-box testing
</label>
</div>
<span id="answer_exam-03-nq2_2_1"/>
</fieldset>
<div class="indicator-container">
<span class="status unanswered" id="status_exam-03-nq2_2_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
</div>
</div></div>
<div class="solution-span">
<span id="solution_exam-03-nq2_solution_1"/>
</div></div>
<div class="action">
<input type="hidden" name="problem_id" value="Regression Testing" />
<div class="submit-attempt-container">
<button type="button" class="submit btn-brand" data-submitting="Submitting" data-value="Submit" data-should-enable-submit-button="True" aria-describedby="submission_feedback_exam-03-nq2" >
<span class="submit-label">Submit</span>
</button>
<div class="submission-feedback" id="submission_feedback_exam-03-nq2">
<span class="sr">Some problems have options such as save, reset, hints, or show answer. These options follow the Submit button.</span>
</div>
</div>
<div class="problem-action-buttons-wrapper">
</div>
</div>
<div class="notification warning notification-gentle-alert
is-hidden"
tabindex="-1">
<span class="icon fa fa-exclamation-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-03-nq2-problem-title">
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification warning notification-save
is-hidden"
tabindex="-1">
<span class="icon fa fa-save" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-03-nq2-problem-title">None
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification general notification-show-answer
is-hidden"
tabindex="-1">
<span class="icon fa fa-info-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-03-nq2-problem-title">Answers are displayed within the problem
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
</div>
"
data-graded="True">
<p class="loading-spinner">
<i class="fa fa-spinner fa-pulse fa-2x fa-fw"></i>
<span class="sr">Loading…</span>
</p>
</div>
</div>
</div>
</div>
</div>
<div class="xblock xblock-public_view xblock-public_view-vertical" data-has-score="False" data-runtime-class="LmsRuntime" data-request-token="66e5f01c684311ef860c0214bd5530e3" data-usage-id="block-v1:MITx+6.005.1x+3T2016+type@vertical+block@Part_3" data-block-type="vertical" data-graded="True" data-init="VerticalStudentView" data-course-id="course-v1:MITx+6.005.1x+3T2016" data-runtime-version="1">
<h2 class="hd hd-2 unit-title">Part 3</h2>
<div class="vert-mod">
<div class="vert vert-0" data-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-04-greatest-common-denominator">
<div class="xblock xblock-public_view xblock-public_view-problem xmodule_display xmodule_ProblemBlock" data-has-score="True" data-runtime-class="LmsRuntime" data-request-token="66e5f01c684311ef860c0214bd5530e3" data-usage-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-04-greatest-common-denominator" data-block-type="problem" data-graded="True" data-init="XBlockToXModuleShim" data-course-id="course-v1:MITx+6.005.1x+3T2016" data-runtime-version="1">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "Problem"}
</script>
<div id="problem_exam-04-greatest-common-denominator" class="problems-wrapper" role="group"
aria-labelledby="exam-04-greatest-common-denominator-problem-title"
data-problem-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-04-greatest-common-denominator" data-url="/courses/course-v1:MITx+6.005.1x+3T2016/xblock/block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-04-greatest-common-denominator/handler/xmodule_handler"
data-problem-score="0.0"
data-problem-total-possible="4.0"
data-attempts-used="0"
data-content="
<h3 class="hd hd-3 problem-header" id="exam-04-greatest-common-denominator-problem-title" aria-describedby="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-04-greatest-common-denominator-problem-progress" tabindex="-1">
Preconditions
</h3>
<div class="problem-progress" id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-04-greatest-common-denominator-problem-progress"></div>
<div class="problem">
<div>
<p>Alice writes the following code:</p>
<pre class="code">
public static int gcd(int a, int b) {
if (a &gt; b) {
return gcd(a-b, b);
} else if (b &gt; a) {
return gcd(a, b-a);
}
return a;
}
</pre>
<p>Bob writes the following test:</p>
<pre class="code">
@Test public void gcdTest() {
assertEquals(6, gcd(24, 54));
}
</pre>
<p>The test passes!</p>
<p>Alice should write <code>a &gt; 0</code> in the precondition comment of <code>gcd</code></p>
<div class="wrapper-problem-response" tabindex="-1" aria-label="Question 1" role="group"><div class="choicegroup capa_inputtype" id="inputtype_exam-04-greatest-common-denominator_2_1">
<fieldset aria-describedby="status_exam-04-greatest-common-denominator_2_1">
<div class="field">
<input type="radio" name="input_exam-04-greatest-common-denominator_2_1" id="input_exam-04-greatest-common-denominator_2_1_choice_0" class="field-input input-radio" value="choice_0"/><label id="exam-04-greatest-common-denominator_2_1-choice_0-label" for="input_exam-04-greatest-common-denominator_2_1_choice_0" class="response-label field-label label-inline" aria-describedby="status_exam-04-greatest-common-denominator_2_1"> True
</label>
</div>
<div class="field">
<input type="radio" name="input_exam-04-greatest-common-denominator_2_1" id="input_exam-04-greatest-common-denominator_2_1_choice_1" class="field-input input-radio" value="choice_1"/><label id="exam-04-greatest-common-denominator_2_1-choice_1-label" for="input_exam-04-greatest-common-denominator_2_1_choice_1" class="response-label field-label label-inline" aria-describedby="status_exam-04-greatest-common-denominator_2_1"> False
</label>
</div>
<span id="answer_exam-04-greatest-common-denominator_2_1"/>
</fieldset>
<div class="indicator-container">
<span class="status unanswered" id="status_exam-04-greatest-common-denominator_2_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
</div>
</div></div>
<p>Alice should write <code>b &gt; 0</code> in the precondition comment of <code>gcd</code></p>
<div class="wrapper-problem-response" tabindex="-1" aria-label="Question 2" role="group"><div class="choicegroup capa_inputtype" id="inputtype_exam-04-greatest-common-denominator_3_1">
<fieldset aria-describedby="status_exam-04-greatest-common-denominator_3_1">
<div class="field">
<input type="radio" name="input_exam-04-greatest-common-denominator_3_1" id="input_exam-04-greatest-common-denominator_3_1_choice_0" class="field-input input-radio" value="choice_0"/><label id="exam-04-greatest-common-denominator_3_1-choice_0-label" for="input_exam-04-greatest-common-denominator_3_1_choice_0" class="response-label field-label label-inline" aria-describedby="status_exam-04-greatest-common-denominator_3_1"> True
</label>
</div>
<div class="field">
<input type="radio" name="input_exam-04-greatest-common-denominator_3_1" id="input_exam-04-greatest-common-denominator_3_1_choice_1" class="field-input input-radio" value="choice_1"/><label id="exam-04-greatest-common-denominator_3_1-choice_1-label" for="input_exam-04-greatest-common-denominator_3_1_choice_1" class="response-label field-label label-inline" aria-describedby="status_exam-04-greatest-common-denominator_3_1"> False
</label>
</div>
<span id="answer_exam-04-greatest-common-denominator_3_1"/>
</fieldset>
<div class="indicator-container">
<span class="status unanswered" id="status_exam-04-greatest-common-denominator_3_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
</div>
</div></div>
<p> Alice should write <code>gcd(a, b) &gt; 0</code> in the precondition comment of <code>gcd</code></p>
<div class="wrapper-problem-response" tabindex="-1" aria-label="Question 3" role="group"><div class="choicegroup capa_inputtype" id="inputtype_exam-04-greatest-common-denominator_4_1">
<fieldset aria-describedby="status_exam-04-greatest-common-denominator_4_1">
<div class="field">
<input type="radio" name="input_exam-04-greatest-common-denominator_4_1" id="input_exam-04-greatest-common-denominator_4_1_choice_0" class="field-input input-radio" value="choice_0"/><label id="exam-04-greatest-common-denominator_4_1-choice_0-label" for="input_exam-04-greatest-common-denominator_4_1_choice_0" class="response-label field-label label-inline" aria-describedby="status_exam-04-greatest-common-denominator_4_1"> True
</label>
</div>
<div class="field">
<input type="radio" name="input_exam-04-greatest-common-denominator_4_1" id="input_exam-04-greatest-common-denominator_4_1_choice_1" class="field-input input-radio" value="choice_1"/><label id="exam-04-greatest-common-denominator_4_1-choice_1-label" for="input_exam-04-greatest-common-denominator_4_1_choice_1" class="response-label field-label label-inline" aria-describedby="status_exam-04-greatest-common-denominator_4_1"> False
</label>
</div>
<span id="answer_exam-04-greatest-common-denominator_4_1"/>
</fieldset>
<div class="indicator-container">
<span class="status unanswered" id="status_exam-04-greatest-common-denominator_4_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
</div>
</div></div>
<p> Alice should write <code>a and b are integers</code> in the precondition comment of <code>gcd</code></p>
<div class="wrapper-problem-response" tabindex="-1" aria-label="Question 4" role="group"><div class="choicegroup capa_inputtype" id="inputtype_exam-04-greatest-common-denominator_5_1">
<fieldset aria-describedby="status_exam-04-greatest-common-denominator_5_1">
<div class="field">
<input type="radio" name="input_exam-04-greatest-common-denominator_5_1" id="input_exam-04-greatest-common-denominator_5_1_choice_0" class="field-input input-radio" value="choice_0"/><label id="exam-04-greatest-common-denominator_5_1-choice_0-label" for="input_exam-04-greatest-common-denominator_5_1_choice_0" class="response-label field-label label-inline" aria-describedby="status_exam-04-greatest-common-denominator_5_1"> True
</label>
</div>
<div class="field">
<input type="radio" name="input_exam-04-greatest-common-denominator_5_1" id="input_exam-04-greatest-common-denominator_5_1_choice_1" class="field-input input-radio" value="choice_1"/><label id="exam-04-greatest-common-denominator_5_1-choice_1-label" for="input_exam-04-greatest-common-denominator_5_1_choice_1" class="response-label field-label label-inline" aria-describedby="status_exam-04-greatest-common-denominator_5_1"> False
</label>
</div>
<span id="answer_exam-04-greatest-common-denominator_5_1"/>
</fieldset>
<div class="indicator-container">
<span class="status unanswered" id="status_exam-04-greatest-common-denominator_5_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
</div>
</div></div>
<div class="solution-span">
<span id="solution_exam-04-greatest-common-denominator_solution_1"/>
</div></div>
<div class="action">
<input type="hidden" name="problem_id" value="Preconditions" />
<div class="submit-attempt-container">
<button type="button" class="submit btn-brand" data-submitting="Submitting" data-value="Submit" data-should-enable-submit-button="True" aria-describedby="submission_feedback_exam-04-greatest-common-denominator" >
<span class="submit-label">Submit</span>
</button>
<div class="submission-feedback" id="submission_feedback_exam-04-greatest-common-denominator">
<span class="sr">Some problems have options such as save, reset, hints, or show answer. These options follow the Submit button.</span>
</div>
</div>
<div class="problem-action-buttons-wrapper">
</div>
</div>
<div class="notification warning notification-gentle-alert
is-hidden"
tabindex="-1">
<span class="icon fa fa-exclamation-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-04-greatest-common-denominator-problem-title">
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification warning notification-save
is-hidden"
tabindex="-1">
<span class="icon fa fa-save" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-04-greatest-common-denominator-problem-title">None
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification general notification-show-answer
is-hidden"
tabindex="-1">
<span class="icon fa fa-info-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-04-greatest-common-denominator-problem-title">Answers are displayed within the problem
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
</div>
"
data-graded="True">
<p class="loading-spinner">
<i class="fa fa-spinner fa-pulse fa-2x fa-fw"></i>
<span class="sr">Loading…</span>
</p>
</div>
</div>
</div>
<div class="vert vert-1" data-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-04-nq">
<div class="xblock xblock-public_view xblock-public_view-problem xmodule_display xmodule_ProblemBlock" data-has-score="True" data-runtime-class="LmsRuntime" data-request-token="66e5f01c684311ef860c0214bd5530e3" data-usage-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-04-nq" data-block-type="problem" data-graded="True" data-init="XBlockToXModuleShim" data-course-id="course-v1:MITx+6.005.1x+3T2016" data-runtime-version="1">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "Problem"}
</script>
<div id="problem_exam-04-nq" class="problems-wrapper" role="group"
aria-labelledby="exam-04-nq-problem-title"
data-problem-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-04-nq" data-url="/courses/course-v1:MITx+6.005.1x+3T2016/xblock/block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-04-nq/handler/xmodule_handler"
data-problem-score="0.0"
data-problem-total-possible="3.0"
data-attempts-used="0"
data-content="
<h3 class="hd hd-3 problem-header" id="exam-04-nq-problem-title" aria-describedby="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-04-nq-problem-progress" tabindex="-1">
Valid Test Cases
</h3>
<div class="problem-progress" id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-04-nq-problem-progress"></div>
<div class="problem">
<div>
<p>Given this specification:</p>
<pre><code>static int find(int[] arr, int val)
<em>requires</em>: arr[0] == val
<em>effects</em>: returns index i such that arr[i] == val
</code></pre>
<p>Which are valid test cases for <code>find</code>?</p>
<div class="wrapper-problem-response" tabindex="-1" aria-label="Question 1" role="group"><div class="choicegroup capa_inputtype" id="inputtype_exam-04-nq_2_1">
<fieldset aria-describedby="status_exam-04-nq_2_1">
<div class="field">
<input type="checkbox" name="input_exam-04-nq_2_1[]" id="input_exam-04-nq_2_1_choice_0" class="field-input input-checkbox" value="choice_0"/><label id="exam-04-nq_2_1-choice_0-label" for="input_exam-04-nq_2_1_choice_0" class="response-label field-label label-inline" aria-describedby="status_exam-04-nq_2_1"> find([ 1, 2, 3 ], 1) must return 0
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-04-nq_2_1[]" id="input_exam-04-nq_2_1_choice_1" class="field-input input-checkbox" value="choice_1"/><label id="exam-04-nq_2_1-choice_1-label" for="input_exam-04-nq_2_1_choice_1" class="response-label field-label label-inline" aria-describedby="status_exam-04-nq_2_1"> find([ 4, 4, 5 ], 4) must return 1
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-04-nq_2_1[]" id="input_exam-04-nq_2_1_choice_2" class="field-input input-checkbox" value="choice_2"/><label id="exam-04-nq_2_1-choice_2-label" for="input_exam-04-nq_2_1_choice_2" class="response-label field-label label-inline" aria-describedby="status_exam-04-nq_2_1"> find([ 6, 7, 8 ], 2) throws an exception
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-04-nq_2_1[]" id="input_exam-04-nq_2_1_choice_3" class="field-input input-checkbox" value="choice_3"/><label id="exam-04-nq_2_1-choice_3-label" for="input_exam-04-nq_2_1_choice_3" class="response-label field-label label-inline" aria-describedby="status_exam-04-nq_2_1"> find([ 3 ], 3) must return 0
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-04-nq_2_1[]" id="input_exam-04-nq_2_1_choice_4" class="field-input input-checkbox" value="choice_4"/><label id="exam-04-nq_2_1-choice_4-label" for="input_exam-04-nq_2_1_choice_4" class="response-label field-label label-inline" aria-describedby="status_exam-04-nq_2_1"> find([ 4 ], 5) must not return 0
</label>
</div>
<span id="answer_exam-04-nq_2_1"/>
</fieldset>
<div class="indicator-container">
<span class="status unanswered" id="status_exam-04-nq_2_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
</div>
</div></div>
<div class="solution-span">
<span id="solution_exam-04-nq_solution_1"/>
</div></div>
<div class="action">
<input type="hidden" name="problem_id" value="Valid Test Cases" />
<div class="submit-attempt-container">
<button type="button" class="submit btn-brand" data-submitting="Submitting" data-value="Submit" data-should-enable-submit-button="True" aria-describedby="submission_feedback_exam-04-nq" >
<span class="submit-label">Submit</span>
</button>
<div class="submission-feedback" id="submission_feedback_exam-04-nq">
<span class="sr">Some problems have options such as save, reset, hints, or show answer. These options follow the Submit button.</span>
</div>
</div>
<div class="problem-action-buttons-wrapper">
</div>
</div>
<div class="notification warning notification-gentle-alert
is-hidden"
tabindex="-1">
<span class="icon fa fa-exclamation-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-04-nq-problem-title">
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification warning notification-save
is-hidden"
tabindex="-1">
<span class="icon fa fa-save" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-04-nq-problem-title">None
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification general notification-show-answer
is-hidden"
tabindex="-1">
<span class="icon fa fa-info-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-04-nq-problem-title">Answers are displayed within the problem
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
</div>
"
data-graded="True">
<p class="loading-spinner">
<i class="fa fa-spinner fa-pulse fa-2x fa-fw"></i>
<span class="sr">Loading…</span>
</p>
</div>
</div>
</div>
<div class="vert vert-2" data-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-04-logical-implication">
<div class="xblock xblock-public_view xblock-public_view-problem xmodule_display xmodule_ProblemBlock" data-has-score="True" data-runtime-class="LmsRuntime" data-request-token="66e5f01c684311ef860c0214bd5530e3" data-usage-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-04-logical-implication" data-block-type="problem" data-graded="True" data-init="XBlockToXModuleShim" data-course-id="course-v1:MITx+6.005.1x+3T2016" data-runtime-version="1">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "Problem"}
</script>
<div id="problem_exam-04-logical-implication" class="problems-wrapper" role="group"
aria-labelledby="exam-04-logical-implication-problem-title"
data-problem-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-04-logical-implication" data-url="/courses/course-v1:MITx+6.005.1x+3T2016/xblock/block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-04-logical-implication/handler/xmodule_handler"
data-problem-score="0.0"
data-problem-total-possible="3.0"
data-attempts-used="0"
data-content="
<h3 class="hd hd-3 problem-header" id="exam-04-logical-implication-problem-title" aria-describedby="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-04-logical-implication-problem-progress" tabindex="-1">
Contracts
</h3>
<div class="problem-progress" id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-04-logical-implication-problem-progress"></div>
<div class="problem">
<div>
<p>Consider this spec:</p>
<pre><p>static int find(int[] arr, int val)
<em>requires</em>: val occurs exactly once in arr
<em>effects</em>: returns index i such that arr[i] = val</p></pre>
<p>As the implementer of <code>find</code>, which are legal? Check all that apply.</p>
<div class="wrapper-problem-response" tabindex="-1" aria-label="Question 1" role="group"><div class="choicegroup capa_inputtype" id="inputtype_exam-04-logical-implication_2_1">
<fieldset aria-describedby="status_exam-04-logical-implication_2_1">
<div class="field">
<input type="checkbox" name="input_exam-04-logical-implication_2_1[]" id="input_exam-04-logical-implication_2_1_choice_0" class="field-input input-checkbox" value="choice_0"/><label id="exam-04-logical-implication_2_1-choice_0-label" for="input_exam-04-logical-implication_2_1_choice_0" class="response-label field-label label-inline" aria-describedby="status_exam-04-logical-implication_2_1"> if arr is empty, return 0
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-04-logical-implication_2_1[]" id="input_exam-04-logical-implication_2_1_choice_1" class="field-input input-checkbox" value="choice_1"/><label id="exam-04-logical-implication_2_1-choice_1-label" for="input_exam-04-logical-implication_2_1_choice_1" class="response-label field-label label-inline" aria-describedby="status_exam-04-logical-implication_2_1"> if arr is empty, throw an exception
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-04-logical-implication_2_1[]" id="input_exam-04-logical-implication_2_1_choice_2" class="field-input input-checkbox" value="choice_2"/><label id="exam-04-logical-implication_2_1-choice_2-label" for="input_exam-04-logical-implication_2_1_choice_2" class="response-label field-label label-inline" aria-describedby="status_exam-04-logical-implication_2_1"> if val occurs twice in arr, throw an exception
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-04-logical-implication_2_1[]" id="input_exam-04-logical-implication_2_1_choice_3" class="field-input input-checkbox" value="choice_3"/><label id="exam-04-logical-implication_2_1-choice_3-label" for="input_exam-04-logical-implication_2_1_choice_3" class="response-label field-label label-inline" aria-describedby="status_exam-04-logical-implication_2_1"> if val occurs twice in arr, set all the values in arr to zero, then throw an exception
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-04-logical-implication_2_1[]" id="input_exam-04-logical-implication_2_1_choice_4" class="field-input input-checkbox" value="choice_4"/><label id="exam-04-logical-implication_2_1-choice_4-label" for="input_exam-04-logical-implication_2_1_choice_4" class="response-label field-label label-inline" aria-describedby="status_exam-04-logical-implication_2_1"> if arr is not empty but val doesn&#8217;t occur, pick an index at random, set it to val, and return that index
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-04-logical-implication_2_1[]" id="input_exam-04-logical-implication_2_1_choice_5" class="field-input input-checkbox" value="choice_5"/><label id="exam-04-logical-implication_2_1-choice_5-label" for="input_exam-04-logical-implication_2_1_choice_5" class="response-label field-label label-inline" aria-describedby="status_exam-04-logical-implication_2_1"> if arr[0] is val, continue checking the rest of the array and return the highest index where you find val (or 0 if you don&#8217;t find it again)
</label>
</div>
<span id="answer_exam-04-logical-implication_2_1"/>
</fieldset>
<div class="indicator-container">
<span class="status unanswered" id="status_exam-04-logical-implication_2_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
</div>
</div></div>
<div class="solution-span">
<span id="solution_exam-04-logical-implication_solution_1"/>
</div></div>
<div class="action">
<input type="hidden" name="problem_id" value="Contracts" />
<div class="submit-attempt-container">
<button type="button" class="submit btn-brand" data-submitting="Submitting" data-value="Submit" data-should-enable-submit-button="True" aria-describedby="submission_feedback_exam-04-logical-implication" >
<span class="submit-label">Submit</span>
</button>
<div class="submission-feedback" id="submission_feedback_exam-04-logical-implication">
<span class="sr">Some problems have options such as save, reset, hints, or show answer. These options follow the Submit button.</span>
</div>
</div>
<div class="problem-action-buttons-wrapper">
</div>
</div>
<div class="notification warning notification-gentle-alert
is-hidden"
tabindex="-1">
<span class="icon fa fa-exclamation-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-04-logical-implication-problem-title">
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification warning notification-save
is-hidden"
tabindex="-1">
<span class="icon fa fa-save" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-04-logical-implication-problem-title">None
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification general notification-show-answer
is-hidden"
tabindex="-1">
<span class="icon fa fa-info-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-04-logical-implication-problem-title">Answers are displayed within the problem
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
</div>
"
data-graded="True">
<p class="loading-spinner">
<i class="fa fa-spinner fa-pulse fa-2x fa-fw"></i>
<span class="sr">Loading…</span>
</p>
</div>
</div>
</div>
<div class="vert vert-3" data-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-05-nq">
<div class="xblock xblock-public_view xblock-public_view-problem xmodule_display xmodule_ProblemBlock" data-has-score="True" data-runtime-class="LmsRuntime" data-request-token="66e5f01c684311ef860c0214bd5530e3" data-usage-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-05-nq" data-block-type="problem" data-graded="True" data-init="XBlockToXModuleShim" data-course-id="course-v1:MITx+6.005.1x+3T2016" data-runtime-version="1">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "Problem"}
</script>
<div id="problem_exam-05-nq" class="problems-wrapper" role="group"
aria-labelledby="exam-05-nq-problem-title"
data-problem-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-05-nq" data-url="/courses/course-v1:MITx+6.005.1x+3T2016/xblock/block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-05-nq/handler/xmodule_handler"
data-problem-score="0.0"
data-problem-total-possible="4.0"
data-attempts-used="0"
data-content="
<h3 class="hd hd-3 problem-header" id="exam-05-nq-problem-title" aria-describedby="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-05-nq-problem-progress" tabindex="-1">
Spec Strength
</h3>
<div class="problem-progress" id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-05-nq-problem-progress"></div>
<div class="problem">
<div>
<p>Assuming everybody follows the spec, what can an implementor do, without looking at or changing any clients?</p>
<div class="wrapper-problem-response" tabindex="-1" aria-label="Question 1" role="group"><div class="choicegroup capa_inputtype" id="inputtype_exam-05-nq_2_1">
<fieldset aria-describedby="status_exam-05-nq_2_1">
<div class="field">
<input type="checkbox" name="input_exam-05-nq_2_1[]" id="input_exam-05-nq_2_1_choice_0" class="field-input input-checkbox" value="choice_0"/><label id="exam-05-nq_2_1-choice_0-label" for="input_exam-05-nq_2_1_choice_0" class="response-label field-label label-inline" aria-describedby="status_exam-05-nq_2_1"> make the spec stronger
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-05-nq_2_1[]" id="input_exam-05-nq_2_1_choice_1" class="field-input input-checkbox" value="choice_1"/><label id="exam-05-nq_2_1-choice_1-label" for="input_exam-05-nq_2_1_choice_1" class="response-label field-label label-inline" aria-describedby="status_exam-05-nq_2_1"> assume a weaker postcondition than the spec
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-05-nq_2_1[]" id="input_exam-05-nq_2_1_choice_2" class="field-input input-checkbox" value="choice_2"/><label id="exam-05-nq_2_1-choice_2-label" for="input_exam-05-nq_2_1_choice_2" class="response-label field-label label-inline" aria-describedby="status_exam-05-nq_2_1"> make the implementation stronger than the spec
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-05-nq_2_1[]" id="input_exam-05-nq_2_1_choice_3" class="field-input input-checkbox" value="choice_3"/><label id="exam-05-nq_2_1-choice_3-label" for="input_exam-05-nq_2_1_choice_3" class="response-label field-label label-inline" aria-describedby="status_exam-05-nq_2_1"> make the implementation incomparable with the spec
</label>
</div>
<span id="answer_exam-05-nq_2_1"/>
</fieldset>
<div class="indicator-container">
<span class="status unanswered" id="status_exam-05-nq_2_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
</div>
</div></div>
<div class="solution-span">
<span id="solution_exam-05-nq_solution_1"/>
</div><p>Assuming everybody follows the spec, what can a single client do, without looking at or changing the implementation or any other clients?</p>
<div class="wrapper-problem-response" tabindex="-1" aria-label="Question 2" role="group"><div class="choicegroup capa_inputtype" id="inputtype_exam-05-nq_3_1">
<fieldset aria-describedby="status_exam-05-nq_3_1">
<div class="field">
<input type="checkbox" name="input_exam-05-nq_3_1[]" id="input_exam-05-nq_3_1_choice_0" class="field-input input-checkbox" value="choice_0"/><label id="exam-05-nq_3_1-choice_0-label" for="input_exam-05-nq_3_1_choice_0" class="response-label field-label label-inline" aria-describedby="status_exam-05-nq_3_1"> make the spec stronger
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-05-nq_3_1[]" id="input_exam-05-nq_3_1_choice_1" class="field-input input-checkbox" value="choice_1"/><label id="exam-05-nq_3_1-choice_1-label" for="input_exam-05-nq_3_1_choice_1" class="response-label field-label label-inline" aria-describedby="status_exam-05-nq_3_1"> assume a weaker postcondition than the spec
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-05-nq_3_1[]" id="input_exam-05-nq_3_1_choice_2" class="field-input input-checkbox" value="choice_2"/><label id="exam-05-nq_3_1-choice_2-label" for="input_exam-05-nq_3_1_choice_2" class="response-label field-label label-inline" aria-describedby="status_exam-05-nq_3_1"> assume the implementation is stronger than the spec
</label>
</div>
<span id="answer_exam-05-nq_3_1"/>
</fieldset>
<div class="indicator-container">
<span class="status unanswered" id="status_exam-05-nq_3_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
</div>
</div></div>
<div class="solution-span">
<span id="solution_exam-05-nq_solution_2"/>
</div></div>
<div class="action">
<input type="hidden" name="problem_id" value="Spec Strength" />
<div class="submit-attempt-container">
<button type="button" class="submit btn-brand" data-submitting="Submitting" data-value="Submit" data-should-enable-submit-button="True" aria-describedby="submission_feedback_exam-05-nq" >
<span class="submit-label">Submit</span>
</button>
<div class="submission-feedback" id="submission_feedback_exam-05-nq">
<span class="sr">Some problems have options such as save, reset, hints, or show answer. These options follow the Submit button.</span>
</div>
</div>
<div class="problem-action-buttons-wrapper">
</div>
</div>
<div class="notification warning notification-gentle-alert
is-hidden"
tabindex="-1">
<span class="icon fa fa-exclamation-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-05-nq-problem-title">
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification warning notification-save
is-hidden"
tabindex="-1">
<span class="icon fa fa-save" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-05-nq-problem-title">None
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification general notification-show-answer
is-hidden"
tabindex="-1">
<span class="icon fa fa-info-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-05-nq-problem-title">Answers are displayed within the problem
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
</div>
"
data-graded="True">
<p class="loading-spinner">
<i class="fa fa-spinner fa-pulse fa-2x fa-fw"></i>
<span class="sr">Loading…</span>
</p>
</div>
</div>
</div>
<div class="vert vert-4" data-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-05-strength-is-truth">
<div class="xblock xblock-public_view xblock-public_view-problem xmodule_display xmodule_ProblemBlock" data-has-score="True" data-runtime-class="LmsRuntime" data-request-token="66e5f01c684311ef860c0214bd5530e3" data-usage-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-05-strength-is-truth" data-block-type="problem" data-graded="True" data-init="XBlockToXModuleShim" data-course-id="course-v1:MITx+6.005.1x+3T2016" data-runtime-version="1">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "Problem"}
</script>
<div id="problem_exam-05-strength-is-truth" class="problems-wrapper" role="group"
aria-labelledby="exam-05-strength-is-truth-problem-title"
data-problem-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-05-strength-is-truth" data-url="/courses/course-v1:MITx+6.005.1x+3T2016/xblock/block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-05-strength-is-truth/handler/xmodule_handler"
data-problem-score="0.0"
data-problem-total-possible="3.0"
data-attempts-used="0"
data-content="
<h3 class="hd hd-3 problem-header" id="exam-05-strength-is-truth-problem-title" aria-describedby="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-05-strength-is-truth-problem-progress" tabindex="-1">
Stronger and Weaker
</h3>
<div class="problem-progress" id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-05-strength-is-truth-problem-progress"></div>
<div class="problem">
<div>
<p>Which of the following can be true about a pair of specifications <em>A</em> and <em>B</em>? Check all that apply.</p>
<div class="wrapper-problem-response" tabindex="-1" aria-label="Question 1" role="group"><div class="choicegroup capa_inputtype" id="inputtype_exam-05-strength-is-truth_2_1">
<fieldset aria-describedby="status_exam-05-strength-is-truth_2_1">
<div class="field">
<input type="checkbox" name="input_exam-05-strength-is-truth_2_1[]" id="input_exam-05-strength-is-truth_2_1_choice_0" class="field-input input-checkbox" value="choice_0"/><label id="exam-05-strength-is-truth_2_1-choice_0-label" for="input_exam-05-strength-is-truth_2_1_choice_0" class="response-label field-label label-inline" aria-describedby="status_exam-05-strength-is-truth_2_1"> 1. <em>A</em> can be stronger than <em>B</em> and have a weaker precondition
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-05-strength-is-truth_2_1[]" id="input_exam-05-strength-is-truth_2_1_choice_1" class="field-input input-checkbox" value="choice_1"/><label id="exam-05-strength-is-truth_2_1-choice_1-label" for="input_exam-05-strength-is-truth_2_1_choice_1" class="response-label field-label label-inline" aria-describedby="status_exam-05-strength-is-truth_2_1"> 2. <em>A</em> can be stronger than <em>B</em> and have the same precondition
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-05-strength-is-truth_2_1[]" id="input_exam-05-strength-is-truth_2_1_choice_2" class="field-input input-checkbox" value="choice_2"/><label id="exam-05-strength-is-truth_2_1-choice_2-label" for="input_exam-05-strength-is-truth_2_1_choice_2" class="response-label field-label label-inline" aria-describedby="status_exam-05-strength-is-truth_2_1"> 3. <em>A</em> can be stronger than <em>B</em> and have a stronger precondition
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-05-strength-is-truth_2_1[]" id="input_exam-05-strength-is-truth_2_1_choice_3" class="field-input input-checkbox" value="choice_3"/><label id="exam-05-strength-is-truth_2_1-choice_3-label" for="input_exam-05-strength-is-truth_2_1_choice_3" class="response-label field-label label-inline" aria-describedby="status_exam-05-strength-is-truth_2_1"> 4. <em>A</em> can be stronger than <em>B</em> and have an incomparable precondition
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-05-strength-is-truth_2_1[]" id="input_exam-05-strength-is-truth_2_1_choice_4" class="field-input input-checkbox" value="choice_4"/><label id="exam-05-strength-is-truth_2_1-choice_4-label" for="input_exam-05-strength-is-truth_2_1_choice_4" class="response-label field-label label-inline" aria-describedby="status_exam-05-strength-is-truth_2_1"> 5. <em>A</em> can be incomparable to <em>B</em>
</label>
</div>
<span id="answer_exam-05-strength-is-truth_2_1"/>
</fieldset>
<div class="indicator-container">
<span class="status unanswered" id="status_exam-05-strength-is-truth_2_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
</div>
</div></div>
<div class="solution-span">
<span id="solution_exam-05-strength-is-truth_solution_1"/>
</div></div>
<div class="action">
<input type="hidden" name="problem_id" value="Stronger and Weaker" />
<div class="submit-attempt-container">
<button type="button" class="submit btn-brand" data-submitting="Submitting" data-value="Submit" data-should-enable-submit-button="True" aria-describedby="submission_feedback_exam-05-strength-is-truth" >
<span class="submit-label">Submit</span>
</button>
<div class="submission-feedback" id="submission_feedback_exam-05-strength-is-truth">
<span class="sr">Some problems have options such as save, reset, hints, or show answer. These options follow the Submit button.</span>
</div>
</div>
<div class="problem-action-buttons-wrapper">
</div>
</div>
<div class="notification warning notification-gentle-alert
is-hidden"
tabindex="-1">
<span class="icon fa fa-exclamation-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-05-strength-is-truth-problem-title">
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification warning notification-save
is-hidden"
tabindex="-1">
<span class="icon fa fa-save" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-05-strength-is-truth-problem-title">None
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification general notification-show-answer
is-hidden"
tabindex="-1">
<span class="icon fa fa-info-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-05-strength-is-truth-problem-title">Answers are displayed within the problem
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
</div>
"
data-graded="True">
<p class="loading-spinner">
<i class="fa fa-spinner fa-pulse fa-2x fa-fw"></i>
<span class="sr">Loading…</span>
</p>
</div>
</div>
</div>
</div>
</div>
<div class="xblock xblock-public_view xblock-public_view-vertical" data-has-score="False" data-runtime-class="LmsRuntime" data-request-token="66e5f01c684311ef860c0214bd5530e3" data-usage-id="block-v1:MITx+6.005.1x+3T2016+type@vertical+block@Part_4" data-block-type="vertical" data-graded="True" data-init="VerticalStudentView" data-course-id="course-v1:MITx+6.005.1x+3T2016" data-runtime-version="1">
<h2 class="hd hd-2 unit-title">Part 4</h2>
<div class="vert-mod">
<div class="vert vert-0" data-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-06-nq">
<div class="xblock xblock-public_view xblock-public_view-problem xmodule_display xmodule_ProblemBlock" data-has-score="True" data-runtime-class="LmsRuntime" data-request-token="66e5f01c684311ef860c0214bd5530e3" data-usage-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-06-nq" data-block-type="problem" data-graded="True" data-init="XBlockToXModuleShim" data-course-id="course-v1:MITx+6.005.1x+3T2016" data-runtime-version="1">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "Problem"}
</script>
<div id="problem_exam-06-nq" class="problems-wrapper" role="group"
aria-labelledby="exam-06-nq-problem-title"
data-problem-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-06-nq" data-url="/courses/course-v1:MITx+6.005.1x+3T2016/xblock/block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-06-nq/handler/xmodule_handler"
data-problem-score="0.0"
data-problem-total-possible="4.0"
data-attempts-used="0"
data-content="
<h3 class="hd hd-3 problem-header" id="exam-06-nq-problem-title" aria-describedby="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-06-nq-problem-progress" tabindex="-1">
An Interview
</h3>
<div class="problem-progress" id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-06-nq-problem-progress"></div>
<div class="problem">
<div>
<p>Suppose you are listening to an interview candidate for a
software development job. Which statements show that they
know what they're talking about?</p>
<div class="wrapper-problem-response" tabindex="-1" aria-label="Question 1" role="group"><div class="choicegroup capa_inputtype" id="inputtype_exam-06-nq_2_1">
<fieldset aria-describedby="status_exam-06-nq_2_1">
<div class="field">
<input type="checkbox" name="input_exam-06-nq_2_1[]" id="input_exam-06-nq_2_1_choice_0" class="field-input input-checkbox" value="choice_0"/><label id="exam-06-nq_2_1-choice_0-label" for="input_exam-06-nq_2_1_choice_0" class="response-label field-label label-inline" aria-describedby="status_exam-06-nq_2_1"> "JUnit assertions run even when Java's assertions are turned off."
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-06-nq_2_1[]" id="input_exam-06-nq_2_1_choice_1" class="field-input input-checkbox" value="choice_1"/><label id="exam-06-nq_2_1-choice_1-label" for="input_exam-06-nq_2_1_choice_1" class="response-label field-label label-inline" aria-describedby="status_exam-06-nq_2_1"> "I try to make sure every variable has the widest possible scope."
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-06-nq_2_1[]" id="input_exam-06-nq_2_1_choice_2" class="field-input input-checkbox" value="choice_2"/><label id="exam-06-nq_2_1-choice_2-label" for="input_exam-06-nq_2_1_choice_2" class="response-label field-label label-inline" aria-describedby="status_exam-06-nq_2_1"> "I usually declare local variables <code>final</code>, unless they point to mutable objects."
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-06-nq_2_1[]" id="input_exam-06-nq_2_1_choice_3" class="field-input input-checkbox" value="choice_3"/><label id="exam-06-nq_2_1-choice_3-label" for="input_exam-06-nq_2_1_choice_3" class="response-label field-label label-inline" aria-describedby="status_exam-06-nq_2_1"> "Checking the method's precondition is good defensive programming."
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-06-nq_2_1[]" id="input_exam-06-nq_2_1_choice_4" class="field-input input-checkbox" value="choice_4"/><label id="exam-06-nq_2_1-choice_4-label" for="input_exam-06-nq_2_1_choice_4" class="response-label field-label label-inline" aria-describedby="status_exam-06-nq_2_1"> "The risk of a <code>public static final</code> variable is that it can be reassigned anywhere in your program."
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-06-nq_2_1[]" id="input_exam-06-nq_2_1_choice_5" class="field-input input-checkbox" value="choice_5"/><label id="exam-06-nq_2_1-choice_5-label" for="input_exam-06-nq_2_1_choice_5" class="response-label field-label label-inline" aria-describedby="status_exam-06-nq_2_1"> "Assertions belong in test cases, not in implementation code."
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-06-nq_2_1[]" id="input_exam-06-nq_2_1_choice_6" class="field-input input-checkbox" value="choice_6"/><label id="exam-06-nq_2_1-choice_6-label" for="input_exam-06-nq_2_1_choice_6" class="response-label field-label label-inline" aria-describedby="status_exam-06-nq_2_1"> "Java assertions can be turned on and off without changing code."
</label>
</div>
<span id="answer_exam-06-nq_2_1"/>
</fieldset>
<div class="indicator-container">
<span class="status unanswered" id="status_exam-06-nq_2_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
</div>
</div></div>
<div class="solution-span">
<span id="solution_exam-06-nq_solution_1"/>
</div></div>
<div class="action">
<input type="hidden" name="problem_id" value="An Interview" />
<div class="submit-attempt-container">
<button type="button" class="submit btn-brand" data-submitting="Submitting" data-value="Submit" data-should-enable-submit-button="True" aria-describedby="submission_feedback_exam-06-nq" >
<span class="submit-label">Submit</span>
</button>
<div class="submission-feedback" id="submission_feedback_exam-06-nq">
<span class="sr">Some problems have options such as save, reset, hints, or show answer. These options follow the Submit button.</span>
</div>
</div>
<div class="problem-action-buttons-wrapper">
</div>
</div>
<div class="notification warning notification-gentle-alert
is-hidden"
tabindex="-1">
<span class="icon fa fa-exclamation-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-06-nq-problem-title">
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification warning notification-save
is-hidden"
tabindex="-1">
<span class="icon fa fa-save" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-06-nq-problem-title">None
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification general notification-show-answer
is-hidden"
tabindex="-1">
<span class="icon fa fa-info-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-06-nq-problem-title">Answers are displayed within the problem
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
</div>
"
data-graded="True">
<p class="loading-spinner">
<i class="fa fa-spinner fa-pulse fa-2x fa-fw"></i>
<span class="sr">Loading…</span>
</p>
</div>
</div>
</div>
<div class="vert vert-1" data-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-06-final-references-immutable-objects">
<div class="xblock xblock-public_view xblock-public_view-problem xmodule_display xmodule_ProblemBlock" data-has-score="True" data-runtime-class="LmsRuntime" data-request-token="66e5f01c684311ef860c0214bd5530e3" data-usage-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-06-final-references-immutable-objects" data-block-type="problem" data-graded="True" data-init="XBlockToXModuleShim" data-course-id="course-v1:MITx+6.005.1x+3T2016" data-runtime-version="1">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "Problem"}
</script>
<div id="problem_exam-06-final-references-immutable-objects" class="problems-wrapper" role="group"
aria-labelledby="exam-06-final-references-immutable-objects-problem-title"
data-problem-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-06-final-references-immutable-objects" data-url="/courses/course-v1:MITx+6.005.1x+3T2016/xblock/block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-06-final-references-immutable-objects/handler/xmodule_handler"
data-problem-score="0.0"
data-problem-total-possible="3.0"
data-attempts-used="0"
data-content="
<h3 class="hd hd-3 problem-header" id="exam-06-final-references-immutable-objects-problem-title" aria-describedby="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-06-final-references-immutable-objects-problem-progress" tabindex="-1">
final
</h3>
<div class="problem-progress" id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-06-final-references-immutable-objects-problem-progress"></div>
<div class="problem">
<div>
<p>Consider the following code, executed in order:</p>
<pre class="code">
char vowel0 = 'a';
final char vowel1 = vowel0;
String vowel2 = vowel1 + "eiou";
final String vowel3 = vowel2;
char[] vowel4 = new char[] { vowel0, 'e', 'i', 'o', 'u' };
final char[] vowel5 = vowel4;
</pre>
<p>Which of the following statements are legal Java (i.e. produce no compiler error if placed after the code above)? Check all that apply.</p>
<div class="wrapper-problem-response" tabindex="-1" aria-label="Question 1" role="group"><div class="choicegroup capa_inputtype" id="inputtype_exam-06-final-references-immutable-objects_2_1">
<fieldset aria-describedby="status_exam-06-final-references-immutable-objects_2_1">
<div class="field">
<input type="checkbox" name="input_exam-06-final-references-immutable-objects_2_1[]" id="input_exam-06-final-references-immutable-objects_2_1_choice_0" class="field-input input-checkbox" value="choice_0"/><label id="exam-06-final-references-immutable-objects_2_1-choice_0-label" for="input_exam-06-final-references-immutable-objects_2_1_choice_0" class="response-label field-label label-inline" aria-describedby="status_exam-06-final-references-immutable-objects_2_1"> vowel0 = vowel1
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-06-final-references-immutable-objects_2_1[]" id="input_exam-06-final-references-immutable-objects_2_1_choice_1" class="field-input input-checkbox" value="choice_1"/><label id="exam-06-final-references-immutable-objects_2_1-choice_1-label" for="input_exam-06-final-references-immutable-objects_2_1_choice_1" class="response-label field-label label-inline" aria-describedby="status_exam-06-final-references-immutable-objects_2_1"> vowel1 = vowel0
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-06-final-references-immutable-objects_2_1[]" id="input_exam-06-final-references-immutable-objects_2_1_choice_2" class="field-input input-checkbox" value="choice_2"/><label id="exam-06-final-references-immutable-objects_2_1-choice_2-label" for="input_exam-06-final-references-immutable-objects_2_1_choice_2" class="response-label field-label label-inline" aria-describedby="status_exam-06-final-references-immutable-objects_2_1"> vowel2 = vowel3
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-06-final-references-immutable-objects_2_1[]" id="input_exam-06-final-references-immutable-objects_2_1_choice_3" class="field-input input-checkbox" value="choice_3"/><label id="exam-06-final-references-immutable-objects_2_1-choice_3-label" for="input_exam-06-final-references-immutable-objects_2_1_choice_3" class="response-label field-label label-inline" aria-describedby="status_exam-06-final-references-immutable-objects_2_1"> vowel3 = vowel2
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-06-final-references-immutable-objects_2_1[]" id="input_exam-06-final-references-immutable-objects_2_1_choice_4" class="field-input input-checkbox" value="choice_4"/><label id="exam-06-final-references-immutable-objects_2_1-choice_4-label" for="input_exam-06-final-references-immutable-objects_2_1_choice_4" class="response-label field-label label-inline" aria-describedby="status_exam-06-final-references-immutable-objects_2_1"> vowel2[0] = 'x'
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-06-final-references-immutable-objects_2_1[]" id="input_exam-06-final-references-immutable-objects_2_1_choice_5" class="field-input input-checkbox" value="choice_5"/><label id="exam-06-final-references-immutable-objects_2_1-choice_5-label" for="input_exam-06-final-references-immutable-objects_2_1_choice_5" class="response-label field-label label-inline" aria-describedby="status_exam-06-final-references-immutable-objects_2_1"> vowel3[0] = 'x'
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-06-final-references-immutable-objects_2_1[]" id="input_exam-06-final-references-immutable-objects_2_1_choice_6" class="field-input input-checkbox" value="choice_6"/><label id="exam-06-final-references-immutable-objects_2_1-choice_6-label" for="input_exam-06-final-references-immutable-objects_2_1_choice_6" class="response-label field-label label-inline" aria-describedby="status_exam-06-final-references-immutable-objects_2_1"> vowel4 = vowel5
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-06-final-references-immutable-objects_2_1[]" id="input_exam-06-final-references-immutable-objects_2_1_choice_7" class="field-input input-checkbox" value="choice_7"/><label id="exam-06-final-references-immutable-objects_2_1-choice_7-label" for="input_exam-06-final-references-immutable-objects_2_1_choice_7" class="response-label field-label label-inline" aria-describedby="status_exam-06-final-references-immutable-objects_2_1"> vowel5 = vowel4
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-06-final-references-immutable-objects_2_1[]" id="input_exam-06-final-references-immutable-objects_2_1_choice_8" class="field-input input-checkbox" value="choice_8"/><label id="exam-06-final-references-immutable-objects_2_1-choice_8-label" for="input_exam-06-final-references-immutable-objects_2_1_choice_8" class="response-label field-label label-inline" aria-describedby="status_exam-06-final-references-immutable-objects_2_1"> vowel4[0] = 'x'
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-06-final-references-immutable-objects_2_1[]" id="input_exam-06-final-references-immutable-objects_2_1_choice_9" class="field-input input-checkbox" value="choice_9"/><label id="exam-06-final-references-immutable-objects_2_1-choice_9-label" for="input_exam-06-final-references-immutable-objects_2_1_choice_9" class="response-label field-label label-inline" aria-describedby="status_exam-06-final-references-immutable-objects_2_1"> vowel5[0] = 'x'
</label>
</div>
<span id="answer_exam-06-final-references-immutable-objects_2_1"/>
</fieldset>
<div class="indicator-container">
<span class="status unanswered" id="status_exam-06-final-references-immutable-objects_2_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
</div>
</div></div>
<div class="solution-span">
<span id="solution_exam-06-final-references-immutable-objects_solution_1"/>
</div></div>
<div class="action">
<input type="hidden" name="problem_id" value="final" />
<div class="submit-attempt-container">
<button type="button" class="submit btn-brand" data-submitting="Submitting" data-value="Submit" data-should-enable-submit-button="True" aria-describedby="submission_feedback_exam-06-final-references-immutable-objects" >
<span class="submit-label">Submit</span>
</button>
<div class="submission-feedback" id="submission_feedback_exam-06-final-references-immutable-objects">
<span class="sr">Some problems have options such as save, reset, hints, or show answer. These options follow the Submit button.</span>
</div>
</div>
<div class="problem-action-buttons-wrapper">
</div>
</div>
<div class="notification warning notification-gentle-alert
is-hidden"
tabindex="-1">
<span class="icon fa fa-exclamation-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-06-final-references-immutable-objects-problem-title">
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification warning notification-save
is-hidden"
tabindex="-1">
<span class="icon fa fa-save" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-06-final-references-immutable-objects-problem-title">None
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification general notification-show-answer
is-hidden"
tabindex="-1">
<span class="icon fa fa-info-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-06-final-references-immutable-objects-problem-title">Answers are displayed within the problem
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
</div>
"
data-graded="True">
<p class="loading-spinner">
<i class="fa fa-spinner fa-pulse fa-2x fa-fw"></i>
<span class="sr">Loading…</span>
</p>
</div>
</div>
</div>
<div class="vert vert-2" data-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-07-follow-me">
<div class="xblock xblock-public_view xblock-public_view-problem xmodule_display xmodule_ProblemBlock" data-has-score="True" data-runtime-class="LmsRuntime" data-request-token="66e5f01c684311ef860c0214bd5530e3" data-usage-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-07-follow-me" data-block-type="problem" data-graded="True" data-init="XBlockToXModuleShim" data-course-id="course-v1:MITx+6.005.1x+3T2016" data-runtime-version="1">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "Problem"}
</script>
<div id="problem_exam-07-follow-me" class="problems-wrapper" role="group"
aria-labelledby="exam-07-follow-me-problem-title"
data-problem-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-07-follow-me" data-url="/courses/course-v1:MITx+6.005.1x+3T2016/xblock/block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-07-follow-me/handler/xmodule_handler"
data-problem-score="0.0"
data-problem-total-possible="4.0"
data-attempts-used="0"
data-content="
<h3 class="hd hd-3 problem-header" id="exam-07-follow-me-problem-title" aria-describedby="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-07-follow-me-problem-progress" tabindex="-1">
Mutability
</h3>
<div class="problem-progress" id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-07-follow-me-problem-progress"></div>
<div class="problem">
<div>
<img src="/assets/courseware/v1/42cad8e7200c7b4bdd48e9cce21b4dd9/asset-v1:MITx+6.005.1x+3T2016+type@asset+block/07-snapshot-diagram.png" width="400"/>
<br/>
<p>Is it possible that a client with the variable <code>terrarium</code> could modify the <code>Turtle</code> object in red?</p>
<div class="wrapper-problem-response" tabindex="-1" aria-label="Question 1" role="group"><div class="choicegroup capa_inputtype" id="inputtype_exam-07-follow-me_2_1">
<fieldset aria-describedby="status_exam-07-follow-me_2_1">
<div class="field">
<input type="radio" name="input_exam-07-follow-me_2_1" id="input_exam-07-follow-me_2_1_choice_0" class="field-input input-radio" value="choice_0"/><label id="exam-07-follow-me_2_1-choice_0-label" for="input_exam-07-follow-me_2_1_choice_0" class="response-label field-label label-inline" aria-describedby="status_exam-07-follow-me_2_1"> Yes, because all the references between "terrarium" and the "Turtle" are mutable
</label>
</div>
<div class="field">
<input type="radio" name="input_exam-07-follow-me_2_1" id="input_exam-07-follow-me_2_1_choice_1" class="field-input input-radio" value="choice_1"/><label id="exam-07-follow-me_2_1-choice_1-label" for="input_exam-07-follow-me_2_1_choice_1" class="response-label field-label label-inline" aria-describedby="status_exam-07-follow-me_2_1"> Yes, because of some reference between "terrarium" and the "Turtle" that is mutable
</label>
</div>
<div class="field">
<input type="radio" name="input_exam-07-follow-me_2_1" id="input_exam-07-follow-me_2_1_choice_2" class="field-input input-radio" value="choice_2"/><label id="exam-07-follow-me_2_1-choice_2-label" for="input_exam-07-follow-me_2_1_choice_2" class="response-label field-label label-inline" aria-describedby="status_exam-07-follow-me_2_1"> Yes, because the "Turtle" is mutable
</label>
</div>
<div class="field">
<input type="radio" name="input_exam-07-follow-me_2_1" id="input_exam-07-follow-me_2_1_choice_3" class="field-input input-radio" value="choice_3"/><label id="exam-07-follow-me_2_1-choice_3-label" for="input_exam-07-follow-me_2_1_choice_3" class="response-label field-label label-inline" aria-describedby="status_exam-07-follow-me_2_1"> No, because the "Turtle" is immutable
</label>
</div>
<div class="field">
<input type="radio" name="input_exam-07-follow-me_2_1" id="input_exam-07-follow-me_2_1_choice_4" class="field-input input-radio" value="choice_4"/><label id="exam-07-follow-me_2_1-choice_4-label" for="input_exam-07-follow-me_2_1_choice_4" class="response-label field-label label-inline" aria-describedby="status_exam-07-follow-me_2_1"> No, because of some reference between "terrarium" and the "Turtle" that is immutable
</label>
</div>
<div class="field">
<input type="radio" name="input_exam-07-follow-me_2_1" id="input_exam-07-follow-me_2_1_choice_5" class="field-input input-radio" value="choice_5"/><label id="exam-07-follow-me_2_1-choice_5-label" for="input_exam-07-follow-me_2_1_choice_5" class="response-label field-label label-inline" aria-describedby="status_exam-07-follow-me_2_1"> No, because all the references between "terrarium" and the "Turtle" are immutable
</label>
</div>
<span id="answer_exam-07-follow-me_2_1"/>
</fieldset>
<div class="indicator-container">
<span class="status unanswered" id="status_exam-07-follow-me_2_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
</div>
</div></div>
<div class="solution-span">
<span id="solution_exam-07-follow-me_solution_1"/>
</div><p>Is it possible that a client with the variable <code>petStore</code> could do something such that a client with the variable <code>terrarium</code> could no longer access the <code>Gecko</code> in blue?</p>
<div class="wrapper-problem-response" tabindex="-1" aria-label="Question 2" role="group"><div class="choicegroup capa_inputtype" id="inputtype_exam-07-follow-me_3_1">
<fieldset aria-describedby="status_exam-07-follow-me_3_1">
<div class="field">
<input type="radio" name="input_exam-07-follow-me_3_1" id="input_exam-07-follow-me_3_1_choice_0" class="field-input input-radio" value="choice_0"/><label id="exam-07-follow-me_3_1-choice_0-label" for="input_exam-07-follow-me_3_1_choice_0" class="response-label field-label label-inline" aria-describedby="status_exam-07-follow-me_3_1"> Yes, because all the references between "petStore" and the "Gecko" are mutable
</label>
</div>
<div class="field">
<input type="radio" name="input_exam-07-follow-me_3_1" id="input_exam-07-follow-me_3_1_choice_1" class="field-input input-radio" value="choice_1"/><label id="exam-07-follow-me_3_1-choice_1-label" for="input_exam-07-follow-me_3_1_choice_1" class="response-label field-label label-inline" aria-describedby="status_exam-07-follow-me_3_1"> Yes, because of some reference between "petStore" and the "Gecko" that is mutable
</label>
</div>
<div class="field">
<input type="radio" name="input_exam-07-follow-me_3_1" id="input_exam-07-follow-me_3_1_choice_2" class="field-input input-radio" value="choice_2"/><label id="exam-07-follow-me_3_1-choice_2-label" for="input_exam-07-follow-me_3_1_choice_2" class="response-label field-label label-inline" aria-describedby="status_exam-07-follow-me_3_1"> Yes, because the "Gecko" is mutable
</label>
</div>
<div class="field">
<input type="radio" name="input_exam-07-follow-me_3_1" id="input_exam-07-follow-me_3_1_choice_3" class="field-input input-radio" value="choice_3"/><label id="exam-07-follow-me_3_1-choice_3-label" for="input_exam-07-follow-me_3_1_choice_3" class="response-label field-label label-inline" aria-describedby="status_exam-07-follow-me_3_1"> No, because the "Gecko" is immutable
</label>
</div>
<div class="field">
<input type="radio" name="input_exam-07-follow-me_3_1" id="input_exam-07-follow-me_3_1_choice_4" class="field-input input-radio" value="choice_4"/><label id="exam-07-follow-me_3_1-choice_4-label" for="input_exam-07-follow-me_3_1_choice_4" class="response-label field-label label-inline" aria-describedby="status_exam-07-follow-me_3_1"> No, because of some reference between "petStore" and the "Gecko" that is immutable
</label>
</div>
<div class="field">
<input type="radio" name="input_exam-07-follow-me_3_1" id="input_exam-07-follow-me_3_1_choice_5" class="field-input input-radio" value="choice_5"/><label id="exam-07-follow-me_3_1-choice_5-label" for="input_exam-07-follow-me_3_1_choice_5" class="response-label field-label label-inline" aria-describedby="status_exam-07-follow-me_3_1"> No, because all the references between "petStore" and the "Gecko" are immutable
</label>
</div>
<span id="answer_exam-07-follow-me_3_1"/>
</fieldset>
<div class="indicator-container">
<span class="status unanswered" id="status_exam-07-follow-me_3_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
</div>
</div></div>
<div class="solution-span">
<span id="solution_exam-07-follow-me_solution_2"/>
</div></div>
<div class="action">
<input type="hidden" name="problem_id" value="Mutability" />
<div class="submit-attempt-container">
<button type="button" class="submit btn-brand" data-submitting="Submitting" data-value="Submit" data-should-enable-submit-button="True" aria-describedby="submission_feedback_exam-07-follow-me" >
<span class="submit-label">Submit</span>
</button>
<div class="submission-feedback" id="submission_feedback_exam-07-follow-me">
<span class="sr">Some problems have options such as save, reset, hints, or show answer. These options follow the Submit button.</span>
</div>
</div>
<div class="problem-action-buttons-wrapper">
</div>
</div>
<div class="notification warning notification-gentle-alert
is-hidden"
tabindex="-1">
<span class="icon fa fa-exclamation-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-07-follow-me-problem-title">
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification warning notification-save
is-hidden"
tabindex="-1">
<span class="icon fa fa-save" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-07-follow-me-problem-title">None
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification general notification-show-answer
is-hidden"
tabindex="-1">
<span class="icon fa fa-info-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-07-follow-me-problem-title">Answers are displayed within the problem
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
</div>
"
data-graded="True">
<p class="loading-spinner">
<i class="fa fa-spinner fa-pulse fa-2x fa-fw"></i>
<span class="sr">Loading…</span>
</p>
</div>
</div>
</div>
<div class="vert vert-3" data-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-07-nq">
<div class="xblock xblock-public_view xblock-public_view-problem xmodule_display xmodule_ProblemBlock" data-has-score="True" data-runtime-class="LmsRuntime" data-request-token="66e5f01c684311ef860c0214bd5530e3" data-usage-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-07-nq" data-block-type="problem" data-graded="True" data-init="XBlockToXModuleShim" data-course-id="course-v1:MITx+6.005.1x+3T2016" data-runtime-version="1">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "Problem"}
</script>
<div id="problem_exam-07-nq" class="problems-wrapper" role="group"
aria-labelledby="exam-07-nq-problem-title"
data-problem-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-07-nq" data-url="/courses/course-v1:MITx+6.005.1x+3T2016/xblock/block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-07-nq/handler/xmodule_handler"
data-problem-score="0.0"
data-problem-total-possible="3.0"
data-attempts-used="0"
data-content="
<h3 class="hd hd-3 problem-header" id="exam-07-nq-problem-title" aria-describedby="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-07-nq-problem-progress" tabindex="-1">
Reassignment and Mutation
</h3>
<div class="problem-progress" id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-07-nq-problem-progress"></div>
<div class="problem">
<div>
<p>Each of the following lines of Java code declares a variable.</p>
<pre>
String a = "hello";
static String b = "hello";
final String c = a;
final String d = b;
</pre>
<p>For which of the variables does Java guarantee that it won't be reassigned?</p>
<div class="wrapper-problem-response" tabindex="-1" aria-label="Question 1" role="group"><div class="choicegroup capa_inputtype" id="inputtype_exam-07-nq_2_1">
<fieldset aria-describedby="status_exam-07-nq_2_1">
<div class="field">
<input type="checkbox" name="input_exam-07-nq_2_1[]" id="input_exam-07-nq_2_1_choice_0" class="field-input input-checkbox" value="choice_0"/><label id="exam-07-nq_2_1-choice_0-label" for="input_exam-07-nq_2_1_choice_0" class="response-label field-label label-inline" aria-describedby="status_exam-07-nq_2_1"> a
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-07-nq_2_1[]" id="input_exam-07-nq_2_1_choice_1" class="field-input input-checkbox" value="choice_1"/><label id="exam-07-nq_2_1-choice_1-label" for="input_exam-07-nq_2_1_choice_1" class="response-label field-label label-inline" aria-describedby="status_exam-07-nq_2_1"> b
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-07-nq_2_1[]" id="input_exam-07-nq_2_1_choice_2" class="field-input input-checkbox" value="choice_2"/><label id="exam-07-nq_2_1-choice_2-label" for="input_exam-07-nq_2_1_choice_2" class="response-label field-label label-inline" aria-describedby="status_exam-07-nq_2_1"> c
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-07-nq_2_1[]" id="input_exam-07-nq_2_1_choice_3" class="field-input input-checkbox" value="choice_3"/><label id="exam-07-nq_2_1-choice_3-label" for="input_exam-07-nq_2_1_choice_3" class="response-label field-label label-inline" aria-describedby="status_exam-07-nq_2_1"> d
</label>
</div>
<span id="answer_exam-07-nq_2_1"/>
</fieldset>
<div class="indicator-container">
<span class="status unanswered" id="status_exam-07-nq_2_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
</div>
</div></div>
<div class="solution-span">
<span id="solution_exam-07-nq_solution_1"/>
</div><p>Each of the following lines of Java code creates a new object.</p>
<pre>
String x = "hello";
final List&lt;String&gt; y = new ArrayList&lt;&gt;();
final List&lt;String&gt; z = Collections.unmodifiableList(y);
</pre>
<p>For which of the objects (denoted by the variable pointing to it) does Java guarantee that the object won't be mutated?</p>
<div class="wrapper-problem-response" tabindex="-1" aria-label="Question 2" role="group"><div class="choicegroup capa_inputtype" id="inputtype_exam-07-nq_3_1">
<fieldset aria-describedby="status_exam-07-nq_3_1">
<div class="field">
<input type="checkbox" name="input_exam-07-nq_3_1[]" id="input_exam-07-nq_3_1_choice_0" class="field-input input-checkbox" value="choice_0"/><label id="exam-07-nq_3_1-choice_0-label" for="input_exam-07-nq_3_1_choice_0" class="response-label field-label label-inline" aria-describedby="status_exam-07-nq_3_1"> x
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-07-nq_3_1[]" id="input_exam-07-nq_3_1_choice_1" class="field-input input-checkbox" value="choice_1"/><label id="exam-07-nq_3_1-choice_1-label" for="input_exam-07-nq_3_1_choice_1" class="response-label field-label label-inline" aria-describedby="status_exam-07-nq_3_1"> y
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-07-nq_3_1[]" id="input_exam-07-nq_3_1_choice_2" class="field-input input-checkbox" value="choice_2"/><label id="exam-07-nq_3_1-choice_2-label" for="input_exam-07-nq_3_1_choice_2" class="response-label field-label label-inline" aria-describedby="status_exam-07-nq_3_1"> z
</label>
</div>
<span id="answer_exam-07-nq_3_1"/>
</fieldset>
<div class="indicator-container">
<span class="status unanswered" id="status_exam-07-nq_3_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
</div>
</div></div>
<div class="solution-span">
<span id="solution_exam-07-nq_solution_2"/>
</div></div>
<div class="action">
<input type="hidden" name="problem_id" value="Reassignment and Mutation" />
<div class="submit-attempt-container">
<button type="button" class="submit btn-brand" data-submitting="Submitting" data-value="Submit" data-should-enable-submit-button="True" aria-describedby="submission_feedback_exam-07-nq" >
<span class="submit-label">Submit</span>
</button>
<div class="submission-feedback" id="submission_feedback_exam-07-nq">
<span class="sr">Some problems have options such as save, reset, hints, or show answer. These options follow the Submit button.</span>
</div>
</div>
<div class="problem-action-buttons-wrapper">
</div>
</div>
<div class="notification warning notification-gentle-alert
is-hidden"
tabindex="-1">
<span class="icon fa fa-exclamation-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-07-nq-problem-title">
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification warning notification-save
is-hidden"
tabindex="-1">
<span class="icon fa fa-save" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-07-nq-problem-title">None
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification general notification-show-answer
is-hidden"
tabindex="-1">
<span class="icon fa fa-info-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-07-nq-problem-title">Answers are displayed within the problem
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
</div>
"
data-graded="True">
<p class="loading-spinner">
<i class="fa fa-spinner fa-pulse fa-2x fa-fw"></i>
<span class="sr">Loading…</span>
</p>
</div>
</div>
</div>
<div class="vert vert-4" data-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-07-immutability-never-lies">
<div class="xblock xblock-public_view xblock-public_view-problem xmodule_display xmodule_ProblemBlock" data-has-score="True" data-runtime-class="LmsRuntime" data-request-token="66e5f01c684311ef860c0214bd5530e3" data-usage-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-07-immutability-never-lies" data-block-type="problem" data-graded="True" data-init="XBlockToXModuleShim" data-course-id="course-v1:MITx+6.005.1x+3T2016" data-runtime-version="1">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "Problem"}
</script>
<div id="problem_exam-07-immutability-never-lies" class="problems-wrapper" role="group"
aria-labelledby="exam-07-immutability-never-lies-problem-title"
data-problem-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-07-immutability-never-lies" data-url="/courses/course-v1:MITx+6.005.1x+3T2016/xblock/block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-07-immutability-never-lies/handler/xmodule_handler"
data-problem-score="0.0"
data-problem-total-possible="3.0"
data-attempts-used="0"
data-content="
<h3 class="hd hd-3 problem-header" id="exam-07-immutability-never-lies-problem-title" aria-describedby="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-07-immutability-never-lies-problem-progress" tabindex="-1">
Immutability
</h3>
<div class="problem-progress" id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-07-immutability-never-lies-problem-progress"></div>
<div class="problem">
<div>
<p>Which of the following are correct? Check all that apply.</p>
<div class="wrapper-problem-response" tabindex="-1" aria-label="Question 1" role="group"><div class="choicegroup capa_inputtype" id="inputtype_exam-07-immutability-never-lies_2_1">
<fieldset aria-describedby="status_exam-07-immutability-never-lies_2_1">
<div class="field">
<input type="checkbox" name="input_exam-07-immutability-never-lies_2_1[]" id="input_exam-07-immutability-never-lies_2_1_choice_0" class="field-input input-checkbox" value="choice_0"/><label id="exam-07-immutability-never-lies_2_1-choice_0-label" for="input_exam-07-immutability-never-lies_2_1_choice_0" class="response-label field-label label-inline" aria-describedby="status_exam-07-immutability-never-lies_2_1"> 1. A class is immutable if all of its fields are final
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-07-immutability-never-lies_2_1[]" id="input_exam-07-immutability-never-lies_2_1_choice_1" class="field-input input-checkbox" value="choice_1"/><label id="exam-07-immutability-never-lies_2_1-choice_1-label" for="input_exam-07-immutability-never-lies_2_1_choice_1" class="response-label field-label label-inline" aria-describedby="status_exam-07-immutability-never-lies_2_1"> 2. A class is immutable if instances of it always represent the same value
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-07-immutability-never-lies_2_1[]" id="input_exam-07-immutability-never-lies_2_1_choice_2" class="field-input input-checkbox" value="choice_2"/><label id="exam-07-immutability-never-lies_2_1-choice_2-label" for="input_exam-07-immutability-never-lies_2_1_choice_2" class="response-label field-label label-inline" aria-describedby="status_exam-07-immutability-never-lies_2_1"> 3. Instances of an immutable class can be safely shared
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-07-immutability-never-lies_2_1[]" id="input_exam-07-immutability-never-lies_2_1_choice_3" class="field-input input-checkbox" value="choice_3"/><label id="exam-07-immutability-never-lies_2_1-choice_3-label" for="input_exam-07-immutability-never-lies_2_1_choice_3" class="response-label field-label label-inline" aria-describedby="status_exam-07-immutability-never-lies_2_1"> 4. Objects can be made immutable using defensive copying
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-07-immutability-never-lies_2_1[]" id="input_exam-07-immutability-never-lies_2_1_choice_4" class="field-input input-checkbox" value="choice_4"/><label id="exam-07-immutability-never-lies_2_1-choice_4-label" for="input_exam-07-immutability-never-lies_2_1_choice_4" class="response-label field-label label-inline" aria-describedby="status_exam-07-immutability-never-lies_2_1"> 5. Immutability allows us to reason about global properties instead of local ones
</label>
</div>
<span id="answer_exam-07-immutability-never-lies_2_1"/>
</fieldset>
<div class="indicator-container">
<span class="status unanswered" id="status_exam-07-immutability-never-lies_2_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
</div>
</div></div>
<div class="solution-span">
<span id="solution_exam-07-immutability-never-lies_solution_1"/>
</div></div>
<div class="action">
<input type="hidden" name="problem_id" value="Immutability" />
<div class="submit-attempt-container">
<button type="button" class="submit btn-brand" data-submitting="Submitting" data-value="Submit" data-should-enable-submit-button="True" aria-describedby="submission_feedback_exam-07-immutability-never-lies" >
<span class="submit-label">Submit</span>
</button>
<div class="submission-feedback" id="submission_feedback_exam-07-immutability-never-lies">
<span class="sr">Some problems have options such as save, reset, hints, or show answer. These options follow the Submit button.</span>
</div>
</div>
<div class="problem-action-buttons-wrapper">
</div>
</div>
<div class="notification warning notification-gentle-alert
is-hidden"
tabindex="-1">
<span class="icon fa fa-exclamation-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-07-immutability-never-lies-problem-title">
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification warning notification-save
is-hidden"
tabindex="-1">
<span class="icon fa fa-save" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-07-immutability-never-lies-problem-title">None
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification general notification-show-answer
is-hidden"
tabindex="-1">
<span class="icon fa fa-info-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-07-immutability-never-lies-problem-title">Answers are displayed within the problem
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
</div>
"
data-graded="True">
<p class="loading-spinner">
<i class="fa fa-spinner fa-pulse fa-2x fa-fw"></i>
<span class="sr">Loading…</span>
</p>
</div>
</div>
</div>
</div>
</div>
<div class="xblock xblock-public_view xblock-public_view-vertical" data-has-score="False" data-runtime-class="LmsRuntime" data-request-token="66e5f01c684311ef860c0214bd5530e3" data-usage-id="block-v1:MITx+6.005.1x+3T2016+type@vertical+block@Part_5" data-block-type="vertical" data-graded="True" data-init="VerticalStudentView" data-course-id="course-v1:MITx+6.005.1x+3T2016" data-runtime-version="1">
<h2 class="hd hd-2 unit-title">Part 5</h2>
<div class="vert-mod">
<div class="vert vert-0" data-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-09-adts">
<div class="xblock xblock-public_view xblock-public_view-problem xmodule_display xmodule_ProblemBlock" data-has-score="True" data-runtime-class="LmsRuntime" data-request-token="66e5f01c684311ef860c0214bd5530e3" data-usage-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-09-adts" data-block-type="problem" data-graded="True" data-init="XBlockToXModuleShim" data-course-id="course-v1:MITx+6.005.1x+3T2016" data-runtime-version="1">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "Problem"}
</script>
<div id="problem_exam-09-adts" class="problems-wrapper" role="group"
aria-labelledby="exam-09-adts-problem-title"
data-problem-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-09-adts" data-url="/courses/course-v1:MITx+6.005.1x+3T2016/xblock/block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-09-adts/handler/xmodule_handler"
data-problem-score="0.0"
data-problem-total-possible="2.0"
data-attempts-used="0"
data-content="
<h3 class="hd hd-3 problem-header" id="exam-09-adts-problem-title" aria-describedby="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-09-adts-problem-progress" tabindex="-1">
Representations
</h3>
<div class="problem-progress" id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-09-adts-problem-progress"></div>
<div class="problem">
<div>
<p>Consider an abstract data type <code>Bool</code>. The type has the following operations:</p>
<pre>true : void &#8594; Bool
false : void &#8594; Bool
and : Bool &#215; Bool &#8594; Bool
or : Bool &#215; Bool &#8594; Bool
not : Bool &#8594; Bool
</pre>
<p>...where the first two operations construct the two values of the type, and last three operations have the usual meanings of logical <em>and</em>, logical <em>or</em>, and logical <em>not</em> on those values.</p>
<p>Which of the following are possible ways that <code>Bool</code> might be implemented, and still be able to satisfy the specs of the operations? Check all that apply.</p>
<div class="wrapper-problem-response" tabindex="-1" aria-label="Question 1" role="group"><div class="choicegroup capa_inputtype" id="inputtype_exam-09-adts_2_1">
<fieldset aria-describedby="status_exam-09-adts_2_1">
<div class="field">
<input type="checkbox" name="input_exam-09-adts_2_1[]" id="input_exam-09-adts_2_1_choice_0" class="field-input input-checkbox" value="choice_0"/><label id="exam-09-adts_2_1-choice_0-label" for="input_exam-09-adts_2_1_choice_0" class="response-label field-label label-inline" aria-describedby="status_exam-09-adts_2_1"> As a single bit, where 1 means true and 0 means false.
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-09-adts_2_1[]" id="input_exam-09-adts_2_1_choice_1" class="field-input input-checkbox" value="choice_1"/><label id="exam-09-adts_2_1-choice_1-label" for="input_exam-09-adts_2_1_choice_1" class="response-label field-label label-inline" aria-describedby="status_exam-09-adts_2_1"> As an <code>int</code> value where 5 means true and 8 means false.
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-09-adts_2_1[]" id="input_exam-09-adts_2_1_choice_2" class="field-input input-checkbox" value="choice_2"/><label id="exam-09-adts_2_1-choice_2-label" for="input_exam-09-adts_2_1_choice_2" class="response-label field-label label-inline" aria-describedby="status_exam-09-adts_2_1"> As a reference to a <code>String</code> object where <code>"false"</code> to mean true and <code>"true"</code> to mean false.
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-09-adts_2_1[]" id="input_exam-09-adts_2_1_choice_3" class="field-input input-checkbox" value="choice_3"/><label id="exam-09-adts_2_1-choice_3-label" for="input_exam-09-adts_2_1_choice_3" class="response-label field-label label-inline" aria-describedby="status_exam-09-adts_2_1"> As a <code>long</code> value in which all possible values mean true.
</label>
</div>
<span id="answer_exam-09-adts_2_1"/>
</fieldset>
<div class="indicator-container">
<span class="status unanswered" id="status_exam-09-adts_2_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
</div>
</div></div>
<div class="solution-span">
<span id="solution_exam-09-adts_solution_1"/>
</div></div>
<div class="action">
<input type="hidden" name="problem_id" value="Representations" />
<div class="submit-attempt-container">
<button type="button" class="submit btn-brand" data-submitting="Submitting" data-value="Submit" data-should-enable-submit-button="True" aria-describedby="submission_feedback_exam-09-adts" >
<span class="submit-label">Submit</span>
</button>
<div class="submission-feedback" id="submission_feedback_exam-09-adts">
<span class="sr">Some problems have options such as save, reset, hints, or show answer. These options follow the Submit button.</span>
</div>
</div>
<div class="problem-action-buttons-wrapper">
</div>
</div>
<div class="notification warning notification-gentle-alert
is-hidden"
tabindex="-1">
<span class="icon fa fa-exclamation-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-09-adts-problem-title">
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification warning notification-save
is-hidden"
tabindex="-1">
<span class="icon fa fa-save" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-09-adts-problem-title">None
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification general notification-show-answer
is-hidden"
tabindex="-1">
<span class="icon fa fa-info-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-09-adts-problem-title">Answers are displayed within the problem
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
</div>
"
data-graded="True">
<p class="loading-spinner">
<i class="fa fa-spinner fa-pulse fa-2x fa-fw"></i>
<span class="sr">Loading…</span>
</p>
</div>
</div>
</div>
<div class="vert vert-1" data-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-10-nq">
<div class="xblock xblock-public_view xblock-public_view-problem xmodule_display xmodule_ProblemBlock" data-has-score="True" data-runtime-class="LmsRuntime" data-request-token="66e5f01c684311ef860c0214bd5530e3" data-usage-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-10-nq" data-block-type="problem" data-graded="True" data-init="XBlockToXModuleShim" data-course-id="course-v1:MITx+6.005.1x+3T2016" data-runtime-version="1">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "Problem"}
</script>
<div id="problem_exam-10-nq" class="problems-wrapper" role="group"
aria-labelledby="exam-10-nq-problem-title"
data-problem-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-10-nq" data-url="/courses/course-v1:MITx+6.005.1x+3T2016/xblock/block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-10-nq/handler/xmodule_handler"
data-problem-score="0.0"
data-problem-total-possible="3.0"
data-attempts-used="0"
data-content="
<h3 class="hd hd-3 problem-header" id="exam-10-nq-problem-title" aria-describedby="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-10-nq-problem-progress" tabindex="-1">
Rep Invariants
</h3>
<div class="problem-progress" id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-10-nq-problem-progress"></div>
<div class="problem">
<div>
<pre>
/** An immutable rational number. */
class RatNum {
private int a, b;
...
}
</pre>
<p>Which of the following are plausible rep invariants for RatNum?</p>
<div class="wrapper-problem-response" tabindex="-1" aria-label="Question 1" role="group"><div class="choicegroup capa_inputtype" id="inputtype_exam-10-nq_2_1">
<fieldset aria-describedby="status_exam-10-nq_2_1">
<div class="field">
<input value="choice_0" class="field-input input-checkbox" id="input_exam-10-nq_2_1_choice_0" name="input_exam-10-nq_2_1[]" type="checkbox"/><label class="response-label field-label label-inline" id="exam-10-nq_2_1-choice_0-label" aria-describedby="status_exam-10-nq_2_1" for="input_exam-10-nq_2_1_choice_0"> a/b
</label>
</div>
<div class="field">
<input value="choice_1" class="field-input input-checkbox" id="input_exam-10-nq_2_1_choice_1" name="input_exam-10-nq_2_1[]" type="checkbox"/><label class="response-label field-label label-inline" id="exam-10-nq_2_1-choice_1-label" aria-describedby="status_exam-10-nq_2_1" for="input_exam-10-nq_2_1_choice_1"> b/a
</label>
</div>
<div class="field">
<input value="choice_2" class="field-input input-checkbox" id="input_exam-10-nq_2_1_choice_2" name="input_exam-10-nq_2_1[]" type="checkbox"/><label class="response-label field-label label-inline" id="exam-10-nq_2_1-choice_2-label" aria-describedby="status_exam-10-nq_2_1" for="input_exam-10-nq_2_1_choice_2"> b != 0
</label>
</div>
<div class="field">
<input value="choice_3" class="field-input input-checkbox" id="input_exam-10-nq_2_1_choice_3" name="input_exam-10-nq_2_1[]" type="checkbox"/><label class="response-label field-label label-inline" id="exam-10-nq_2_1-choice_3-label" aria-describedby="status_exam-10-nq_2_1" for="input_exam-10-nq_2_1_choice_3"> a != 0
</label>
</div>
<div class="field">
<input value="choice_4" class="field-input input-checkbox" id="input_exam-10-nq_2_1_choice_4" name="input_exam-10-nq_2_1[]" type="checkbox"/><label class="response-label field-label label-inline" id="exam-10-nq_2_1-choice_4-label" aria-describedby="status_exam-10-nq_2_1" for="input_exam-10-nq_2_1_choice_4"> b !=0 &amp;&amp; a and b have no common factors other than 1
</label>
</div>
<span id="answer_exam-10-nq_2_1"/>
</fieldset>
<div class="indicator-container">
<span class="status unanswered" id="status_exam-10-nq_2_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
</div>
</div></div>
<div class="solution-span">
<span id="solution_exam-10-nq_solution_1"/>
</div></div>
<div class="action">
<input type="hidden" name="problem_id" value="Rep Invariants" />
<div class="submit-attempt-container">
<button type="button" class="submit btn-brand" data-submitting="Submitting" data-value="Submit" data-should-enable-submit-button="True" aria-describedby="submission_feedback_exam-10-nq" >
<span class="submit-label">Submit</span>
</button>
<div class="submission-feedback" id="submission_feedback_exam-10-nq">
<span class="sr">Some problems have options such as save, reset, hints, or show answer. These options follow the Submit button.</span>
</div>
</div>
<div class="problem-action-buttons-wrapper">
</div>
</div>
<div class="notification warning notification-gentle-alert
is-hidden"
tabindex="-1">
<span class="icon fa fa-exclamation-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-10-nq-problem-title">
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification warning notification-save
is-hidden"
tabindex="-1">
<span class="icon fa fa-save" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-10-nq-problem-title">None
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification general notification-show-answer
is-hidden"
tabindex="-1">
<span class="icon fa fa-info-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-10-nq-problem-title">Answers are displayed within the problem
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
</div>
"
data-graded="True">
<p class="loading-spinner">
<i class="fa fa-spinner fa-pulse fa-2x fa-fw"></i>
<span class="sr">Loading…</span>
</p>
</div>
</div>
</div>
<div class="vert vert-2" data-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-10-af-ri-42">
<div class="xblock xblock-public_view xblock-public_view-problem xmodule_display xmodule_ProblemBlock" data-has-score="True" data-runtime-class="LmsRuntime" data-request-token="66e5f01c684311ef860c0214bd5530e3" data-usage-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-10-af-ri-42" data-block-type="problem" data-graded="True" data-init="XBlockToXModuleShim" data-course-id="course-v1:MITx+6.005.1x+3T2016" data-runtime-version="1">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "Problem"}
</script>
<div id="problem_exam-10-af-ri-42" class="problems-wrapper" role="group"
aria-labelledby="exam-10-af-ri-42-problem-title"
data-problem-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-10-af-ri-42" data-url="/courses/course-v1:MITx+6.005.1x+3T2016/xblock/block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-10-af-ri-42/handler/xmodule_handler"
data-problem-score="0.0"
data-problem-total-possible="4.0"
data-attempts-used="0"
data-content="
<h3 class="hd hd-3 problem-header" id="exam-10-af-ri-42-problem-title" aria-describedby="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-10-af-ri-42-problem-progress" tabindex="-1">
Abstract Data Types
</h3>
<div class="problem-progress" id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-10-af-ri-42-problem-progress"></div>
<div class="problem">
<div>
<p>Which of the following should be known (visible and documented) to the client of an abstract data type? Check all that apply.</p>
<div class="wrapper-problem-response" tabindex="-1" aria-label="Question 1" role="group"><div class="choicegroup capa_inputtype" id="inputtype_exam-10-af-ri-42_2_1">
<fieldset aria-describedby="status_exam-10-af-ri-42_2_1">
<div class="field">
<input type="checkbox" name="input_exam-10-af-ri-42_2_1[]" id="input_exam-10-af-ri-42_2_1_choice_0" class="field-input input-checkbox" value="choice_0"/><label id="exam-10-af-ri-42_2_1-choice_0-label" for="input_exam-10-af-ri-42_2_1_choice_0" class="response-label field-label label-inline" aria-describedby="status_exam-10-af-ri-42_2_1"> abstract value space
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-10-af-ri-42_2_1[]" id="input_exam-10-af-ri-42_2_1_choice_1" class="field-input input-checkbox" value="choice_1"/><label id="exam-10-af-ri-42_2_1-choice_1-label" for="input_exam-10-af-ri-42_2_1_choice_1" class="response-label field-label label-inline" aria-describedby="status_exam-10-af-ri-42_2_1"> abstraction function
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-10-af-ri-42_2_1[]" id="input_exam-10-af-ri-42_2_1_choice_2" class="field-input input-checkbox" value="choice_2"/><label id="exam-10-af-ri-42_2_1-choice_2-label" for="input_exam-10-af-ri-42_2_1_choice_2" class="response-label field-label label-inline" aria-describedby="status_exam-10-af-ri-42_2_1"> creators
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-10-af-ri-42_2_1[]" id="input_exam-10-af-ri-42_2_1_choice_3" class="field-input input-checkbox" value="choice_3"/><label id="exam-10-af-ri-42_2_1-choice_3-label" for="input_exam-10-af-ri-42_2_1_choice_3" class="response-label field-label label-inline" aria-describedby="status_exam-10-af-ri-42_2_1"> observers
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-10-af-ri-42_2_1[]" id="input_exam-10-af-ri-42_2_1_choice_4" class="field-input input-checkbox" value="choice_4"/><label id="exam-10-af-ri-42_2_1-choice_4-label" for="input_exam-10-af-ri-42_2_1_choice_4" class="response-label field-label label-inline" aria-describedby="status_exam-10-af-ri-42_2_1"> rep
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-10-af-ri-42_2_1[]" id="input_exam-10-af-ri-42_2_1_choice_5" class="field-input input-checkbox" value="choice_5"/><label id="exam-10-af-ri-42_2_1-choice_5-label" for="input_exam-10-af-ri-42_2_1_choice_5" class="response-label field-label label-inline" aria-describedby="status_exam-10-af-ri-42_2_1"> rep invariant
</label>
</div>
<span id="answer_exam-10-af-ri-42_2_1"/>
</fieldset>
<div class="indicator-container">
<span class="status unanswered" id="status_exam-10-af-ri-42_2_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
</div>
</div></div>
<div class="solution-span">
<span id="solution_exam-10-af-ri-42_solution_1"/>
</div><p>Which of the following should be known (visible and documented) to the maintainer of an abstract data type? Check all that apply.</p>
<div class="wrapper-problem-response" tabindex="-1" aria-label="Question 2" role="group"><div class="choicegroup capa_inputtype" id="inputtype_exam-10-af-ri-42_3_1">
<fieldset aria-describedby="status_exam-10-af-ri-42_3_1">
<div class="field">
<input type="checkbox" name="input_exam-10-af-ri-42_3_1[]" id="input_exam-10-af-ri-42_3_1_choice_0" class="field-input input-checkbox" value="choice_0"/><label id="exam-10-af-ri-42_3_1-choice_0-label" for="input_exam-10-af-ri-42_3_1_choice_0" class="response-label field-label label-inline" aria-describedby="status_exam-10-af-ri-42_3_1"> abstract value space
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-10-af-ri-42_3_1[]" id="input_exam-10-af-ri-42_3_1_choice_1" class="field-input input-checkbox" value="choice_1"/><label id="exam-10-af-ri-42_3_1-choice_1-label" for="input_exam-10-af-ri-42_3_1_choice_1" class="response-label field-label label-inline" aria-describedby="status_exam-10-af-ri-42_3_1"> abstraction function
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-10-af-ri-42_3_1[]" id="input_exam-10-af-ri-42_3_1_choice_2" class="field-input input-checkbox" value="choice_2"/><label id="exam-10-af-ri-42_3_1-choice_2-label" for="input_exam-10-af-ri-42_3_1_choice_2" class="response-label field-label label-inline" aria-describedby="status_exam-10-af-ri-42_3_1"> creators
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-10-af-ri-42_3_1[]" id="input_exam-10-af-ri-42_3_1_choice_3" class="field-input input-checkbox" value="choice_3"/><label id="exam-10-af-ri-42_3_1-choice_3-label" for="input_exam-10-af-ri-42_3_1_choice_3" class="response-label field-label label-inline" aria-describedby="status_exam-10-af-ri-42_3_1"> observers
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-10-af-ri-42_3_1[]" id="input_exam-10-af-ri-42_3_1_choice_4" class="field-input input-checkbox" value="choice_4"/><label id="exam-10-af-ri-42_3_1-choice_4-label" for="input_exam-10-af-ri-42_3_1_choice_4" class="response-label field-label label-inline" aria-describedby="status_exam-10-af-ri-42_3_1"> rep
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-10-af-ri-42_3_1[]" id="input_exam-10-af-ri-42_3_1_choice_5" class="field-input input-checkbox" value="choice_5"/><label id="exam-10-af-ri-42_3_1-choice_5-label" for="input_exam-10-af-ri-42_3_1_choice_5" class="response-label field-label label-inline" aria-describedby="status_exam-10-af-ri-42_3_1"> rep invariant
</label>
</div>
<span id="answer_exam-10-af-ri-42_3_1"/>
</fieldset>
<div class="indicator-container">
<span class="status unanswered" id="status_exam-10-af-ri-42_3_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
</div>
</div></div>
<div class="solution-span">
<span id="solution_exam-10-af-ri-42_solution_2"/>
</div></div>
<div class="action">
<input type="hidden" name="problem_id" value="Abstract Data Types" />
<div class="submit-attempt-container">
<button type="button" class="submit btn-brand" data-submitting="Submitting" data-value="Submit" data-should-enable-submit-button="True" aria-describedby="submission_feedback_exam-10-af-ri-42" >
<span class="submit-label">Submit</span>
</button>
<div class="submission-feedback" id="submission_feedback_exam-10-af-ri-42">
<span class="sr">Some problems have options such as save, reset, hints, or show answer. These options follow the Submit button.</span>
</div>
</div>
<div class="problem-action-buttons-wrapper">
</div>
</div>
<div class="notification warning notification-gentle-alert
is-hidden"
tabindex="-1">
<span class="icon fa fa-exclamation-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-10-af-ri-42-problem-title">
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification warning notification-save
is-hidden"
tabindex="-1">
<span class="icon fa fa-save" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-10-af-ri-42-problem-title">None
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification general notification-show-answer
is-hidden"
tabindex="-1">
<span class="icon fa fa-info-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-10-af-ri-42-problem-title">Answers are displayed within the problem
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
</div>
"
data-graded="True">
<p class="loading-spinner">
<i class="fa fa-spinner fa-pulse fa-2x fa-fw"></i>
<span class="sr">Loading…</span>
</p>
</div>
</div>
</div>
</div>
</div>
<div class="xblock xblock-public_view xblock-public_view-vertical" data-has-score="False" data-runtime-class="LmsRuntime" data-request-token="66e5f01c684311ef860c0214bd5530e3" data-usage-id="block-v1:MITx+6.005.1x+3T2016+type@vertical+block@Part_6" data-block-type="vertical" data-graded="True" data-init="VerticalStudentView" data-course-id="course-v1:MITx+6.005.1x+3T2016" data-runtime-version="1">
<h2 class="hd hd-2 unit-title">Part 6</h2>
<div class="vert-mod">
<div class="vert vert-0" data-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-11-nq">
<div class="xblock xblock-public_view xblock-public_view-problem xmodule_display xmodule_ProblemBlock" data-has-score="True" data-runtime-class="LmsRuntime" data-request-token="66e5f01c684311ef860c0214bd5530e3" data-usage-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-11-nq" data-block-type="problem" data-graded="True" data-init="XBlockToXModuleShim" data-course-id="course-v1:MITx+6.005.1x+3T2016" data-runtime-version="1">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "Problem"}
</script>
<div id="problem_exam-11-nq" class="problems-wrapper" role="group"
aria-labelledby="exam-11-nq-problem-title"
data-problem-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-11-nq" data-url="/courses/course-v1:MITx+6.005.1x+3T2016/xblock/block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-11-nq/handler/xmodule_handler"
data-problem-score="0.0"
data-problem-total-possible="3.0"
data-attempts-used="0"
data-content="
<h3 class="hd hd-3 problem-header" id="exam-11-nq-problem-title" aria-describedby="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-11-nq-problem-progress" tabindex="-1">
Implementing an Interface
</h3>
<div class="problem-progress" id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-11-nq-problem-progress"></div>
<div class="problem">
<div>
<p>Here is an extremely simplified Set interface with only one operation, and one simple implementation class for it:</p>
<pre>
/** Represents an immutable set of elements of type E. */
interface Set&lt;E&gt; {
/** @return true iff this set contains e as a member */
public boolean contains(E e);
}
/** A Set&lt;E&gt; that contains every E. */
class Universe&lt;E&gt; {
/** Make a universe. */
public Universe() { }
/** @return always true since this set contains every e */
public boolean contains(E e) { return true; }
}
</pre>
<p><code>Universe</code><strong>doesn't</strong> correctly implement the <code>Set</code> interface because (choose all good answers):</p>
<div class="wrapper-problem-response" tabindex="-1" aria-label="Question 1" role="group"><div class="choicegroup capa_inputtype" id="inputtype_exam-11-nq_2_1">
<fieldset aria-describedby="status_exam-11-nq_2_1">
<div class="field">
<input type="checkbox" name="input_exam-11-nq_2_1[]" id="input_exam-11-nq_2_1_choice_0" class="field-input input-checkbox" value="choice_0"/><label id="exam-11-nq_2_1-choice_0-label" for="input_exam-11-nq_2_1_choice_0" class="response-label field-label label-inline" aria-describedby="status_exam-11-nq_2_1"> Universe is a class, not an interface
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-11-nq_2_1[]" id="input_exam-11-nq_2_1_choice_1" class="field-input input-checkbox" value="choice_1"/><label id="exam-11-nq_2_1-choice_1-label" for="input_exam-11-nq_2_1_choice_1" class="response-label field-label label-inline" aria-describedby="status_exam-11-nq_2_1"> Universe has a constructor
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-11-nq_2_1[]" id="input_exam-11-nq_2_1_choice_2" class="field-input input-checkbox" value="choice_2"/><label id="exam-11-nq_2_1-choice_2-label" for="input_exam-11-nq_2_1_choice_2" class="response-label field-label label-inline" aria-describedby="status_exam-11-nq_2_1"> the body of the Universe constructor is empty
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-11-nq_2_1[]" id="input_exam-11-nq_2_1_choice_3" class="field-input input-checkbox" value="choice_3"/><label id="exam-11-nq_2_1-choice_3-label" for="input_exam-11-nq_2_1_choice_3" class="response-label field-label label-inline" aria-describedby="status_exam-11-nq_2_1"> Universe is mutable
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-11-nq_2_1[]" id="input_exam-11-nq_2_1_choice_4" class="field-input input-checkbox" value="choice_4"/><label id="exam-11-nq_2_1-choice_4-label" for="input_exam-11-nq_2_1_choice_4" class="response-label field-label label-inline" aria-describedby="status_exam-11-nq_2_1"> Universe doesn't declare implements Set&lt;E&gt;
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-11-nq_2_1[]" id="input_exam-11-nq_2_1_choice_5" class="field-input input-checkbox" value="choice_5"/><label id="exam-11-nq_2_1-choice_5-label" for="input_exam-11-nq_2_1_choice_5" class="response-label field-label label-inline" aria-describedby="status_exam-11-nq_2_1"> Universe.contains doesn't satisfy the spec of Set.contains
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-11-nq_2_1[]" id="input_exam-11-nq_2_1_choice_6" class="field-input input-checkbox" value="choice_6"/><label id="exam-11-nq_2_1-choice_6-label" for="input_exam-11-nq_2_1_choice_6" class="response-label field-label label-inline" aria-describedby="status_exam-11-nq_2_1"> creating a Universe is likely to cause an OutOfMemoryError because it will have to point to all objects of type E
</label>
</div>
<span id="answer_exam-11-nq_2_1"/>
</fieldset>
<div class="indicator-container">
<span class="status unanswered" id="status_exam-11-nq_2_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
</div>
</div></div>
<div class="solution-span">
<span id="solution_exam-11-nq_solution_1"/>
</div></div>
<div class="action">
<input type="hidden" name="problem_id" value="Implementing an Interface" />
<div class="submit-attempt-container">
<button type="button" class="submit btn-brand" data-submitting="Submitting" data-value="Submit" data-should-enable-submit-button="True" aria-describedby="submission_feedback_exam-11-nq" >
<span class="submit-label">Submit</span>
</button>
<div class="submission-feedback" id="submission_feedback_exam-11-nq">
<span class="sr">Some problems have options such as save, reset, hints, or show answer. These options follow the Submit button.</span>
</div>
</div>
<div class="problem-action-buttons-wrapper">
</div>
</div>
<div class="notification warning notification-gentle-alert
is-hidden"
tabindex="-1">
<span class="icon fa fa-exclamation-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-11-nq-problem-title">
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification warning notification-save
is-hidden"
tabindex="-1">
<span class="icon fa fa-save" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-11-nq-problem-title">None
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification general notification-show-answer
is-hidden"
tabindex="-1">
<span class="icon fa fa-info-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-11-nq-problem-title">Answers are displayed within the problem
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
</div>
"
data-graded="True">
<p class="loading-spinner">
<i class="fa fa-spinner fa-pulse fa-2x fa-fw"></i>
<span class="sr">Loading…</span>
</p>
</div>
</div>
</div>
<div class="vert vert-1" data-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-11-collection-interfaces-implementations-34">
<div class="xblock xblock-public_view xblock-public_view-problem xmodule_display xmodule_ProblemBlock" data-has-score="True" data-runtime-class="LmsRuntime" data-request-token="66e5f01c684311ef860c0214bd5530e3" data-usage-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-11-collection-interfaces-implementations-34" data-block-type="problem" data-graded="True" data-init="XBlockToXModuleShim" data-course-id="course-v1:MITx+6.005.1x+3T2016" data-runtime-version="1">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "Problem"}
</script>
<div id="problem_exam-11-collection-interfaces-implementations-34" class="problems-wrapper" role="group"
aria-labelledby="exam-11-collection-interfaces-implementations-34-problem-title"
data-problem-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-11-collection-interfaces-implementations-34" data-url="/courses/course-v1:MITx+6.005.1x+3T2016/xblock/block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-11-collection-interfaces-implementations-34/handler/xmodule_handler"
data-problem-score="0.0"
data-problem-total-possible="3.0"
data-attempts-used="0"
data-content="
<h3 class="hd hd-3 problem-header" id="exam-11-collection-interfaces-implementations-34-problem-title" aria-describedby="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-11-collection-interfaces-implementations-34-problem-progress" tabindex="-1">
Interfaces and Implementations
</h3>
<div class="problem-progress" id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-11-collection-interfaces-implementations-34-problem-progress"></div>
<div class="problem">
<div>
<p>Assume the following lines of code are run in sequence, and that any lines of code that don't compile are simply commented out so that the rest of the code can compile.</p>
<p>The code uses two methods from <a href="https://docs.oracle.com/javase/8/docs/api/java/util/Collections.html" target="_new">java.util.Collections</a>, so you might need to consult the documentation.</p>
<p>Choose the <strong>most specific answer</strong> to each question.</p>
<pre class="code">
Set&lt;String&gt; set = new HashSet&lt;String&gt;();
</pre>
<p>The <code>set</code> variable now points to:</p>
<div class="wrapper-problem-response" tabindex="-1" aria-label="Question 1" role="group"><div class="inputtype option-input ">
<select name="input_exam-11-collection-interfaces-implementations-34_2_1" id="input_exam-11-collection-interfaces-implementations-34_2_1" aria-describedby="status_exam-11-collection-interfaces-implementations-34_2_1">
<option value="option_exam-11-collection-interfaces-implementations-34_2_1_dummy_default">Select an option</option>
<option value="a HashSet object"> a HashSet object</option>
<option value="an object that implements the Set interface"> an object that implements the Set interface</option>
<option value="null"> null</option>
<option value="this line won't compile"> this line won't compile</option>
</select>
<div class="indicator-container">
<span class="status unanswered" id="status_exam-11-collection-interfaces-implementations-34_2_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
</div>
<p class="answer" id="answer_exam-11-collection-interfaces-implementations-34_2_1"/>
</div></div>
<div class="solution-span">
<span id="solution_exam-11-collection-interfaces-implementations-34_solution_1"/>
</div><pre class="code">
set = Collections.unmodifiableSet(set);
</pre>
<p>The <code>set</code> variable now points to:</p>
<div class="wrapper-problem-response" tabindex="-1" aria-label="Question 2" role="group"><div class="inputtype option-input ">
<select name="input_exam-11-collection-interfaces-implementations-34_3_1" id="input_exam-11-collection-interfaces-implementations-34_3_1" aria-describedby="status_exam-11-collection-interfaces-implementations-34_3_1">
<option value="option_exam-11-collection-interfaces-implementations-34_3_1_dummy_default">Select an option</option>
<option value="a HashSet object"> a HashSet object</option>
<option value="an object that implements the Set interface"> an object that implements the Set interface</option>
<option value="null"> null</option>
<option value="this line won't compile"> this line won't compile</option>
</select>
<div class="indicator-container">
<span class="status unanswered" id="status_exam-11-collection-interfaces-implementations-34_3_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
</div>
<p class="answer" id="answer_exam-11-collection-interfaces-implementations-34_3_1"/>
</div></div>
<div class="solution-span">
<span id="solution_exam-11-collection-interfaces-implementations-34_solution_2"/>
</div><pre class="code">
set = Collections.singleton("glorp");
</pre>
<p>The <code>set</code> variable now points to:</p>
<div class="wrapper-problem-response" tabindex="-1" aria-label="Question 3" role="group"><div class="inputtype option-input ">
<select name="input_exam-11-collection-interfaces-implementations-34_4_1" id="input_exam-11-collection-interfaces-implementations-34_4_1" aria-describedby="status_exam-11-collection-interfaces-implementations-34_4_1">
<option value="option_exam-11-collection-interfaces-implementations-34_4_1_dummy_default">Select an option</option>
<option value="a HashSet object"> a HashSet object</option>
<option value="an object that implements the Set interface"> an object that implements the Set interface</option>
<option value="null"> null</option>
<option value="this line won't compile"> this line won't compile</option>
</select>
<div class="indicator-container">
<span class="status unanswered" id="status_exam-11-collection-interfaces-implementations-34_4_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
</div>
<p class="answer" id="answer_exam-11-collection-interfaces-implementations-34_4_1"/>
</div></div>
<div class="solution-span">
<span id="solution_exam-11-collection-interfaces-implementations-34_solution_3"/>
</div><pre class="code">
set = new Set&lt;String&gt;();
</pre>
<p>The <code>set</code> variable now points to:</p>
<div class="wrapper-problem-response" tabindex="-1" aria-label="Question 4" role="group"><div class="inputtype option-input ">
<select name="input_exam-11-collection-interfaces-implementations-34_5_1" id="input_exam-11-collection-interfaces-implementations-34_5_1" aria-describedby="status_exam-11-collection-interfaces-implementations-34_5_1">
<option value="option_exam-11-collection-interfaces-implementations-34_5_1_dummy_default">Select an option</option>
<option value="a HashSet object"> a HashSet object</option>
<option value="an object that implements the Set interface"> an object that implements the Set interface</option>
<option value="null"> null</option>
<option value="this line won't compile"> this line won't compile</option>
</select>
<div class="indicator-container">
<span class="status unanswered" id="status_exam-11-collection-interfaces-implementations-34_5_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
</div>
<p class="answer" id="answer_exam-11-collection-interfaces-implementations-34_5_1"/>
</div></div>
<div class="solution-span">
<span id="solution_exam-11-collection-interfaces-implementations-34_solution_4"/>
</div><pre class="code">
List&lt;String&gt; list = set;
</pre>
<p>The <code>set</code> variable now points to:</p>
<div class="wrapper-problem-response" tabindex="-1" aria-label="Question 5" role="group"><div class="inputtype option-input ">
<select name="input_exam-11-collection-interfaces-implementations-34_6_1" id="input_exam-11-collection-interfaces-implementations-34_6_1" aria-describedby="status_exam-11-collection-interfaces-implementations-34_6_1">
<option value="option_exam-11-collection-interfaces-implementations-34_6_1_dummy_default">Select an option</option>
<option value="a HashSet object"> a HashSet object</option>
<option value="an object that implements the Set interface"> an object that implements the Set interface</option>
<option value="null"> null</option>
<option value="this line won't compile"> this line won't compile</option>
</select>
<div class="indicator-container">
<span class="status unanswered" id="status_exam-11-collection-interfaces-implementations-34_6_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
</div>
<p class="answer" id="answer_exam-11-collection-interfaces-implementations-34_6_1"/>
</div></div>
<div class="solution-span">
<span id="solution_exam-11-collection-interfaces-implementations-34_solution_5"/>
</div></div>
<div class="action">
<input type="hidden" name="problem_id" value="Interfaces and Implementations" />
<div class="submit-attempt-container">
<button type="button" class="submit btn-brand" data-submitting="Submitting" data-value="Submit" data-should-enable-submit-button="True" aria-describedby="submission_feedback_exam-11-collection-interfaces-implementations-34" >
<span class="submit-label">Submit</span>
</button>
<div class="submission-feedback" id="submission_feedback_exam-11-collection-interfaces-implementations-34">
<span class="sr">Some problems have options such as save, reset, hints, or show answer. These options follow the Submit button.</span>
</div>
</div>
<div class="problem-action-buttons-wrapper">
</div>
</div>
<div class="notification warning notification-gentle-alert
is-hidden"
tabindex="-1">
<span class="icon fa fa-exclamation-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-11-collection-interfaces-implementations-34-problem-title">
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification warning notification-save
is-hidden"
tabindex="-1">
<span class="icon fa fa-save" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-11-collection-interfaces-implementations-34-problem-title">None
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification general notification-show-answer
is-hidden"
tabindex="-1">
<span class="icon fa fa-info-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-11-collection-interfaces-implementations-34-problem-title">Answers are displayed within the problem
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
</div>
"
data-graded="True">
<p class="loading-spinner">
<i class="fa fa-spinner fa-pulse fa-2x fa-fw"></i>
<span class="sr">Loading…</span>
</p>
</div>
</div>
</div>
<div class="vert vert-2" data-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-12-nq">
<div class="xblock xblock-public_view xblock-public_view-problem xmodule_display xmodule_ProblemBlock" data-has-score="True" data-runtime-class="LmsRuntime" data-request-token="66e5f01c684311ef860c0214bd5530e3" data-usage-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-12-nq" data-block-type="problem" data-graded="True" data-init="XBlockToXModuleShim" data-course-id="course-v1:MITx+6.005.1x+3T2016" data-runtime-version="1">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "Problem"}
</script>
<div id="problem_exam-12-nq" class="problems-wrapper" role="group"
aria-labelledby="exam-12-nq-problem-title"
data-problem-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-12-nq" data-url="/courses/course-v1:MITx+6.005.1x+3T2016/xblock/block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-12-nq/handler/xmodule_handler"
data-problem-score="0.0"
data-problem-total-possible="3.0"
data-attempts-used="0"
data-content="
<h3 class="hd hd-3 problem-header" id="exam-12-nq-problem-title" aria-describedby="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-12-nq-problem-progress" tabindex="-1">
Tolerance
</h3>
<div class="problem-progress" id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-12-nq-problem-progress"></div>
<div class="problem">
<div>
<p>Knowing that floating-point calculations can have some error,
suppose we try to implement Double.equals() with tolerance:</p>
<pre>
class Double {
private final double value;
@Override public boolean equals (Object thatObject) {
if (!(thatObject instanceof Double)) return false;
Double that = (Double) thatObject;
return that.value - this.value &lt; 0.01;
}
}
</pre>
<p>
Which properties of an equivalence relation are violated by this equals() method?
</p>
<div class="wrapper-problem-response" tabindex="-1" aria-label="Question 1" role="group"><div class="choicegroup capa_inputtype" id="inputtype_exam-12-nq_2_1">
<fieldset aria-describedby="status_exam-12-nq_2_1">
<div class="field">
<input type="checkbox" name="input_exam-12-nq_2_1[]" id="input_exam-12-nq_2_1_choice_0" class="field-input input-checkbox" value="choice_0"/><label id="exam-12-nq_2_1-choice_0-label" for="input_exam-12-nq_2_1_choice_0" class="response-label field-label label-inline" aria-describedby="status_exam-12-nq_2_1"> reflexivity
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-12-nq_2_1[]" id="input_exam-12-nq_2_1_choice_1" class="field-input input-checkbox" value="choice_1"/><label id="exam-12-nq_2_1-choice_1-label" for="input_exam-12-nq_2_1_choice_1" class="response-label field-label label-inline" aria-describedby="status_exam-12-nq_2_1"> symmetry
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-12-nq_2_1[]" id="input_exam-12-nq_2_1_choice_2" class="field-input input-checkbox" value="choice_2"/><label id="exam-12-nq_2_1-choice_2-label" for="input_exam-12-nq_2_1_choice_2" class="response-label field-label label-inline" aria-describedby="status_exam-12-nq_2_1"> transitivity
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-12-nq_2_1[]" id="input_exam-12-nq_2_1_choice_3" class="field-input input-checkbox" value="choice_3"/><label id="exam-12-nq_2_1-choice_3-label" for="input_exam-12-nq_2_1_choice_3" class="response-label field-label label-inline" aria-describedby="status_exam-12-nq_2_1"> none of the above, it <strong>is</strong> an equivalence relation
</label>
</div>
<span id="answer_exam-12-nq_2_1"/>
</fieldset>
<div class="indicator-container">
<span class="status unanswered" id="status_exam-12-nq_2_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
</div>
</div></div>
<div class="solution-span">
<span id="solution_exam-12-nq_solution_1"/>
</div></div>
<div class="action">
<input type="hidden" name="problem_id" value="Tolerance" />
<div class="submit-attempt-container">
<button type="button" class="submit btn-brand" data-submitting="Submitting" data-value="Submit" data-should-enable-submit-button="True" aria-describedby="submission_feedback_exam-12-nq" >
<span class="submit-label">Submit</span>
</button>
<div class="submission-feedback" id="submission_feedback_exam-12-nq">
<span class="sr">Some problems have options such as save, reset, hints, or show answer. These options follow the Submit button.</span>
</div>
</div>
<div class="problem-action-buttons-wrapper">
</div>
</div>
<div class="notification warning notification-gentle-alert
is-hidden"
tabindex="-1">
<span class="icon fa fa-exclamation-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-12-nq-problem-title">
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification warning notification-save
is-hidden"
tabindex="-1">
<span class="icon fa fa-save" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-12-nq-problem-title">None
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification general notification-show-answer
is-hidden"
tabindex="-1">
<span class="icon fa fa-info-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-12-nq-problem-title">Answers are displayed within the problem
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
</div>
"
data-graded="True">
<p class="loading-spinner">
<i class="fa fa-spinner fa-pulse fa-2x fa-fw"></i>
<span class="sr">Loading…</span>
</p>
</div>
</div>
</div>
<div class="vert vert-3" data-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-12-buggy-equality">
<div class="xblock xblock-public_view xblock-public_view-problem xmodule_display xmodule_ProblemBlock" data-has-score="True" data-runtime-class="LmsRuntime" data-request-token="66e5f01c684311ef860c0214bd5530e3" data-usage-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-12-buggy-equality" data-block-type="problem" data-graded="True" data-init="XBlockToXModuleShim" data-course-id="course-v1:MITx+6.005.1x+3T2016" data-runtime-version="1">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "Problem"}
</script>
<div id="problem_exam-12-buggy-equality" class="problems-wrapper" role="group"
aria-labelledby="exam-12-buggy-equality-problem-title"
data-problem-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-12-buggy-equality" data-url="/courses/course-v1:MITx+6.005.1x+3T2016/xblock/block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-12-buggy-equality/handler/xmodule_handler"
data-problem-score="0.0"
data-problem-total-possible="2.0"
data-attempts-used="0"
data-content="
<h3 class="hd hd-3 problem-header" id="exam-12-buggy-equality-problem-title" aria-describedby="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-12-buggy-equality-problem-progress" tabindex="-1">
Equality
</h3>
<div class="problem-progress" id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-12-buggy-equality-problem-progress"></div>
<div class="problem">
<div>
<p>Suppose you want to show that an equality operation is buggy because it isn't symmetric. How many objects do you need for a counterexample to symmetry?</p>
<div class="wrapper-problem-response" tabindex="-1" aria-label="Question 1" role="group"><div class="choicegroup capa_inputtype" id="inputtype_exam-12-buggy-equality_2_1">
<fieldset aria-describedby="status_exam-12-buggy-equality_2_1">
<div class="field">
<input type="radio" name="input_exam-12-buggy-equality_2_1" id="input_exam-12-buggy-equality_2_1_choice_0" class="field-input input-radio" value="choice_0"/><label id="exam-12-buggy-equality_2_1-choice_0-label" for="input_exam-12-buggy-equality_2_1_choice_0" class="response-label field-label label-inline" aria-describedby="status_exam-12-buggy-equality_2_1"> none
</label>
</div>
<div class="field">
<input type="radio" name="input_exam-12-buggy-equality_2_1" id="input_exam-12-buggy-equality_2_1_choice_1" class="field-input input-radio" value="choice_1"/><label id="exam-12-buggy-equality_2_1-choice_1-label" for="input_exam-12-buggy-equality_2_1_choice_1" class="response-label field-label label-inline" aria-describedby="status_exam-12-buggy-equality_2_1"> 1 object
</label>
</div>
<div class="field">
<input type="radio" name="input_exam-12-buggy-equality_2_1" id="input_exam-12-buggy-equality_2_1_choice_2" class="field-input input-radio" value="choice_2"/><label id="exam-12-buggy-equality_2_1-choice_2-label" for="input_exam-12-buggy-equality_2_1_choice_2" class="response-label field-label label-inline" aria-describedby="status_exam-12-buggy-equality_2_1"> 2 objects
</label>
</div>
<div class="field">
<input type="radio" name="input_exam-12-buggy-equality_2_1" id="input_exam-12-buggy-equality_2_1_choice_3" class="field-input input-radio" value="choice_3"/><label id="exam-12-buggy-equality_2_1-choice_3-label" for="input_exam-12-buggy-equality_2_1_choice_3" class="response-label field-label label-inline" aria-describedby="status_exam-12-buggy-equality_2_1"> 3 objects
</label>
</div>
<div class="field">
<input type="radio" name="input_exam-12-buggy-equality_2_1" id="input_exam-12-buggy-equality_2_1_choice_4" class="field-input input-radio" value="choice_4"/><label id="exam-12-buggy-equality_2_1-choice_4-label" for="input_exam-12-buggy-equality_2_1_choice_4" class="response-label field-label label-inline" aria-describedby="status_exam-12-buggy-equality_2_1"> all the objects in the type
</label>
</div>
<span id="answer_exam-12-buggy-equality_2_1"/>
</fieldset>
<div class="indicator-container">
<span class="status unanswered" id="status_exam-12-buggy-equality_2_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
</div>
</div></div>
<div class="solution-span">
<span id="solution_exam-12-buggy-equality_solution_1"/>
</div></div>
<div class="action">
<input type="hidden" name="problem_id" value="Equality" />
<div class="submit-attempt-container">
<button type="button" class="submit btn-brand" data-submitting="Submitting" data-value="Submit" data-should-enable-submit-button="True" aria-describedby="submission_feedback_exam-12-buggy-equality" >
<span class="submit-label">Submit</span>
</button>
<div class="submission-feedback" id="submission_feedback_exam-12-buggy-equality">
<span class="sr">Some problems have options such as save, reset, hints, or show answer. These options follow the Submit button.</span>
</div>
</div>
<div class="problem-action-buttons-wrapper">
</div>
</div>
<div class="notification warning notification-gentle-alert
is-hidden"
tabindex="-1">
<span class="icon fa fa-exclamation-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-12-buggy-equality-problem-title">
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification warning notification-save
is-hidden"
tabindex="-1">
<span class="icon fa fa-save" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-12-buggy-equality-problem-title">None
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification general notification-show-answer
is-hidden"
tabindex="-1">
<span class="icon fa fa-info-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-12-buggy-equality-problem-title">Answers are displayed within the problem
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
</div>
"
data-graded="True">
<p class="loading-spinner">
<i class="fa fa-spinner fa-pulse fa-2x fa-fw"></i>
<span class="sr">Loading…</span>
</p>
</div>
</div>
</div>
<div class="vert vert-4" data-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-12-nq2">
<div class="xblock xblock-public_view xblock-public_view-problem xmodule_display xmodule_ProblemBlock" data-has-score="True" data-runtime-class="LmsRuntime" data-request-token="66e5f01c684311ef860c0214bd5530e3" data-usage-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-12-nq2" data-block-type="problem" data-graded="True" data-init="XBlockToXModuleShim" data-course-id="course-v1:MITx+6.005.1x+3T2016" data-runtime-version="1">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "Problem"}
</script>
<div id="problem_exam-12-nq2" class="problems-wrapper" role="group"
aria-labelledby="exam-12-nq2-problem-title"
data-problem-id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-12-nq2" data-url="/courses/course-v1:MITx+6.005.1x+3T2016/xblock/block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-12-nq2/handler/xmodule_handler"
data-problem-score="0.0"
data-problem-total-possible="3.0"
data-attempts-used="0"
data-content="
<h3 class="hd hd-3 problem-header" id="exam-12-nq2-problem-title" aria-describedby="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-12-nq2-problem-progress" tabindex="-1">
Object Contract
</h3>
<div class="problem-progress" id="block-v1:MITx+6.005.1x+3T2016+type@problem+block@exam-12-nq2-problem-progress"></div>
<div class="problem">
<div>
<p>If a type is correctly obeying the Object contract, which of the following are true?</p>
<div class="wrapper-problem-response" tabindex="-1" aria-label="Question 1" role="group"><div class="choicegroup capa_inputtype" id="inputtype_exam-12-nq2_2_1">
<fieldset aria-describedby="status_exam-12-nq2_2_1">
<div class="field">
<input type="checkbox" name="input_exam-12-nq2_2_1[]" id="input_exam-12-nq2_2_1_choice_0" class="field-input input-checkbox" value="choice_0"/><label id="exam-12-nq2_2_1-choice_0-label" for="input_exam-12-nq2_2_1_choice_0" class="response-label field-label label-inline" aria-describedby="status_exam-12-nq2_2_1"> Two objects are equal() if and only if their rep fields are equal.
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-12-nq2_2_1[]" id="input_exam-12-nq2_2_1_choice_1" class="field-input input-checkbox" value="choice_1"/><label id="exam-12-nq2_2_1-choice_1-label" for="input_exam-12-nq2_2_1_choice_1" class="response-label field-label label-inline" aria-describedby="status_exam-12-nq2_2_1"> The abstraction function is an equivalence relation.
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-12-nq2_2_1[]" id="input_exam-12-nq2_2_1_choice_2" class="field-input input-checkbox" value="choice_2"/><label id="exam-12-nq2_2_1-choice_2-label" for="input_exam-12-nq2_2_1_choice_2" class="response-label field-label label-inline" aria-describedby="status_exam-12-nq2_2_1"> Two objects that are equal() have the same hashCode() value.
</label>
</div>
<div class="field">
<input type="checkbox" name="input_exam-12-nq2_2_1[]" id="input_exam-12-nq2_2_1_choice_3" class="field-input input-checkbox" value="choice_3"/><label id="exam-12-nq2_2_1-choice_3-label" for="input_exam-12-nq2_2_1_choice_3" class="response-label field-label label-inline" aria-describedby="status_exam-12-nq2_2_1"> Two objects that are not equal() have different hashCode() values.
</label>
</div>
<span id="answer_exam-12-nq2_2_1"/>
</fieldset>
<div class="indicator-container">
<span class="status unanswered" id="status_exam-12-nq2_2_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
</div>
</div></div>
<div class="solution-span">
<span id="solution_exam-12-nq2_solution_1"/>
</div></div>
<div class="action">
<input type="hidden" name="problem_id" value="Object Contract" />
<div class="submit-attempt-container">
<button type="button" class="submit btn-brand" data-submitting="Submitting" data-value="Submit" data-should-enable-submit-button="True" aria-describedby="submission_feedback_exam-12-nq2" >
<span class="submit-label">Submit</span>
</button>
<div class="submission-feedback" id="submission_feedback_exam-12-nq2">
<span class="sr">Some problems have options such as save, reset, hints, or show answer. These options follow the Submit button.</span>
</div>
</div>
<div class="problem-action-buttons-wrapper">
</div>
</div>
<div class="notification warning notification-gentle-alert
is-hidden"
tabindex="-1">
<span class="icon fa fa-exclamation-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-12-nq2-problem-title">
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification warning notification-save
is-hidden"
tabindex="-1">
<span class="icon fa fa-save" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-12-nq2-problem-title">None
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification general notification-show-answer
is-hidden"
tabindex="-1">
<span class="icon fa fa-info-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="exam-12-nq2-problem-title">Answers are displayed within the problem
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
</div>
"
data-graded="True">
<p class="loading-spinner">
<i class="fa fa-spinner fa-pulse fa-2x fa-fw"></i>
<span class="sr">Loading…</span>
</p>
</div>
</div>
</div>
</div>
</div>