# Unit 8 Assessment Question 12

**URL:** <https://forum.code.org/t/unit-8-assessment-question-12/39107>\
**Category:** CSA\
**Tags:** csa-unit-8\
**Created:** [March 4, 2024, 11:05pm UTC](https://forum.code.org/t/unit-8-assessment-question-12/39107 "2024-03-04T23:05:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![zhu.xiaobo](https://avatars.discourse-cdn.com/v4/letter/z/919ad9/32.png) [@zhu.xiaobo](https://forum.code.org/u/zhu.xiaobo)\
**Post date:** [March 4, 2024, 11:05pm UTC](https://forum.code.org/t/unit-8-assessment-question-12/39107/1 "2024-03-04T23:05:35Z")

</div>

Is the question in #12 well defined?  
In an edge case of calling mystery(n) and n is greater than all the elements in the numbers array, the call returns 0 and set m at 0. This would make Option E invalid, right?  
Option E: All values in position `0` to `m-1` are less than or equal to `num` .

 ![Q12 with answer](https://us1.discourse-cdn.com/flex016/uploads/codeorgforum/original/2X/f/fcc3d72c86b29fda29d3b172545f7771519290d6.png)

---

<div class="post-metadata">

**Author:** ![lindsay.davis](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/lindsay.davis/32/7632_2.png) [@lindsay.davis](https://forum.code.org/u/lindsay.davis)\
**Post date:** [March 5, 2024, 2:02am UTC](https://forum.code.org/t/unit-8-assessment-question-12/39107/2 "2024-03-05T02:02:14Z")

</div>

Hi Bonnie,  
If I’m reading your thoughts right, for a concrete example of what you are describing:

A call to mystery(10) and 10 is greater than all the elements in the array, let’s say it contains [1,2,3,4,5].  
If n is greater than all the elements in the numbers array, numbers[k] (the current element)will never be greater than num(the parameter which holds n), so k will not be returned.  
The loop will finish, and the length of the array will be returned, which in my example is 5. letter E, that all values from 0 to m-1, which is indices 0 to 4 in this case, will be less than or equal to num, 10.

In your question you said the call would return a 0, which would only happen if the first element in the array is larger than the parameter.

I hope this helps!  
Best,  
Lindsay

---

<div class="post-metadata">

**Author:** ![zhu.xiaobo](https://avatars.discourse-cdn.com/v4/letter/z/919ad9/32.png) [@zhu.xiaobo](https://forum.code.org/u/zhu.xiaobo)\
**Post date:** [March 5, 2024, 2:37am UTC](https://forum.code.org/t/unit-8-assessment-question-12/39107/3 "2024-03-05T02:37:38Z")

</div>

Hi Lindsay,  
Thank you for the prompt response and the detailed explanation! I understood the case you described. However, I had a typo in my first post from this afternoon. I meant to say if n is less than all the elements in the numbers array, for example, n is 0, and the int numbers = [1, 2, 3, 4, 5], then mystery(0) returns 0, which set m at 0. This would make Option E invalid, right?

---

<div class="post-metadata">

**Author:** ![lindsay.davis](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/lindsay.davis/32/7632_2.png) [@lindsay.davis](https://forum.code.org/u/lindsay.davis)\
**Post date:** [March 11, 2024, 5:00pm UTC](https://forum.code.org/t/unit-8-assessment-question-12/39107/4 "2024-03-11T17:00:27Z")

</div>

Hi Bonnie,

With what you described, answer E is definitely a bit awkward- if m is set at 0 then answer E would be describing positions from 0 to -1. Since index -1 doesn’t exist for an array, one could make the argument that this would indicate that there are no values less than or equal to the parameter num . But, I agree that this question could use some clarifying.

Thank you,  
Lindsay
