You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>Mixed-up code or Parsons problems provide the correct code to solve a problem, but the code is broken into blocks and mixed up.</p>
5
-
<program language="rst"><input>
6
-
.. parsonsprob:: unqiue_problem_id_here
7
-
:maxdist:
8
-
:order:
9
-
:language:
10
-
:noindent:
11
-
:adaptive:
12
-
:numbered: left
13
-
14
-
Instructions for the user. These can include a textual description of how to solve the problem. You must leave a blank line before this.
15
-
-----
16
-
def findmax(alist):
17
-
=====
18
-
if len(alist) == 0:
19
-
return None
20
-
=====
21
-
curmax = alist[0]
22
-
for item in alist:
23
-
=====
24
-
if item &gt; curmax:
25
-
=====
26
-
curmax = item
27
-
=====
28
-
return curmax
29
-
</input></program>
30
-
<p>Create a working program and then paste the code for it into the editor. Indent the code so that the left edge lines up with the options. Indent each line with 4 spaces beyond the previous line. Separate the blocks with <q>=====</q> which must line up under the options. Put the instructions before the code after a blank line and then followed by <q>----</q>.</p>
5
+
<p>Parsons problems, also known as mixed-up code problems, are a type of coding exercise where students are presented with a set of code blocks that are mixed up or out of order. The goal is for students to rearrange these blocks into the correct sequence to form a functioning program or solve a specific problem. This type of exercise helps students develop their understanding of code structure, logic, and flow control. They can also be used for pseudocode or mathematical proofs.</p>
<p>The following has the correct code to ‘swap' the values in x and y (so that x ends up with y's initial value and y ends up with x's initial value), but the code is mixed up and contains <b>one extra block</b> which is not needed in a correct solution. Drag the needed blocks from the left into the correct order on the right. Check your solution by clicking on the <i>Check Me</i> button. You will be told if any of the blocks are in the wrong order or if you need to remove one or more blocks.</p>
<p>You can include distractor blocks in the problem. A distractor is code that isn't needed in a correct solution, such as code with a syntax error. Add a distractor block after the correct code block. Distractors can either be paired or unpaired. For paired distractors use #paired at end of the first line of code in the distractor block. For unpaired distractors add #distractor.</p>
<p>You can include distractor blocks in the problem. A distractor is code that isn't needed in a correct solution, such as code with a syntax error. Distractors can either be paired or unpaired. </p>
37
+
112
38
<p>Here is an example with paired distractors from a data oriented intermediate programming course in Python.</p>
<p>The source code for this problem is shown here:</p>
159
-
<program language="rst"><input>
160
-
.. parsonsprob:: mt1dict1ex
161
-
:numbered: left
84
+
</subsection>
85
+
<subsectionxml:id="writing-parsons">
86
+
<title>Writing your own Parsons Problems</title>
162
87
163
-
Complete the function greater_dictionary. Given a dictionary d and an integer cutoff, return a dictionary that contains only the key-value pairs where they key is greater than or equal to cutoff.
<p>The following has the correct code to ‘swap' the values in x and y (so that x ends up with y's initial value and y ends up with x's initial value), but the code is mixed up and contains <b>one extra block</b> which is not needed in a correct solution. Drag the needed blocks from the left into the correct order on the right. Check your solution by clicking on the <i>Check Me</i> button. You will be told if any of the blocks are in the wrong order or if you need to remove one or more blocks.</p>
192
-
</statement>
193
-
<blocks>
194
-
<block order="4">
195
-
<cline>int x = 3;</cline>
196
-
<cline>int y = 5;</cline>
197
-
<cline>int temp = 0;</cline>
198
-
</block>
199
-
<block order="3">
200
-
<cline>temp = x;</cline>
201
-
</block>
202
-
<block order="1">
203
-
<cline>x = y;</cline>
204
-
</block>
205
-
<block order="5">
206
-
<cline>y = temp;</cline>
207
-
</block>
208
-
<block order="2" correct="no">
209
-
<cline>y = x; </cline>
210
-
</block>
211
-
</blocks>
212
-
</exercise>
213
-
<p>The source code for this problem is shown here.</p>
214
-
<program language="rst"><input>
215
-
.. parsonsprob:: 2_swapex
216
-
:noindent:
88
+
<p>To create your own Parsons problems, start or go to any assignment in the Instructor Dashboard "Assignment Builder". In the Exercises section of the assignment, click on "Add Exercise" and select "+ Create New Exercise" and then select "Parsons Prob". </p>
89
+
<p>In step 1, select the coding language or text content for English or another natural language content. </p>
90
+
<p>In Step 2, write the instructions for the students using Markup or enter / for formatting options. </p>
91
+
<p>In Step 3, type in code or text into blocks as shown below. Create the correct solution for the problem. It will be randomly mixed up when presented to students. Click the "Add block" button at the top right or the + at the end of the blue line in between blocks to create new blocks. Click the copy button to create distractors and choose the correct one.</p>
92
+
93
+
<figurealign="center"xml:id="parsons_edit_fig">
94
+
<caption>Create a Parsons Problem</caption>
95
+
<imagesource="Figures/createParsons.png"width="100%"alt="Create a Parsons Problem"/>
96
+
</figure>
217
97
218
-
The following has the correct code to 'swap' the values in x and y (so that x ends up with y's initial value and y ends up with x's initial value), but the code is mixed up and contains <b>one extra block</b> which is not needed in a correct solution. Drag the needed blocks from the left into the correct order on the right. Check your solution by clicking on the <i>Check Me</i> button. You will be told if any of the blocks are in the wrong order or if you need to remove one or more blocks.
219
-
-----
220
-
int x = 3;
221
-
int y = 5;
222
-
int temp = 0;
223
-
=====
224
-
temp = x;
225
-
=====
226
-
x = y;
227
-
=====
228
-
y = temp;
229
-
=====
230
-
y = x; #distractor
231
-
</input></program>
98
+
<p>In Step 4, you can change the settings to set the chapter and section where you want the exercise stored in the assignment builder (where it will show when browsing chapters in the assignment builder), the author, the topic, the number of points for the question, and add tags to help you find the question later. If you change the name of the exercise, make sure it is unique! You can also choose to make the exercise private or contribute it to the question bank for other teachers to use. Please make experimental questions private.. </p>
99
+
<p>In Step 5, you can preview and test the problem before saving the problem.</p>
0 commit comments