• Congratulations to the Class of 2024 on your results!
    Let us know how you went here
    Got a question about your uni preferences? Ask us here

Hsc qu (1 Viewer)

velox

Retired
Joined
Mar 19, 2004
Messages
5,521
Location
Where the citi never sleeps.
Gender
Male
HSC
N/A
I dont really understand how they got the answer in this qu?

<a href="http://img212.imageshack.us/my.php?image=sddqu5zw.jpg" target="_blank"><img src="http://img212.imageshack.us/img212/7522/sddqu5zw.th.jpg" border="0" alt="Free Image Hosting at www.ImageShack.us" /></a>
 

sunny

meh.
Joined
Jul 7, 2002
Messages
5,350
Gender
Male
HSC
2002
The original algorithm fills the array by doing columns one at a time. Thus, the algorithm would have looked like:

Code:
for each column x
  for each row y
    insert random number into [x,y]
Since it is doing down a column, it needs to change the row counter each time so that it will complete one column before going on to the next. (get it straight in your mind that changing the row counter will cause the algorithm to go down a column)

So if you wanted to do the opposite (ie, fill each row one by one), you would want to move across each column to fill in one row
Code:
for each row x
  for each column y
    insert random number into [y,x]
This will mean the column counter changes first - resulting in a row being filled first (again, get it straight in your mind that changing the column counter causes the program to go across a row)
 

velox

Retired
Joined
Mar 19, 2004
Messages
5,521
Location
Where the citi never sleeps.
Gender
Male
HSC
N/A
I sort of understand what you are saying.

Am i correct to think that the whatever is in the outer loop will get filled first (just by common sense), so then you would have the rows in the outer loop as you want them to get filled first?
 

sunny

meh.
Joined
Jul 7, 2002
Messages
5,350
Gender
Male
HSC
2002
Yes thats a simplified way of looking at it.
 

velox

Retired
Joined
Mar 19, 2004
Messages
5,521
Location
Where the citi never sleeps.
Gender
Male
HSC
N/A
Sunny, just one more question. With the structure diagram below, if we were asked to describe the processing, would we read it left to right?

<a href="http://img216.imageshack.us/my.php?image=sddqu5kv.jpg" target="_blank"><img src="http://img216.imageshack.us/img216/9384/sddqu5kv.th.jpg" border="0" alt="Free Image Hosting at www.ImageShack.us" /></a>
 
Joined
Nov 4, 2004
Messages
3,550
Location
Sydney
Gender
Male
HSC
2005
Up to down, the answer for it is C

You'll notice that the Enter customer name and address and store customer are the only ones with option (square bracket)

Control paremeter isn't passed to store customer data

glhf ;D
 

SamD

Member
Joined
Jul 21, 2002
Messages
256
Gender
Male
HSC
N/A
Actually the answer is D

A is wrong as no data parameter is passed to "Enter Customer Name and Address"

B is wrong as control parameters are not passed to any module (they are returned from 2 modules).

C is wrong as it's around the wrong way. Actually "Store Customer Data" repeatedly calls "Store Customer Name".

D is CORRECT as the little diamond on the two call lines from "Controlling Process" means that either "Enter Customer Name and Address" OR "Store Customer Data" is called.

Structure diagrams (or charts) are not generally read from bottom to top, rather they are read according to the order of processing.

Here's a few questions to try (with regard to the above structure diagram)....

1. Write a pseudocode outline for "Controlling Process".
2. Write a pseudocode outline for "Store Customer Data".
3. Describe the order of processing.

HTH
Sam
 
Last edited:

Ghost1788

Member
Joined
Jan 30, 2005
Messages
276
Location
Sydney
Gender
Male
HSC
2005
Thanks Sam i didnt know about the diamond thingy and i didnt notice the way C was written...
 

SamD

Member
Joined
Jul 21, 2002
Messages
256
Gender
Male
HSC
N/A
Start your "drawing board" by having a a go at my three questions. I promise to give you positive feedback!

Sam
 

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

Top