News:

And we're back!

Main Menu

Computer Programmers, to me!

Started by merithyn, May 13, 2013, 05:47:06 PM

Previous topic - Next topic

merithyn

I need the answers to the following questions on my final exam:

1.) What will be the value of the variable intTotalCount when the following code is executed?
  For intOuterCount = 1 to 5
     For intInnercount = 1 to 4
          intTotalCount +=1
     Next
  Next

2.) How many times will the following loop execute?
  For intCount = 10 to 1 Step -2
     'Body of loop
  Next

3.) A For...Next loop with a beginning value of 1, an eding value of 25, and a Step value of 3 will execute how many times?

4.) A loop's ___________ variable is a numeric variable that keeps track of the number of iterations the loop completes.


And no, I'm not cheating. I'm trying to figure out my score. I already took the exam. :P
Yesterday, upon the stair,
I met a man who wasn't there
He wasn't there again today
I wish, I wish he'd go away...

mongers

Kids these days asking adults to do their homework.   :rolleyes:






:P
"We have it in our power to begin the world over again"

merithyn

Quote from: mongers on May 13, 2013, 05:48:24 PM
Kids these days asking adults to do their homework.   :rolleyes:
:P

Does it count if I'm just verifying my answers? :unsure:
Yesterday, upon the stair,
I met a man who wasn't there
He wasn't there again today
I wish, I wish he'd go away...

DGuller


Baron von Schtinkenbutt

1) The inner loop statement will execute 20 times, so 20 + the value of intTotalCount before the nested loops.
2) 5 (intCount = [10, 8, 6, 4, 2])
3) 9 (intCount = [1, 4, 7, 10, 13, 16, 19, 22, 25])
4) iteration (There really isn't a single term for this.  Iteration, index, and loop variable are the three most common.)

merithyn

Okay, so I got the first three right. The fourth one is either compound, accumulated, matrix, or control.
Yesterday, upon the stair,
I met a man who wasn't there
He wasn't there again today
I wish, I wish he'd go away...

DGuller

Quote from: merithyn on May 13, 2013, 05:59:28 PM
Okay, so I got the first three right. The fourth one is either compound, accumulated, matrix, or control.
Yeah, you should've given us the choices if this was a multiple choice test.  There are many right answers to that question.  Out of these 4 options, control variable is the answer (though I would argue that it's not really the correct answer to the question given).

merithyn

I put accumulated, but I think you're right, and it's control. :(
Yesterday, upon the stair,
I met a man who wasn't there
He wasn't there again today
I wish, I wish he'd go away...

Baron von Schtinkenbutt

Quote from: DGuller on May 13, 2013, 06:03:07 PM
Quote from: merithyn on May 13, 2013, 05:59:28 PM
Okay, so I got the first three right. The fourth one is either compound, accumulated, matrix, or control.
Yeah, you should've given us the choices if this was a multiple choice test.  There are many right answers to that question.  Out of these 4 options, control variable is the answer (though I would argue that it's not really the correct answer to the question given).

Agreed.  I have seen or heard it referred to as the loop control variable before, but usually by non-programmers.

Maximus

It's a BS question. Way too much focus in this course on memorizing the correct terminology. If you can get the first 3 questions right and it is clear what you mean it doesn't matter what you call it.

merithyn

Quote from: Baron von Schtinkenbutt on May 13, 2013, 06:07:04 PM
Quote from: DGuller on May 13, 2013, 06:03:07 PM
Quote from: merithyn on May 13, 2013, 05:59:28 PM
Okay, so I got the first three right. The fourth one is either compound, accumulated, matrix, or control.
Yeah, you should've given us the choices if this was a multiple choice test.  There are many right answers to that question.  Out of these 4 options, control variable is the answer (though I would argue that it's not really the correct answer to the question given).

Agreed.  I have seen or heard it referred to as the loop control variable before, but usually by non-programmers.

Yes, well, I'm not convinced my teacher is a programmer, so it stands to reason. ;)

It's Visual Basic, too, which has odd answers to things. Once I knew what to look up, I was able to find the exact sentence in the book which says that yes, a loop's control variable... etc.

Thanks, guys! I did crap on my exam. :(
Yesterday, upon the stair,
I met a man who wasn't there
He wasn't there again today
I wish, I wish he'd go away...

merithyn

Quote from: Maximus on May 13, 2013, 06:10:22 PM
It's a BS question. Way too much focus in this course on memorizing the correct terminology. If you can get the first 3 questions right and it is clear what you mean it doesn't matter what you call it.

It's an Intro to Programming class. Of course it's focusing on getting the terminology right. Even you spend a lot of time correcting my "lingo". I don't begrudge the question, except that I got it wrong. :(
Yesterday, upon the stair,
I met a man who wasn't there
He wasn't there again today
I wish, I wish he'd go away...

Josquius

I've used a fair bit of vb before and this inner/outer count stuff is new to me, how odd.
Ah VB...so nice but so useless, which is sad,
██████
██████
██████

Caliga

0 Ed Anger Disapproval Points

merithyn

Quote from: Tyr on May 13, 2013, 07:07:34 PM
I've used a fair bit of vb before and this inner/outer count stuff is new to me, how odd.
Ah VB...so nice but so useless, which is sad,

Oh? I can see plenty of uses for it.
Yesterday, upon the stair,
I met a man who wasn't there
He wasn't there again today
I wish, I wish he'd go away...