The Daily CLAD

Community Browser
cancel
Showing results for 
Search instead for 
Did you mean: 

Re: Cluster Manipulation

SercoSteveB
Active Participant

What is Boolean Value Out following execution of the VI?

Cluster Manipulation.png

a) TRUE

b) FALSE

c) Possibly TRUE or FALSE

d) Neither TRUE nor FALSE

Comments
crossrulz
Knight of NI

Because Steve likes to be sneaky every once in a while, I would have to go with C simply because we do not know the actual order or the starting cluster.


GCentral
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
Hirren
Member

a)TRUE

LordNobady
Member

I agree that Steve likes to be sneaky, but I believe the deal was that if not tolt otherwise that we should asume that the deafualts are used.  with that in mind I go for A


Learning LabVIEW since January 2013
SercoSteveB
Active Participant

If there were an emoticon for 'Bond villain laugh' I would be using it......

tst
Knight of NI Knight of NI
Knight of NI

I'm with Tim (and certainly Steve's comment helps anchor that view). Of course in this case it's easy enough to drag the snippet into LV and check the order, but I agree with Tim that the main point (regardless of the actual answer in this specific case) is that you should not assume the order of cluster elements by their visual appearance. I personally try to use Arrange Vertically or horizontally when possible, but I also use the other two often enough.

It should probably also be pointed out that D is there simply to serve as additional distraction, because it's not a possible answer in LV (it is possible in other languages which have the concept of null values).


___________________
Try to take over the world!
MrStevenUND
Member

The order of the initial cluster is not shown.  Therefore, only Steve knows.  C.

tst
Knight of NI Knight of NI
Knight of NI

It's also worth noting that the other takeaway from this is that you should generally always use Unbundle by Name and not Unbundle, as this also makes the code clearer and helps with cases where you change the structure of clusters. In that case, the order of the elements in the cluster doesn't actually matter.

Unless you're doing something like what the JKI state machine does, where it uses Bundle to define a cluster, you should also generally use Bundle by Name over Bundle.


___________________
Try to take over the world!
Amiri
Member

C

I agree with MrStevenUND, the order of the cluster is not shown.

Hirren
Member

good one steve ..Thank you..

DivyaAcharya
Member

I implemented this in Labview and get "TRUE" every time i run it.. so a)

tst
Knight of NI Knight of NI
Knight of NI

DivyaAcharya wrote:


I implemented this in Labview and get "TRUE" every time i run it.. so a)

Then you didn't understand the point of the question and the comments. The whole point is that you can't know if the order of the elements in the cluster is as shown. The actual answer to Steve's question is A or B, but you can't know which just from looking at the image. You would have to take the actual code that Steve wrote and test it, which is why C is the correct answer. If you want, you can actually test Steve's code (it's a snippet, look that up), but it doesn't really matter whether it's A or B.


___________________
Try to take over the world!
SercoSteveB
Active Participant

Hi DivyaAcharya, try modifying the order of the elements within the Cluster Constant and see how that impacts the result of the execution.

SercoSteveB
Active Participant

Answer:  C.  Nice one crossrulz, tst, MrStevenUND & Amiri

Yep this one was all about Cluster Constant and the order of the elements within it as crossrulz and tst point out.   Oh the dangers of using Bundle and Unbundle, rather than using the "... by Name" equivalents.

M.P.Bharghavi
Member

Ans: A

True

I have done the question on Labview and saying the answer.

Since unbundle by name has names as Numeric1 Numeric2 and Numeric3 it divides in the same way as that of unbundle.

crossrulz
Knight of NI

Did you try running Steve's snippet?  The cluster order (which is what the normal Unbundle uses) is actually backwards (Numeric 3, Numeric 2, Numeric 1).  So the result will actually be FALSE.

This is one reason I like to use the Autosizing->Arrange Vertically on cluster constants.


GCentral
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
N.UdhayaKamali
Member

C

N.UdhayaKamali
Member

A

mohamedtanveej17
Member

by th logical way we go C

but i can't get the different output for unbundle and unbundle by name

crossrulz
Knight of NI

mohamedtanveej17 wrote:

but i can't get the different output for unbundle and unbundle by name

                    

Try reordering the initial cluster constant so that Numeric 2 is the first item.  Unbundle always follows the cluster order.  Unbundle By Name does not.


GCentral
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
levonsg
Member

C

https://images.youracclaim.com/size/340x340/images/2edb5b1a-9414-44e1-8519-c774fc6dd079/36015_Certificate_Badges_FINAL__1__NI_Instructor_v5.png