triviajeon
Member
- Joined
- Aug 5, 2019
- Messages
- 84
- Gender
- Undisclosed
- HSC
- 2021
Students helping students, join us in improving Bored of Studies by donating and supporting future students!
For Q15, I made a table and got it as index=2 for X and index=3 for Z instead? So when I swapped them, it gave me B. I still didn't quite get how you got it the other way originally? I can send you my working out, if you'd like.After the loop, the program swaps the value at X and Z, i.e. swaps the min/max value in the list. So, since the max value of the list is 6 (index=3) and min value is 1 (index=2), the value of X is 3 and Y is 2 giving option C.
You too mate!Hope it helps. Good luck with your SDD exam tomorrow (and good luck to myself too haha)
Ohhh so you mean it is only swapping the values and not the index?The question gives the original list which is not swapped yet. After the loop, we get X = 3 and Z = 2, and since those values are not changed after the loop (and essentially remain the same for the rest of the program), after the code has been executed, the values of X should still be 3 and Z should be 2.