ATAR Notes: Forum

VCE Stuff => VCE Technology => VCE Mathematics/Science/Technology => VCE Subjects + Help => VCE Computing: Software Development => Topic started by: excal on October 14, 2008, 10:52:03 am

Title: Try these questions, budding IT:SD candidates :)
Post by: excal on October 14, 2008, 10:52:03 am
These are taken from a university-level programming subject, just to give you a taste of how capable you guys will probably have become after your year of IT:SD.

1a. Rewrite in psuedocode the following IF statement to use nested IFs

IF (age < 18 AND duration = 2 AND fareZone ="Zone 1") THEN
      cost = 3.75
END IF

b. Explain in plain english what this psuedocode is attempting to do.

2. How many times will the following algorithm execute?

num1 = 10
num2 = 2
DO WHILE (num1 < num2)
     num1 = num1 / 2
     num2 = num2 * num2
END DO

Title: Re: Try these questions, budding IT:SD candidates :)
Post by: Ahmad on October 14, 2008, 12:13:05 pm
I will pay 20 dollars to whoever determines, with proof, the positive integer values of n for which the code below terminates.

Code: [Select]
n = positive integer

while (n is not equal to 1)
    if (n % 2 == 1)
        n = 3*n + 1
    else
        n = n/2
    end if
end while
Title: Re: Try these questions, budding IT:SD candidates :)
Post by: cara.mel on October 14, 2008, 12:19:42 pm
1?
Title: Re: Try these questions, budding IT:SD candidates :)
Post by: Ahmad on October 14, 2008, 12:39:41 pm
Is that the only value? (:
Title: Re: Try these questions, budding IT:SD candidates :)
Post by: cara.mel on October 14, 2008, 12:57:50 pm
Probably not, given the fact that you've questioned me :P

2^a, where a is another positive integer
5 works as well
and 3
in fact all of them <=10 work =/
Title: Re: Try these questions, budding IT:SD candidates :)
Post by: flame on October 20, 2008, 10:11:02 pm
Ooo IT! :P

2. How many times will the following algorithm execute?

num1 = 10
num2 = 2
DO WHILE (num1 < num2)
     num1 = num1 / 2
     num2 = num2 * num2
END DO

Hmm..trick question? It shouldn't execute at all, because 10 is not lower than 2. If I'm completely wrong, let me know :D

Hopefully exam won't be too bad...but if practice exam we did was any indication, not good! Haha well did no study for that and got like 60%, so obviously a lot of cramming to come.

I vote we have some revision sessions on this forum :)