Prelim course question (1 Viewer)

Joined
Feb 3, 2006
Messages
75
Gender
Male
HSC
2007
I was hoping someone could help me out with this:

1. Using a FOR ... DO loop, design an algorithm that displays Hello! five times and then displays goodbye!

Ive got this:

Code:
BEGIN<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
            FOR loop_index = 1 to 5 DO<o:p></o:p>
                        Display Hello! ;<o:p></o:p>
            ENDFOR<o:p></o:p>
            Display Goodbye! <o:p></o:p>
END<o:p></o:p>
Extension: Incorporate a nested FOR ... DO loop so that only *# is repeated

How would i do the extension?

Cheers, KK
 
Last edited by a moderator:

AntiHyper

Revered Member
Joined
Sep 16, 2004
Messages
1,103
Location
Tichondrius
Gender
Male
HSC
2005
aah wtf put some spaces so it wont show as smileys!

BEGIN
FOR i = 1 TO 5 DO
DISPLAY "Hello"
ENDFOR
DISPLAY "Goodbye"
END
 

sunny

meh.
Joined
Jul 7, 2002
Messages
5,350
Gender
Male
HSC
2002
Ask the user for input, then display FOR i = 1 TO x....if that is what you mean.
 

Mountain.Dew

Magician, and Lawyer.
Joined
Nov 6, 2005
Messages
825
Location
Sydney, Australia
Gender
Male
HSC
2005
this is how i learnt it, even though FOR loops for algorithms are not BOS apporoved.

BEGIN
FOR i = 1 TO 5
Display "Hello!" ;display is not a BOS approved algorithm key word
NEXT i
Display "Goodbye"
END
 

aaaman

Banned
Joined
Jan 5, 2005
Messages
851
Location
The Shire
Gender
Male
HSC
2005
Mountain.Dew said:
this is how i learnt it, even though FOR loops for algorithms are not BOS apporoved.

BEGIN
FOR i = 1 TO 5
Display "Hello!" ;display is not a BOS approved algorithm key word
NEXT i
Display "Goodbye"
END

hes 1/2 right hsc markers care about what is going on the program however hsc makers prefer things simple

like...

input
output
print
store/save
load

stuff like that...for your algoithm it should be print instead of display
 

Mountain.Dew

Magician, and Lawyer.
Joined
Nov 6, 2005
Messages
825
Location
Sydney, Australia
Gender
Male
HSC
2005
aaaman said:
hes 1/2 right hsc markers care about what is going on the program however hsc makers prefer things simple

like...

input
output
print
store/save
load

stuff like that...for your algoithm it should be print instead of display
where did i get the 1/2 wrong then?
 

pritnep

Boredof?
Joined
May 30, 2005
Messages
3,949
Location
Newcastle
Gender
Male
HSC
2006
for using display instead of print, a question like that would only be worth 1-2 marks anyway one would think.
 

*sparklez...

Member
Joined
Mar 5, 2006
Messages
45
Gender
Female
HSC
2006
Kid.@dmin said:
for using display instead of print, a question like that would only be worth 1-2 marks anyway one would think.
but doesn't that depend on whether you're writing the pseudocode or the source code?? coz i would think that "display" is acceptable in pseudocode but wouldn't be recognised in the programming language...which in that case, print shoud be used (if you're displaying on the module)

meh what would i care?? i've never heard of a FOR-DO loop lmao
 

Mountain.Dew

Magician, and Lawyer.
Joined
Nov 6, 2005
Messages
825
Location
Sydney, Australia
Gender
Male
HSC
2005
*sparklez... said:
but doesn't that depend on whether you're writing the pseudocode or the source code?? coz i would think that "display" is acceptable in pseudocode but wouldn't be recognised in the programming language...which in that case, print shoud be used (if you're displaying on the module)

meh what would i care?? i've never heard of a FOR-DO loop lmao
the FOR - DO is part of the code of Visual Basic.

and we are writing PESUDOCODE. in the HSC, they will never test you on a specific programming language. therefore, i suggest that we do stick with the pseudocode guidelines.

