The Daily CLAD

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

Re: Queue Series 5 of 5....Queue Preview

SercoSteveB
Active Participant

What is Numeric Value Out following execution of the VI?

 

PreQueue.png

a) -1

b) 0

c) 10

d) undefined

Comments
nik35324
Member

B

jwscs
Active Participant

B

 

the default value of the queue is "0",

a loop with a "0" wired to the count terminal executes zero times,

which means nothing is in the queue,

therefor "preview queue element" times out after 10ms and returns the default data type, e.g. "0".

to note is that "0" would be the answer even when the loop would run at least once 😉


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
crossrulz
Knight of NI

B


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
Kris_M
Member

The answer is B

This is because of the default value of the numeric data type held in memory.

if you was to build this VI you would see a error appear after the preview Q function.

 

slightly a trick question as the default value could possibly be change to something other than 0

crossrulz
Knight of NI

No, you should not get an error.  The timeout does NOT cause an error.  If you did get an error, my guess is error code 1  because you did not use shift registers on the FOR loop.


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
Matt-A.
Member

B. 

MrStevenUND
Member

B

CataM
NI Employee (retired)

b)

qubirt
Member

B

LV_COder
Member

B

SercoSteveB
Active Participant

Answer: B.  Nice one all.  Smiley Surprised

levonsg
Member

B

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

I have change the value of n terminal from 0 to 3. Than I am getting numeric value out 99.

 

Please help me out here why its 99.

crossrulz
Knight of NI

Assuming complete isolation, I would still expect the value to be 0 since that is the next value in the queue.  So the only thing I can think of is you were messing around with another VI that also named the queue StevesQueue and it enqueued 100 elements and dequeued 99 element.  This is one of the reasons I do not name my queues.

 

Perhaps if you shared some code we could help debugging.


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
Akhil_shah
Member

The reason you mentioned above is correct. I tried it with newvi and now I got answer 0. Thank you.