Assessment 3: lessons 11 - 14

Use this space for any questions related to the third fixed-response assessment.

Hi, Brook
Unit 5 Assessment 3, Q10: The studio is telling us that “B” is the answer, however, I believe it should be “C” as the question states “A statistician would like to simulate rolling a single die until she has rolled the die a total of 100 times, or she rolls a six a total of 25 times, whichever comes first. Which boolean expression should she use for the to accomplish this?”
Answer B is: rolls < 100 && sixes < 25
Answer C is: rolls < 100 || sixes < 25
Thanks for clarifying!

hi, @cconnor!

this is a tricky question, in part because the prompt is making you think about the conditions needed to stop rolling the die, but the program code you’re filling in defines the conditions needed in order to roll the die.

this is because we’re filling in the missing code on the while loop that is simulating the rolling of the die. we have to ask: what are the conditions needed in order to keep rolling the die? based on the prompt, we want to keep rolling the die as long as the number of rolls is under 100 and the number of 6’s is under 25. if either of those conditions isn’t true, we will exit the loop. for example, if we imagine that we’re on our 100th roll and our 20th time rolling a 6, the conditions in the while loop would be: 100 < 100 && 20 < 25 and this would evaluate to false, because 100 is not less than 100. since this evaluates to false, we’ll exit the loop and in the simulation we will stop rolling the die.

hope this helps!

-brook

1 Like

Test 4 Question 1 - How is not 4? Student tried in code studio and got this for the answer? @brook

hi, @carmichaelc!

in this question, i starts at 1 and increments by one each time the loop executes, and the loop executes until i=5. this means that the code inside the loop only executes 4 times (when i = 1, 2, 3, and 4) and each of those times through the loop correspond to updating the value of indexes 1- 4 in the array. BUT, because the loop runs until i=5, we don’t actually do anything to value in index 5, as the loop doesn’t execute (and the last value isn’t replaced).

hope this helps!

On questions 11-18 you have students using Arrays that begin with an index of 1. Why would you change that all of a sudden, when the entire lesson we have taught them to use index 0 in java script?

1 Like

@charles.sanford

Although Javascript indexes arrays starting at 0, the CB’s pseudo-code indexes arrays starting at 1. In order to prepare for the paper/pencil exam, students will need to practice answering questions based on the pseudo-code’s way of indexing.

Happy computing,
Andrea