Skip to content

Commit 4135460

Browse files
committed
creating parsons probs updates
1 parent d9c3125 commit 4135460

1 file changed

Lines changed: 49 additions & 179 deletions

File tree

Lines changed: 49 additions & 179 deletions
Original file line numberDiff line numberDiff line change
@@ -1,114 +1,40 @@
1+
<?xml version="1.0"?>
12
<section xml:id="writing-exercises_mixed-up-code-parsons">
23
<title>Mixed-Up Code (Parsons)</title>
34
<introduction>
4-
<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 &amp;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>
6+
</introduction>
7+
<subsection xml:id="parsons-examples">
8+
<title>Example Parsons Problems</title>
9+
10+
<p>Here is an example:</p>
11+
<exercise label="swapex" indent="hide" language="python">
12+
<statement>
13+
<p>The following has the correct code to &#8216;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 &lt;b&gt;one extra block&lt;/b&gt; 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 &lt;i&gt;Check Me&lt;/i&gt; 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>
14+
</statement>
15+
<blocks>
16+
<block order="4">
17+
<cline>int x = 3;</cline>
18+
<cline>int y = 5;</cline>
19+
<cline>int temp = 0;</cline>
20+
</block>
21+
<block order="3">
22+
<cline>temp = x;</cline>
23+
</block>
24+
<block order="1">
25+
<cline>x = y;</cline>
26+
</block>
27+
<block order="5">
28+
<cline>y = temp;</cline>
29+
</block>
30+
<block order="2" correct="no">
31+
<cline>y = x; </cline>
32+
</block>
33+
</blocks>
34+
</exercise>
3135

32-
</introduction>
33-
<subsection xml:id="writing-exercises_parsons-options">
34-
<title>Parsons Options</title>
35-
<p>Options are indented under the Parsons directive (under the p).</p>
36-
<table xml:id="writing-exercises_id1">
37-
<tabular>
38-
<title>Parsons Problems Options</title>
39-
40-
41-
42-
43-
<row header="yes">
44-
<cell>
45-
Option
46-
</cell>
47-
<cell>
48-
Description
49-
</cell>
50-
</row>
51-
52-
53-
<row>
54-
<cell>
55-
maxdist
56-
</cell>
57-
<cell>
58-
The maximum number of distractors to use. They will be picked at random
59-
</cell>
60-
</row>
61-
<row>
62-
<cell>
63-
order
64-
</cell>
65-
<cell>
66-
The order for the lines, they are displayed in a random order normally
67-
</cell>
68-
</row>
69-
<row>
70-
<cell>
71-
language
72-
</cell>
73-
<cell>
74-
Specify the language: java, python
75-
</cell>
76-
</row>
77-
<row>
78-
<cell>
79-
noindent
80-
</cell>
81-
<cell>
82-
Provide the indentation for the user by adding spaces to the left of the code
83-
</cell>
84-
</row>
85-
<row>
86-
<cell>
87-
adaptive
88-
</cell>
89-
<cell>
90-
Provide help is the user is struggling and modify the difficulty of the problem based on the user's performance on the previous problem
91-
</cell>
92-
</row>
93-
<row>
94-
<cell>
95-
numbered
96-
</cell>
97-
<cell>
98-
Show numbered labels to the left of the code if you add left or to the right when you add right
99-
</cell>
100-
</row>
101-
102-
103-
</tabular>
104-
</table>
105-
</subsection>
106-
<subsection xml:id="writing-exercises_parsons-distractor-types">
107-
<title>Parsons Distractor Types</title>
108-
<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>
109-
</subsection>
110-
<subsection xml:id="writing-exercises_example-with-paired-distractors">
111-
<title>Example with Paired Distractors</title>
36+
<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+
11238
<p>Here is an example with paired distractors from a data oriented intermediate programming course in Python.</p>
11339
<exercise label="mt1dict1ex" numbered="yes" indent="show" language="python">
11440
<statement>
@@ -155,79 +81,23 @@
15581
</block>
15682
</blocks>
15783
</exercise>
158-
<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+
<subsection xml:id="writing-parsons">
86+
<title>Writing your own Parsons Problems</title>
16287

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.
164-
-----
165-
def greater_dictionary(d, cutoff):
166-
=====
167-
def greater_dictionary(self, d, cutoff): #paired
168-
=====
169-
result = {}
170-
=====
171-
for key in d.keys():
172-
=====
173-
for key in range(d): #paired
174-
=====
175-
if key &gt;= cutoff:
176-
=====
177-
if key &gt; cutoff: #paired
178-
=====
179-
result[key] = d[key]
180-
=====
181-
d[key] = result[key] #paired
182-
=====
183-
return result
184-
</input></program>
185-
</subsection>
186-
<subsection xml:id="writing-exercises_example-with-unpaired-distractor">
187-
<title>Example with Unpaired Distractor</title>
188-
<p>Here is an example with an unpaired distractor.</p>
189-
<exercise label="2_swapex" indent="hide" language="python">
190-
<statement>
191-
<p>The following has the correct code to &#8216;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 &lt;b&gt;one extra block&lt;/b&gt; 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 &lt;i&gt;Check Me&lt;/i&gt; 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+
<figure align="center" xml:id="parsons_edit_fig">
94+
<caption>Create a Parsons Problem</caption>
95+
<image source="Figures/createParsons.png" width="100%" alt="Create a Parsons Problem"/>
96+
</figure>
21797

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 &lt;b&gt;one extra block&lt;/b&gt; 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 &lt;i&gt;Check Me&lt;/i&gt; 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>
100+
101+
232102
</subsection>
233103
</section>

0 commit comments

Comments
 (0)