Reading Questions Answer Checker
To check your answers put them in the appropriate box and click the ‘Check’ button. Every checker box can do arithmetic and calculate standard functions (see calculator help). If you give decimal answers, give them to at least 3 decimal places.
As you work you should have pencil and paper handy for calculations and thinking!
Note: some questions ask for a formula. For the checker we ask you to plug a value into the formula. For your pset you still need to give the whole formula.
//DEBUG PARAMETERS //Because we don’t show solutions for pset checkers we use //this to give a showanswer button during the debugging phase var debugans = undefined; //release //var debugans = kDebugAnswer; //debug problemNumber = 0; wl(“Calculator”); writecalculator(“psetcheckcalcid”, “Calculate”); whr(kdivcol,kdivwid);
//Problem 1 problemNumber++; wl(problemheader(problemNumber)); wl(kp); var s; var partName, problemName, buttonLabel, answerArray, correct; s = [“You roll two dice. Consider the following events.", kbr, “$A$ = ‘first die is 3’", kbr, “$B$ = ‘sum is 7’", kbr, “$C$ = ‘sum is greater than or equal to 7’"]; wl(s.join(’ ‘)); wl(kp); s = ["(a) Compute $P(B)$."]; wl(s.join(’ ‘)); wl(kp); partName = problemNumber + " (a)"; problemName = “prob” + partName; buttonLabel = “Check problem " + partName; writeNumericBox(partName+"id”, .16667, buttonLabel, 0.001, “1/6 ≈ 0.16667”); wl(kp); s = ["(b) Compute $P(B|A)$."]; wl(s.join(’ ‘)); wl(kp); partName = problemNumber + " (b)"; problemName = “prob” + partName; buttonLabel = “Check problem " + partName; writeNumericBox(partName+"id”, .16667, buttonLabel, 0.001, “1/6 ≈ 0.16667”); wl(kp); s = ["(c) Compute $P(B|C)$."]; wl(s.join(” “)); wl(kp); partName = problemNumber + " (c)"; problemName = “prob” + partName; buttonLabel = “Check problem " + partName; writeNumericBox(partName+"id”, .28571, buttonLabel, 0.001, “6/21 ≈ 0.2857”); wl(kp); s = ["(d) Are $A$ and $B$ indepenendent”]; wl(s.join(” “)); wl(kbr); partName = problemNumber + " (d)"; problemName = “prob” + partName; buttonLabel = “Check problem " + partName; correct = “Yes” var answerArray = [correct,“No”]; writeMultipleChoiceRadioGroup(answerArray, problemName, correct, buttonLabel); wl(kp); s = ["(e) Are $B$ and $C$ indepenendent”]; wl(s.join(” “)); wl(kbr); partName = problemNumber + " (e)"; problemName = “prob” + partName; buttonLabel = “Check problem " + partName; correct = “No” var answerArray = [‘Yes’,correct]; writeMultipleChoiceRadioGroup(answerArray, problemName, correct, buttonLabel); whr(kdivcol,kdivwid);
//Problem 2 problemNumber++; wl(problemheader(problemNumber)); wl(kp); var s; var partName, problemName, buttonLabel, answerArray, correct; s = [“Draw two cards from a deck.", kbr, “Let $S_1$ = `first card is a spade’.", kbr, “Let $S_2$ = `second card is a spade’.", kp, “What is $P(S_2 | S_1^c)$?"]; wl(s.join(” “)); wl(kp); partName = problemNumber; problemName = “prob” + partName; buttonLabel = “Check problem " + partName; writeNumericBox(partName+"id”, .25490, buttonLabel, 0.001, “13/51 ≈ 0.2549”); whr(kdivcol,kdivwid);
//Problem 3 problemNumber++; wl(problemheader(problemNumber)); var s; var partName, problemName, buttonLabel, answerArray, correct; s = [“Start with an urn with 5 red and 3 blue balls in it. Draw one ball. Put that ball back in the urn along with another ball of the same color.", kbr, “Now draw another ball from the urn”]; wl(s.join(’ ‘)); wl(kp); s = ["(a) What is the probability the second ball is red?"]; wl(s.join(’ ‘)); wl(kp); partName = problemNumber + " (a)"; problemName = “prob” + partName; buttonLabel = “Check problem " + partName; writeNumericBox(partName+"id”, .625, buttonLabel, 0.001, kuseCorrectVal); wl(kp); s = ["(b) Suppose the second ball is red. What is the probability the first ball was blue."]; wl(s.join(’ ‘)); wl(kp); partName = problemNumber + " (b)"; problemName = “prob” + partName; buttonLabel = “Check problem " + partName; writeNumericBox(partName+"id”, 1/3, buttonLabel, 0.001, “1/3 ≈ .3333”); wl(kbr); whr(kdivcol,kdivwid);