Wednesday, November 10, 2010

Wednesday, 10 November, 2010

SHOOT!!!

Today, we had our first programming test and I DID NOT do well...

For Question 7, I used if and elsif instead of accumulators (which I figured to use after the test was over...) so for Question 7, my code is a full page long (sorry). So much for keeping it simple. A big mistake I made was putting greater than or equal to. I realized my mistake, but did not have enough time to finish it, as Mr Arkin said that we had to stop and hand the papers in...It does however execute properly, so it shouldn't be that big of a deal, but I'm definitely sure that I lost 2-3 marks there.

To fix Question 7 and make it more simple, I created this program which executes the same as Question 7, only it's much simpler and 0 is not counted as positive...

% declaration section
var integer1 : int
var integer2 : int
var integer3 : int
var sum : int
% initialization section
sum := 0
% input section
put "Three integers: " ..
get integer1, integer2, integer3
% processing section
if integer1 > 0 then
    sum := sum + integer1
end if
if integer2 > 0 then
    sum := sum + integer2
end if
if integer3 > 0 then
    sum := sum + integer3
end if
% output section
put "Sum: ", sum

For Question 3, I wasn't sure if both my answers were different (they were related in that the datatypes were incorrect, one in the code and one by the user of the program) so I might lose some marks there. That Question was out of 3, so I probably received 2 marks for my poor effort (ran out of time).

For Question 4, the standard "get" usage was get following a prompt and that sometimes, the ": *" option is used to accept all tokens. For the optional usage, the user is prompted to submit several data at the same time, each delimited by blank spaces. I'm pretty sure that the ": *" option is the optional usage of get, so I might have gotten that Question wrong and lose another mark...

I think the test was out of 20, so my prediction is that I scored a 15-16 ish on the test, which isn't going to help my subpar mark...

No comments:

Post a Comment