## Help explaining basic programming concepts

### Help explaining basic programming concepts

I wonder if anyone could give me a bit of help. I've promised to help
my neighbour's kid with her study, and as she's not from an
English-speaking background I'm coaching her with her English. She's
strudying for a software final and it's not my strong suit.

I have a couple of questions in relation to an old paper she's looking
at.

The following algorithms are offered in one question

1 BEGIN Check Stock
2 Get PartID
3 WHILE PartID ≠ 0
4 IF PartExists (PartID,PartName)
5 THEN CalculateStock (PartID,Stock)
6 Display PartName, Stock
7 ELSE
8 Display"Invalid Part Number"
9 ENDIF
10 Get PartID
11 ENDWHILE
12 END CheckStock

13 BEGIN PartExists (PartNum,PartName)
14 Found=False
15 Open Parts File
16 Read 1st record into TempRec
17 WHILE record NOT sentinel AND Found=False
18 IF TempRec.PartID = PartNUM, THEN
19 Found=TRUE
20 PartName= TempRec.ShortName
21 ELSE
22 Read Next record into Temp.Rec
23 ENDIF
24 ENDWHILE
25 Close Parts File
26 PartExists =Found
27 END PartExists

28 BEGIN CalculateStock (PartNum,Stock)
29 SumPurchases (PartNum, ItemsPurchased)
30 SumSold (PartNum, ItemsSold)
31 Stock=ItemsPurchased- Items Sold
32 END CalculateStock

Using examples from the above algorithms, explain how parameters are
used to pass data.

The text of the suggested answer is as follows:

Parameters provide an interface allowing data to be shared between two
routines. The CheckStock routine includes a call to the PartExists
routine. This call uses two parameters, namel PartID and PartName. As
PartID corresponds to PartNum within the PartExists routine, then the
content of PartID is said to be passed to PartNum.

There are two types of parameter passing. The first technique passes
the memory address of the data. For example, if PartID is held in
memory address 101, then 101 is passed to PartNum. The data exists
just once. A second technique passes a copy of the actual data, so the
content of PartID is stored in a different location that is then used
by PartNum. Using both techniques parameters are passed both to and
from called routines.

I'm wondering what this all means and how to assess whether an answer
roughly says this. Could you put this into clearer language?

A structure diagram was also requested, based on the original
algorithms.

How should I explain the various components, such as control
parameters?

FRAN