Complete the following trace table for the given algorithm when the city "York" and the area code 801 are entered.
You may not need to use all rows in the table.
| Line number | city | code | locID | Output |
|---|---|---|---|---|
| 01 | York | |||
| 02 | 801 | |||
Algorithm:
01 city = input("Enter city")
02 code = input("Enter area code")
03 locID = city + str(code)
04 while locID.length < 9
05 locID = locID + "#"
06 endwhile
07 print("LOC " + locID)
41 exam-style questions on OCR GCSE Computer Science Designing, creating and refining algorithms. Each one has a worked solution and a mark scheme showing where the marks go.