and this display vs. print thing...HSC markers prefer to use 'display' because 'print' can be confusing. its an actual command for many programming languages, and it can also imply a non-electronic output --> ie printing out "hello!" on a sheet of paper. also, please dont capitalise display --> its not a perscribed pseudocode key term.
 

*sparklez...

Member
Joined
Mar 5, 2006
Messages
45
Gender
Female
HSC
2006
Mountain.Dew said:
the FOR - DO is part of the code of Visual Basic.

and we are writing PESUDOCODE. in the HSC, they will never test you on a specific programming language. therefore, i suggest that we do stick with the pseudocode guidelines.

and this display vs. print thing...HSC markers prefer to use 'display' because 'print' can be confusing. its an actual command for many programming languages, and it can also imply a non-electronic output --> ie printing out "hello!" on a sheet of paper. also, please dont capitalise display --> its not a perscribed pseudocode key term.
*raises eyebrows* ummz...if you re-read what i wrote...you'll see that you had just explained what i had wrote in a more complex yet understanding way and i am aware that display is not a prescribed pseudocode key term just like the word increment
 

live.fast

Member
Joined
Feb 12, 2006
Messages
501
Gender
Undisclosed
HSC
N/A
woah...you can't use display? or you can't use print?
aaannd

what other words or things aren't BOS approved, for algorithms?
 

pritnep

Boredof?
Joined
May 30, 2005
Messages
3,949
Location
Newcastle
Gender
Male
HSC
2006
WOW! You just revived such an old thread.

If you read through it Mountain.Dew correctly answered it being that in the HSC you are only EVER asked to write something in pesudocode not in a specific programming language thus 'display' would be the correct term to use.

So basically when answering a question in the HSC you use correct pesudocode terms for your algorithms.
 

live.fast

Member
Joined
Feb 12, 2006
Messages
501
Gender
Undisclosed
HSC
N/A
Our teacher is teaching us to use 'Print' OR 'display' for the pseudocode, not just display. And in some books, it has 'print'. So that's why I'm asking now, what other stuff is not allowed in the pseudocode, for the HSC? Is there like a list where I can get what is and is not allowed for algorithms, with regards to stuff like that?
 

dddman

Banned
Joined
Jun 13, 2006
Messages
120
Gender
Male
HSC
2005
live.fast said:
Our teacher is teaching us to use 'Print' OR 'display' for the pseudocode, not just display. And in some books, it has 'print'. So that's why I'm asking now, what other stuff is not allowed in the pseudocode, for the HSC? Is there like a list where I can get what is and is not allowed for algorithms, with regards to stuff like that?
what teacher/author writes in their pseudocode is a reflection of ones personality, like you teacher likes to use print/display, a book would only say print. the point of pseudocode is that you can code something to make it work in the correct manner.

words are acceptable are

input
output
print
store/save
load
print
display

...theres other that i cant think off atm however words arnt acceptable are


transfer
copy
paste
repeat(not the reserve word used for repeat..untill loops)

and many others...

is there a word that your wondering if it is acceptable or not
 

Mountain.Dew

Magician, and Lawyer.
Joined
Nov 6, 2005
Messages
825
Location
Sydney, Australia
Gender
Male
HSC
2005
Fair enough. As long as the pseudocode is clear to the marker. Just make sure these words are NOT capitalised. only BOS approved algorithm key terms, like REPEAT UNTIL IF ENDIF WHILE ENDWHILE etc etc...are to be capitalised.
 

dddman

Banned
Joined
Jun 13, 2006
Messages
120
Gender
Male
HSC
2005
Mountain.Dew said:
Fair enough. As long as the pseudocode is clear to the marker. Just make sure these words are NOT capitalised. only BOS approved algorithm key terms, like REPEAT UNTIL IF ENDIF WHILE ENDWHILE etc etc...are to be capitalised.
i used caps for print and load, its just simply on ones character
 

*sparklez...

Member
Joined
Mar 5, 2006
Messages
45
Gender
Female
HSC
2006
dddman said:
i used caps for print and load, its just simply on ones character
ok wait!! so is what mountain dew said correct coz if so...i'll have to remember that
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top