18. Why are freely chosen identifiers important in programming?
PROBLEMS ON CHAPTER 2
1. Carry out a dry run to show the values of all variables as each line of the following program is
executed:
10 LET hours = 40
20 LET rate = 31
30 LET wage = hours * rate
40 PRINT hours, rate, wage
2. Write and test a program, similar to that of problem 1, which compute s the area of a carpet is 3
metres in width and 4 metres in length. Use the variable names: width, length, area.
3. Re-write the program of problem 1 so that it uses two INPUT statements instead of LET
statements.
4. Re write the program of problem 1 so that the input data (40 and 3) appears in a DATA statement
instead of a LET statement.
5. Re write the program of problem 2 using a different method of data input. Use READ and DATA if
you originally used LET and vice-versa.
6. Bill and Ben agree to have a gamble. Each will take out of his wallet all the pound notes and give
them to the other. Write a program to simulate this entirely with LET and PRINT statements. Use
a third person, Sue, to hold Bill's money while he accepts Ben's.
7. Re-write the program of problem 6 so that a DATA statement holds the two numbers to be
exchanged.