|
1 | | - |
2 | 1 | ## DESCRIPTION |
3 | 2 | ## Introduction to WeBWorK |
4 | 3 | ## ENDDESCRIPTION |
|
17 | 16 | ## AuthorText1('') |
18 | 17 | ## Section1('') |
19 | 18 | ## Problem1('') |
| 19 | +## MO(1) |
20 | 20 |
|
21 | 21 |
|
22 | 22 | DOCUMENT(); # This should be the first executable line in the problem. |
23 | 23 |
|
24 | 24 | loadMacros( |
25 | 25 | "PGstandard.pl", |
26 | | - "PGchoicemacros.pl", |
| 26 | + "MathObjects.pl", |
| 27 | + "PGML.pl", |
27 | 28 | "PGcourse.pl" |
28 | 29 | ); |
29 | 30 |
|
30 | 31 | TEXT(beginproblem()); |
31 | 32 | $showPartialCorrectAnswers = 1; |
32 | 33 |
|
33 | | -BEGIN_TEXT |
34 | | -This part demonstrates WeBWorK problems where you enter letters |
35 | | -or words. We start with a True/False question. |
36 | | - |
37 | | -$PAR |
38 | | - |
39 | | -Enter a $BITALIC T $EITALIC or an $BITALIC F $EITALIC in |
40 | | -each answer space below to indicate whether the corresponding statement is true or |
41 | | -false. |
42 | | - |
43 | | -$PAR |
| 34 | +## First we set up our variables. |
44 | 35 |
|
45 | | -END_TEXT |
| 36 | +Context("Numeric"); |
| 37 | +Context()->strings->add(T=>{},F=>{},"undefined"=>{}); |
46 | 38 |
|
47 | | -## First we set up our variables. |
48 | 39 | $a = random(1,5,1); |
49 | 40 | $b = random(6,10,1); |
50 | 41 | $c = random(-10,-1,1); |
51 | 42 | $d = random(-10,-1,1); |
52 | 43 | $e = random(1,10,1); |
53 | 44 | $f = random(5,10,1); |
54 | 45 |
|
55 | | -$questStr1 = EV2(" \( -$a \lt -$b \) "); |
56 | | -$ansStr1 = "F"; |
57 | | -$questStr2 = EV2(" \( $c \leq $c \) "); |
58 | | -$ansStr2 = "T"; |
59 | | -$questStr3 = EV2(" \( $d \lt $d \) "); |
60 | | -$ansStr3 = "F"; |
61 | | -$questStr4 = EV2(" \( \pi \geq \frac{22}{7} \) ") ; |
62 | | -$ansStr4 = "F"; |
63 | | -$questStr5 = EV2(" \( \sqrt {$e+3} \geq \sqrt $e + \sqrt 3 \) "); |
64 | | -$ansStr5 = "F"; |
65 | | -$questStr6 = EV2(" \( \sqrt {$f-3} \geq \sqrt $f - \sqrt 3 \) "); |
66 | | -$ansStr6 = "T"; |
67 | | -$questStr7 = EV2(" \( \sqrt {$f*$e} \geq \sqrt $e \sqrt $f \) "); |
68 | | -$ansStr7 = "T"; |
| 46 | +# The first five question and answer pairs are randomly selected |
| 47 | +# from this list |
| 48 | + |
| 49 | +@quesAns = ( |
| 50 | + ["$a \lt -$b", String("F")], |
| 51 | + ["$c \leq $c", String("T")], |
| 52 | + ["$d \lt $d", String("F")], |
| 53 | + ["\pi \geq \frac{22}{7}", String("F")], |
| 54 | + ["\sqrt {$e+3} \geq \sqrt $e + \sqrt 3", String("F")], |
| 55 | + ["\sqrt {$f-3} \geq \sqrt $f - \sqrt 3", String("T")], |
| 56 | + ["\sqrt {$f*$e} \geq \sqrt $e \sqrt $f", String("T")] |
| 57 | +); |
| 58 | + |
| 59 | +# randomly select five from the seven above |
69 | 60 |
|
70 | | -@questions =( $questStr1,$questStr2,$questStr3,$questStr4,$questStr5,$questStr6,$questStr7); |
71 | | -@answers =( $ansStr1,$ansStr2,$ansStr3,$ansStr4,$ansStr5,$ansStr6,$ansStr7); |
| 61 | +@choices = (0..6); |
| 62 | +for ($i=0; $i<5; $i++){ |
| 63 | + $j=random($i,6,1); |
| 64 | + ($choices[$i],$choices[$j])=($choices[$j],$choices[$i]); |
| 65 | +} |
| 66 | +@quesAns = @quesAns[@choices[0..4]]; |
72 | 67 |
|
73 | | -## Now choose randomly 5 questions out of the 7 question strings above. |
| 68 | +## Begin the text of the question |
| 69 | +## Insert the first five question/answer pairs into the text and generate the |
| 70 | +## others within the text. |
74 | 71 |
|
75 | | -@slice = NchooseK(scalar(@questions),5); |
| 72 | +BEGIN_PGML |
| 73 | +This part demonstrates WeBWorK problems where you enter letters |
| 74 | +or words. We start with a True/False question. |
| 75 | + |
| 76 | +Enter a _T_ or an _F_ in |
| 77 | +each answer space below to indicate whether the corresponding statement is true or false. |
76 | 78 |
|
77 | | -## Next we output the 5 chosen questions. # |
78 | | -TEXT( &match_questions_list(@questions[@slice]) ); |
| 79 | +[___]{$quesAns[0][1]} *1.* [`[$quesAns[0][0]]`] |
79 | 80 |
|
80 | | -ANS(str_cmp([ @answers[@slice] ] )); |
| 81 | +[___]{$quesAns[1][1]} *2.* [`[$quesAns[1][0]]`] |
81 | 82 |
|
82 | | -TEXT(<<EOT); |
| 83 | +[___]{$quesAns[2][1]} *3.* [`[$quesAns[2][0]]`] |
83 | 84 |
|
84 | | -$PAR |
| 85 | +[___]{$quesAns[3][1]} *4.* [`[$quesAns[3][0]]`] |
85 | 86 |
|
| 87 | +[___]{$quesAns[4][1]} *5.* [`[$quesAns[4][0]]`] |
| 88 | + |
86 | 89 | Notice that if one of your answers is wrong then, in this problem, |
87 | 90 | WeBWorK will tell you which parts are wrong and which parts are right. |
88 | 91 | This is the behavior for most problems, but for true/false or multiple |
89 | 92 | choice questions WeBWorK will usually only tell you whether or not all |
90 | 93 | the answers are correct. It won't tell you which ones are wrong. The |
91 | 94 | idea is to encourage you to think rather than to just try guessing. |
92 | 95 |
|
93 | | -$PAR Typically all of the answers must be correct before you get |
| 96 | +Typically all of the answers must be correct before you get |
94 | 97 | credit for a problem like this. |
95 | | -EOT |
96 | 98 |
|
97 | | -BEGIN_TEXT |
98 | | - |
99 | | -$PAR |
100 | | -$HR |
101 | | -$PAR |
| 99 | +----- |
102 | 100 |
|
103 | 101 | Now we have a question where the answer involves a word. When a word is |
104 | 102 | a possible answer, we will usually emphasize your options by using |
105 | | -$BITALIC italics $EITALIC. Where would this happen? |
106 | | - |
107 | | -$PAR |
| 103 | +_italics_. Where would this happen? |
108 | 104 |
|
109 | | -Well, we might have a situation where we have division by zero. Of course, we all know that this is $BITALIC undefined $EITALIC. |
| 105 | +Well, we might have a situation where we have division by zero. Of course, we all know that this is _undefined_. |
110 | 106 |
|
111 | | -$PAR |
| 107 | +We might also try to take the square root (or even root) of a negative number. This is also _undefined_ if we expect to get a real number as an answer. |
112 | 108 |
|
113 | | -We might also try to take the square root (or even root) of a negative number. This is also $BITALIC undefined $EITALIC if we expect to get a real number as an answer. |
| 109 | +----- |
114 | 110 |
|
115 | | -$PAR |
116 | | -$HR |
117 | | -$PAR |
118 | | - |
119 | | -Evaluate the following expressions. Exact real number answers are required for each problem. When one of them does not evaluate to a real number, type $BITALIC undefined $EITALIC in its answer box. Also, if you try to enter the calculation into WeBWorK for an $BITALIC undefined $EITALIC process, WeBWorK will NOT give you credit. |
120 | | - |
121 | | -$PAR |
| 111 | +Evaluate the following expressions. Exact real number answers are required for each problem. When one of them does not evaluate to a real number, type _undefined_ in its answer box. Also, if you try to enter the calculation into WeBWorK for an _undefined_ process, WeBWorK will NOT give you credit. |
122 | 112 |
|
123 | 113 | Pay attention to how placing parentheses, shifting the location of a negative sign, or changing an operation can change the result of the calculations. |
124 | 114 |
|
125 | | -END_TEXT |
126 | | - |
127 | | -BEGIN_TEXT |
128 | | -$PAR |
129 | | - |
130 | | -$BBOLD 6. $EBOLD $SPACE (2/3-3) = \{ ans_rule(20) \} |
131 | | - |
132 | | -END_TEXT |
133 | | - |
134 | | -ANS(str_cmp("-7/3")); |
135 | | - |
136 | | -BEGIN_TEXT |
137 | | -$PAR |
138 | | - |
139 | | -$BBOLD 7. $EBOLD $SPACE 2/(3-3) = \{ ans_rule(20) \} |
140 | | - |
141 | | -END_TEXT |
142 | | - |
143 | | -ANS(str_cmp("undefined")); |
144 | | - |
145 | | -BEGIN_TEXT |
146 | | -$PAR |
147 | | - |
148 | | -$BBOLD 8. $EBOLD $SPACE (4-4)/(3*3) = \{ ans_rule(20) \} |
149 | | - |
150 | | -END_TEXT |
151 | | - |
152 | | -ANS(str_cmp("0")); |
153 | | - |
154 | | -BEGIN_TEXT |
155 | | -$PAR |
156 | | - |
157 | | -$BBOLD 9. $EBOLD $SPACE (4-4)/(3-3) = \{ ans_rule(20) \} |
158 | | - |
159 | | -END_TEXT |
160 | | - |
161 | | -ANS(str_cmp("undefined")); |
162 | | - |
163 | | -BEGIN_TEXT |
164 | | - |
165 | | -$PAR |
166 | | - |
167 | | -$BBOLD 10. $EBOLD $SPACE \( -\sqrt{25}\) = \{ ans_rule(20) \} |
168 | | - |
169 | | -$PAR |
170 | | - |
171 | | -END_TEXT |
172 | | - |
173 | | -$ans = "-sqrt(25)" ; |
174 | | -ANS(num_cmp($ans)); |
| 115 | + *6.* [`(2/3-3)`] = [__________]{Compute("-7/3")} |
175 | 116 |
|
176 | | -BEGIN_TEXT |
| 117 | + *7.* [`2/(3-3) `] = [__________]{String("undefined")} |
177 | 118 |
|
178 | | -$PAR |
| 119 | + *8.* [`(4-4)/(3*3) `] = [__________]{Compute(0)} |
179 | 120 |
|
180 | | -$BBOLD 11. $EBOLD $SPACE \( \sqrt{-25}\) = \{ ans_rule(20) \} |
| 121 | + *9.* [`(4-4)/(3-3) `] = [__________]{String("undefined")} |
181 | 122 |
|
182 | | -$PAR |
| 123 | + *10.* [` -\sqrt{25} `] = [__________]{Compute(-5)} |
183 | 124 |
|
184 | | -END_TEXT |
| 125 | + *11.* [`\sqrt{-25} `] = [__________]{String("undefined")} |
| 126 | +END_PGML |
185 | 127 |
|
186 | | -ANS(str_cmp("undefined")); |
187 | 128 |
|
188 | 129 |
|
189 | 130 | ENDDOCUMENT(); # This should be the last executable line in the problem. |
0 commit comments