Questions asked in class about FirstPascal Program

answers are in red

 

How does one pass arrays to a subprogram?

 

How should the output be formatted?

Discussed in class

 

How do you compare strings?

 

What do you mean by “ your program should describe itself to the user?”

Your program should print to the screen what it will do.

 

Can we work with records a bit today?

 

How do we get data from a file?

 

How do we write data to a file?

 

What is the scope of a variable declaration?

Answer in Lecture_9 notes

 

Can you please show us sample input and output statement?

See green sheet.

 

How do we use files?

 

How do we prompt the user?

Use write statements to tell them what to do.

 

How do I know when I am out of data (i.e. when I have read all of the data in the file?)

Program will detect the carriage-return/line-feed characters if you test for them

 

What doe we need to do before we can read from a file?

See sample program snippet in Lecture_9 notes.

 

What goes in the output file?

Disscussed in class

 

In Pascal, as in FORTRAN  does the size of the array have to be specified in advance?  

Yes

 

Where do you indicate the names of the input and output files?

In the program header statement (see code example in Lecture_9 notes.

 

What will the user enter as a file name? 

Always assume that they will give you a full path