The newest 20 of 42 written questions. Open one to see it on the real paper.
State any change that will need to be made before each value is written to the file.
See it on the paper →The archive program will automatically generate a meaningful filename each time it is run. Outline a meaningful format to use for the filename.
See it on the paper →There is a problem that will need to be overcome before the data items can be written to a text file. As a reminder, the data items are: Data item Data type Comment the unique ID of the student who has borrowed the book StudentID STRING BookID STRING the unique ID of the book being borrowed OnLoan BOOLEAN TRUE if the b...
See it on the paper →Explain what is meant by an exception.
See it on the paper →A text file Sales.txt stores strings representing the number of items sold. The file contains 52 lines, each representing the number of items sold in each week of the year. File data "350" "502" "434" 49 50 51 52 "492" "872" "772" "201" The example shows that 502 items were sold in week 2. The owner requires a module t...
See it on the paper →A second module is defined: Module CheckAll() Description • called with a parameter of type integer representing the number of candidate marks in the Result array • uses CheckMark() to check each candidate mark • for each paper that needs to be checked, write the corresponding candidate ID on a separate line in a new f...
See it on the paper →The requirement changes. Instead of a new file, the module described in part (b) needs to add the corresponding candidate ID for each paper that needs to be checked to an existing file. Explain the change that will need to be made to CheckAll().
See it on the paper →A new module will store the contents of the Character array in a text file. The module is defined as follows: Module Save() Description • • form a string from each record with fields separated by the character '^' write each string to a separate line of the new file named SaveFile.txt Complete the pseudocode for module...
See it on the paper →The Character array data has been saved in the text file SaveFile.txt Each line of the file contains one element of the array (one record). New modules are defined: Module Extract() (already written) Description • • Restore() • • called with two parameters: ○ a string representing a complete line from the text file ○ a...
See it on the paper →The game can last for several days and users often find that they have to close and rerun the game program many times in order to complete it. Describe the benefit of using the file SaveFile.txt as described in part (b).
See it on the paper →Jane is a client who would like to choose the activity surfing and she has already done sailing. Write additional clauses to represent this information.
See it on the paper →Using the variable List, the goal: choice(List, rowing) returns List = petra, eliza Write the result returned by the goal: choice(List, sailing) List =
See it on the paper →C is a client who would like to choose A if A is an activity and C has not already done A. Write this as a rule: may_choose_activity(C, A) IF
See it on the paper →A procedure CreateFiles() will take two parameters: • • a string representing a file name an integer representing the number of files to be created. The procedure will create the number of text files specified. Each file is given a different name. Each file name is formed by concatenating the file name with a suffix ba...
See it on the paper →State the file mode that should be used in CheckFiles().
See it on the paper →Describe, with an example, what is meant by an exception.
See it on the paper →Define the term exception handling.
See it on the paper →State two possible causes of an exception.
See it on the paper →The design of the queue is completed and the number of locations is increased. A function AddToQueue() has been written. It takes a string as a parameter and adds this to the queue. The function will return TRUE if the string was added successfully. A procedure FileToQueue() will add each line from the file to the queu...
See it on the paper →A new module is defined as follows: Module AddItem() Description • called with a parameter of type string representing valid information for a new item that is not currently in the Stock.txt file • creates a new file NewStock.txt from the contents of the file Stock.txt and adds the new item information at the appropria...
See it on the paper →As is usual with this type of question, a wide range of marks was given. It was pleasing to see a range of different solutions gaining full marks for this question. MP1: Many solutions gained this mark. In some cases, the solution consisted of little more than the module ‘wrapper’ suggesting that this is a recognised tactic. MP2: Most solutions included some form of attempted loop. The simple F...
— Examiner report, October/November 2023, 9618/22 Q6(a) (Cambridge)
As for 6 (b)(i) most candidates gained the one mark for this question but over a third did not gain this mark. A few candidates incorrectly gave WRITE or APPEND as the file mode.
— Examiner report, October/November 2023, 9618/22 Q6(b)(iii) (Cambridge)
Candidates were asked to describe an exception. They were expected to describe it as an event that occurs during the execution of a program that can cause the program to unexpectedly halt. Then they had to give an example of an exception, such as a run time error. Many candidates achieved one or both marks. However, some candidates incorrectly described exception handling, which is a remedy for ex...
— Examiner report, October/November 2023, 9618/32 Q12(a) (Cambridge)
Past papers, syllabus and examiner reports © UCLES (Cambridge University Press & Assessment). Questions are matched to topics from the official syllabus. AssessPro is independent and not endorsed by Cambridge.