hi everyone...the answer is B. 2D becomes 1D and 1D becomes a scalar value.so only the elements 1,2,3,4,5 will be added with each other. please correct me if i'm wrong 🙂
B is the good one ! But i disagree with your explanation calvin.
The first For loop selects the first line of the array :
The internal For loop iterates 5 time : 1+0 // 2+0 // 3+0 // 4+0 // 5+0 and return the final result 5+0=5 (because indexing mode is disable) to the shift register.
The first For loop selects the second line of the array :
The internal For loop iterates 5 time : 6+5 // 7+5 // 8+5 // 9+5 // 10+5 and return the final result 10+5=15 ! (because indexing mode is disable) to the shift register.
No more iteration for the first For loop so 15 is the Numeric value out !
When Auto Indexing mode is enable for an output : this output is an array
When Auto Indexing mode is disable for an output : this output is a scalar (specifically the last value of the array if auto indexing mode has been enabled).
So in this exemple,
If auto indexing mode has been enabled for the two output of Foor loop. The numeric value of the first For loop will be an Array 1D and not a Scalar and the output of the second one will be an Array 2D. This example will change completly !
If you want to well understand Indexing mode find others questions from SercoSteveB on this blog.
Answer: B. Way too many correct answers to mention everybody by name (first time we have had so many). Nice one. A special shout out to BenoitP. for a couple of great explanantions.
Yep we need to know how the 2D array is auto indexed by the outer loop (does it index the rows or the columns of the 2D) and also we need to notice that the inner loop has standard tunnels and not a shift register, so all of the addition results, apart from the last one, are lost (overwritten).
The autoindexing will index off rows of arrays first. So the array of the first iteration of the outside while loop is {1,2,3,4,5}. The inner FOR loop will just iterate on this array. But since we are not using a shift register (just a normal tunnel), only the last iteration matters. So in the end, it is just 0+5=5. Then the outer FOR loop uses the next row of the 2D array. Since we are using shift registers, the 5 from the previous iteration is used in the addition. This time we get 5+10=15. So the answer is B.
There are only two ways to tell somebody thanks: Kudos and Marked Solutions Unofficial Forum Rules and Guidelines "Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5