few quick definitions needed (1 Viewer)

boongsta

Member
Joined
Sep 7, 2005
Messages
44
Gender
Male
HSC
2006
hey i just need help with these definitions:

Guarded Loop:
Pre-Test Repetition:
Post-Test Repetition:
Counted Loop:

thanks ahead of time
 
Joined
Nov 4, 2004
Messages
3,550
Location
Sydney
Gender
Male
HSC
2005
they wont ask you to define it, most likely to identify it, anyway

pre-test = while loop in an pseudocode, where the condition must be met before any processes can be run
post test = repeat loop in pseudocode, where the condition must be met after processes have commenced
 

boongsta

Member
Joined
Sep 7, 2005
Messages
44
Gender
Male
HSC
2006
yeah thats wat will happen ... but i gotta know the definitions to understand it ... and i need to understand it to identify it ... thanks heaps mate :)
 

Anna K

New Member
Joined
Feb 3, 2005
Messages
22
Gender
Female
HSC
2005
Wow, this is a really old thread but anyway...

A guarded loop is the same thing as a pre test loop, because the loop won't happen unless the initial condition is met, hence it's guarded.
I'm not so sure about a counted loop, but I'm guessing it's a loop that happens a specific number of times, regardless of conditions - maybe like a for...endfor loop?
 
Joined
Nov 4, 2004
Messages
3,550
Location
Sydney
Gender
Male
HSC
2005
ive never used FOR / ENDFOR functions in a loop, never even heard of them ..
 

sunny

meh.
Joined
Jul 7, 2002
Messages
5,350
Gender
Male
HSC
2002
FOR/ENDFOR loops is just a FOR/NEXT loop - that is what they are called in the HSC syllabus. the HSC spec doesn't specify them outright, but they're mentioned in the syllabus. I would imagine FOR/NEXT is a pre-test loop, since the condition is written first with FOR, not NEXT.
 

greatapoc

New Member
Joined
Sep 4, 2004
Messages
19
Location
Newcastle, Australia
Gender
Male
HSC
2006
The counted loop is always the For..Next loop. It will always be executed at least once, and on each iteration will check if the condition is true.

Java example.

Code:
for (int i = 1; i < 3; i++) {
   System.out.println('Hi.');
}
That will print 'Hi.' 3 times. Syntax for the For loop there is for (declaration and initialisation; condition; incrementation). The only time a for loop will not be executed once is when, for some reason, you might initialise the counter to some number that doesnt satisfy the condition.
 
Last edited:

sunny

meh.
Joined
Jul 7, 2002
Messages
5,350
Gender
Male
HSC
2002
Code:
for (int i = 1; i < 0; i++) {
    System.out.println("Hi.");
}
hehe
 

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

Top