CLAD 04-22

CLAD 04-22

Which of the following graphs matches the result in Comparison Values after the following code has executed?

Print Friendly, PDF & Email
3 comments on “CLAD 04-22
  1. Larkin Heintzman says:

    I do not understand how the correct answer can be A? I get that the first two points will be 2 and 3 respectively, but then I am not so sure.
    Any help I could get on this would be much appreciated.

  2. Doug Harper says:

    So the shift register gets pre-loaded, before the loop starts with four values: 2, 3, 1 and 6. The loop takes an output from four deep in the shift register each iteration and compares it to the loop index. The max of this comparison is then saved for the plot and also put back onto the shift register.

    Iteration Shift Register Contents Loop Index Output of Compare Plot Array
    0 2, 3, 1, 6 0 2 2
    1 3, 1, 6, 2 1 3 2,3
    2 1,6,2,3 2 2 2,3,2
    3 6,2,3,2 3 6 2,3,2,6
    4 2,3,2,6 4 4 2,3,2,6,4

    So the plot will contain the following values: 2,3,2,6,4, which is graph (a). Notice that B has the correct Y values but the X values are wrong.

  3. Doug Harper says:

    Well, my spaces in the previous post got all replaced by a single space so the “table” is nearly impossible to read. Sorry !!!

Leave a Reply

Your email address will not be published. Required fields are marked *

*