Welcome! Log In Create A New Profile

Advanced

Ass2 Q3b

Posted by hallakj 
Announcements Last Post
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
Ass2 Q3b
July 17, 2006 10:08AM
Please note there is a misprint in the code given in this question (in Tut Letter 101). The for loop should read

for (int i = 0; i < 4; i++)
Anonymous User
Re: Ass2 Q3b
July 17, 2006 10:13AM
Um, what about us people who have submitted the assignment ages ago?
avatar Re: Ass2 Q3b
July 17, 2006 10:18AM
Well it did read: for (int i = 0; i < 4)
which is invalid code, and by looking at the context of the question it should be quite obvious that it needs to loop 3 times anyway.

Seeing as the question is about the values of certain variables after.
a) the first iteration
b) the second iteration and
c) the third iteration
(if I remember correctly).

So it shouldn't really have any outcome on peoples answers anyway?
Re: Ass2 Q3b
July 18, 2006 10:24AM
Hehe... are some of us leaving the assignment submission a bit late? smiling smiley Seriously though, I've come to the conclusion that if a paper has an error like that I just add an assumption. Here's what I did for that question:

"The for loop in this program has the following issues:

• It only has 2 parameters. Either it will not compile or it will never terminate. The third parameter should be i++.
• If the intention of the loop is to swap every list entry with the variable value, then the condition must be i < 5."

At least with the assignments we can moan to the lecturers a bit, but when it gets to the exams we're going to need a ready solution. I'd hate to lose marks in an exam because someone forgot to add a semi-colon.

Incidentally, I wonder if we would get full marks for the question if we had just answered - "There will be no values, since the code will not compile."
Sorry, only registered users may post in this forum.

Click here to login