Difference between revisions of "Scaffolding1"

From WeBWorK_wiki
Jump to navigation Jump to search
m
m
Line 131: Line 131:
 
</tr>
 
</tr>
   
<!-- Main text section -->
+
<!-- Section 2 -->
   
 
<tr valign="top">
 
<tr valign="top">
 
<td style="background-color:#ffdddd;border:black 1px dashed;">
 
<td style="background-color:#ffdddd;border:black 1px dashed;">
 
<pre>
 
<pre>
  +
Context('Matrix');
  +
  +
$M = Matrix([[1,2],[3,4]]);
  +
$v = Matrix([[5],[6]]);
  +
  +
$answer2 = $M * $v;
  +
 
Context()->texStrings;
 
Context()->texStrings;
BEGIN_TEXT
 
  +
DISPLAY_SECTION( {
Question text
 
  +
section=>2,
$BR
 
  +
name=>"2: Bungling",
$BR
 
  +
canshow =>$scaffold->requireCorrect(1,2). " or $isInstructor",
Answer =
 
  +
iscorrect=>$scaffold->requireCorrect(3),
\{ ans_rule(20) \}
 
  +
}, <<'END_SECTION');
\{ AnswerFormatHelp("formulas") \}
 
  +
END_TEXT
 
  +
\( $M $v = \) \{SECTION_ANS($answer2->cmp()), $answer2->ans_array()\}
  +
  +
END_SECTION
  +
  +
SECTION_SOLUTION({section=>2},<<'END_SOLUTION');
  +
Put solution text here.
  +
END_SOLUTION
 
Context()->normalStrings;
 
Context()->normalStrings;
 
</pre>
 
</pre>
 
<td style="background-color:#ffcccc;padding:7px;">
 
<td style="background-color:#ffcccc;padding:7px;">
 
<p>
 
<p>
<b>Main Text:</b>
+
<b>Section 2:</b>
  +
For kicks, we change to the matrix context.
  +
Use <code>canshow =>$scaffold->requireCorrect(1,2). " or $isInstructor"</code> to specify that this section (section 2) can be revealed if answer boxes 1 and 2 are both correct (from section 1) or if the permission level of the user is high enough.
  +
Use <code>iscorrect=>$scaffold->requireCorrect(3)</code> to specify that this section (section 2) will be marked correct when the third answer (the entire matrix) is marked correct.
  +
We used <code>$answer->ans_array(width)</code> to generate an array of answer boxes with the same size as the correct answer that are treated as a single entity when grading.
 
</p>
 
</p>
 
</td>
 
</td>
 
</tr>
 
</tr>
   
<!-- Answer evaluation section -->
+
<!-- Section 3 -->
   
 
<tr valign="top">
 
<tr valign="top">

Revision as of 15:17, 29 June 2014

Sequentially Revealed (Scaffolded) Problems

Click to enlarge

This PG code shows how to create multi-part questions that hide from students parts that have not yet been answered correct.


Templates by Subject Area

PG problem file Explanation

Problem tagging data

Problem tagging:

DOCUMENT();  
loadMacros(
"PGstandard.pl",
"MathObjects.pl",
"compoundProblem5.pl",
"PGcourse.pl",
);

TEXT(beginproblem());
$showPartialCorrectAnswers = 1;

$scaffold = Scaffold();
INITIALIZE_SCAFFOLD('$scaffold');

$isInstructor = 0; # = 0 when students use it

TEXT(MODES(
HTML=>'Clicking on a section opens it 
provided that you have answered previous sections correctly.',
TeX=>''));

Initialization: Use the compoundProblem5.pl macro to provide scaffolding (this macro may be renamed to Scaffolding.pl or sequentiallyRevealed.pl in the future). We initialize the scaffolding with the name $scaffold. Set $isInstructor = 0; when the problem is available to students, or set to 1 when debugging. Alternatively, we could set

$isInstructor =  ($envir{effectivePermissionLevel} >= 
$envir{ALWAYS_SHOW_SOLUTION_PERMISSION_LEVEL});

to ensure that only users that always have permission to show correct answers can open all of the sections of the scaffolding without needing to enter correct answers.

Context("Numeric");

$answer1a = Compute(11);
$answer1b = Compute(12);

Context()->texStrings;
DISPLAY_SECTION({  
    section=>1,
    name=>"1: Antiquated ideas (a descriptive title)", 
    canshow =>1,
    iscorrect=>$scaffold->requireCorrect(1,2), 
} , <<'END_SECTION'); 

Continue the pattern: 7, 8, 9, 10, 
\{SECTION_ANS($answer1a->cmp), $answer1a->ans_rule(3) \},
\{SECTION_ANS($answer1b->cmp), $answer1b->ans_rule(3)\}.

END_SECTION

SECTION_SOLUTION({section=>1},<<'END_SOLUTION');
$PAR
Put some text here for the solution to section 1.
END_SOLUTION
Context()->normalStrings;

Section 1: Use DISPLAY_SECTION to set the parameters for the first section. Use section=>1 to set the section number. Use name=>"1: Descriptive title" to give a title for the section. Since the first section should always be available to students, we set canshow=>1. Use iscorrect=>$scaffold->requireCorrect(1,2) to specify that this section will be marked all correct when the answers in answer boxes 1 and 2 are both correct.

The text that gets displayed to students starts at "Continue..."

Use SECTION_ANS() to record the correct weighted score into the grade book (i.e., database of scores). Note that we use SECTION_ANS($answer->cmp) before $answer->ans_rule(width), which is a bit different from how things are usually done.

It is also possible to provide a solution for each section.

Context('Matrix');

$M = Matrix([[1,2],[3,4]]);
$v = Matrix([[5],[6]]);

$answer2 = $M * $v;

Context()->texStrings;
DISPLAY_SECTION( { 
    section=>2,
    name=>"2: Bungling", 
    canshow =>$scaffold->requireCorrect(1,2). " or $isInstructor",
    iscorrect=>$scaffold->requireCorrect(3), 
},   <<'END_SECTION'); 

\( $M $v = \) \{SECTION_ANS($answer2->cmp()), $answer2->ans_array()\}

END_SECTION

SECTION_SOLUTION({section=>2},<<'END_SOLUTION');
Put solution text here.   
END_SOLUTION
Context()->normalStrings;

Section 2: For kicks, we change to the matrix context. Use canshow =>$scaffold->requireCorrect(1,2). " or $isInstructor" to specify that this section (section 2) can be revealed if answer boxes 1 and 2 are both correct (from section 1) or if the permission level of the user is high enough. Use iscorrect=>$scaffold->requireCorrect(3) to specify that this section (section 2) will be marked correct when the third answer (the entire matrix) is marked correct. We used $answer->ans_array(width) to generate an array of answer boxes with the same size as the correct answer that are treated as a single entity when grading.

$showPartialCorrectAnswers = 1;

ANS( $answer->cmp() );

Answer Evaluation:

Context()->texStrings;
BEGIN_SOLUTION
${PAR}SOLUTION:${PAR}
Solution explanation goes here.
END_SOLUTION
Context()->normalStrings;

COMMENT('MathObject version.');

ENDDOCUMENT();

Solution:

Templates by Subject Area