[Solved] How many times will each print statement be executed? [closed]


Smells like homework and of course the code you pasted wouldn’t even compile, but

  • print #1 – once
  • print #2 & #4 – 4 times, as the block is run once on each CPU
  • “print #” (in the for) – 40 times, if you have 40 CPUs, once on each, if you have 4, then 10 times on each

Is this tricky homework?

2

solved How many times will each print statement be executed? [closed]