cancel
Showing results for
Did you mean:

## Re: CLAD2017 - Fundamentals - Nested FORs

Active Participant

Consider the VI. What are the values of Numeric Value 1 and Numeric Value 2 required to generate the contents of Numeric Array Out shown below?

Member

C

Member

Ans C

Happy to Wire
Member

C

Member

C

Member

c)

Trusted Enthusiast

Terminal for Numeric Value 2 should be outside the outermost loop, otherwise the output could be neither of the proposed answers......

Member

C

Knight of NI

C

There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
Trusted Enthusiast

Regards
Ray Farmer
Member

c

Thanks & Regards,
Bharath Kumar
Active Participant

Hi Intaris

Cryptic....could you expand?

Steve

Trusted Enthusiast

If the value of the control "Numeric Value 2" changes between the first and subsequent iterations of the outer loop, any new value of the control can be inferred.  If, after Iteration zero of the outer loop the value of the control would change to 5, the output would be (with a value of "Numeric Value 1" of 3): 0,1,0,1,2,3,4,0,1,2,3,4

Due to the fact the control is read multiple times, race conditions are possible assuming it's not run as a sub-VI.  Nit-picking.

Member

c      3,2

Active Participant

Num1=3 | Num2=2

since only the inner loop appends to the array (in the shift register),

Num2 must be 2 (so 'i' can be 0 and 1).

since we have 3 times of 0,1 in the output array, the outer loop must execute 3 times,

thus Num1 must be 3.

If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
Member

obviously not A and not D.
The Array is written by the inner Loop so we get the pattern 0, 1, 0, 1, 0, 1 if we have Nummeric value 2 = 2

Member

Ans C

Member

Muralidharan Dasarathan
Member

Tarciso Junior
+55 (11) 996-282-103
Skype: Tarciso.junior2
Email: Tsjabrantes@gmail.com
NI Employee

The 0 and 1 values are responsible by the inner loop (Numeric Value 2) while the repetition of  0 and 1 value is responsible by outer loop (Numeric Value 1).

To obtain 0 and 1 value, 2 iterations are required. Therefore, Numeric Value 2 should be 2.

Meanwhile, to obtain 3 repetitions of 0 and 1 values, 3 iterations are required on the outer loop (Numeric Value 1)

Therefore,

Numeric value 1 = 2

Numeric value 2 = 3

Member

Member

If you just look closely all you need is 0 and 1 in the for loop inside so, you only need 2 loops in order to get that.

second, look at the output, there are 6 cells which requires you to have 3 loops on the bigger for loop

WAVE FROM PH