Data types and structures
32 questions. Open a question to solve it and check the official answer.
Data types and records · 6 marks · official answer ready
(a) Write program code to implement this amended procedure ScanArray(). Visual Basic and Pascal: You should include the declaration statements for variables. Python: You should sh…
Data types and records · 16 marks · official answer ready
(c) The module description of Unpack() is repeated here for reference. Module Description • called with two parameters: o an array index Unpack() o a string value read from one li…
Data types and records · 6 marks · official answer ready
(ii) The function, Verify(), is to be amended as follows: • if the UserID is "Guest", a password is not required and TRUE should be returned • output a message to try again if the…
Arrays · 11 marks · official answer ready
(a) Write program code for the module StockSummary(). Visual Basic and Pascal: You should include the declaration statements for variables. Python: You should show a comment state…
Data types and records · 14 marks · official answer ready
(c) The module description of GetValidFilename() is as follows: Module Description • prompts and inputs a filename • validates the filename by checking that it: • is between 4 and…
Data types and records · 17 marks · official answer ready
(c) Two additional modules are required: Module Description • called with a STRING representing a product group (for example, "ABLK") Lookup() • searches the Summary array for the…
Data types and records · 4 marks · official answer ready
(i) Programming languages support different data types. Complete the table by giving a suitable data type for each example value. Example value Data type "NOT TRUE" − 4.5 NOT FALS…
Data types and records · 2 marks · official answer ready
(ii) Write program code for a statement that calls the modified ClearArray() procedure to clear the array Duplicates to "Empty". Programming language .............................…
Data types and records · 3 marks · official answer ready
(c) CountTimes() is to be used to count how many unused elements there are in the Leavers array. An unused element is one that contains an empty string. The module description is …
Data types and records · 8 marks · official answer ready
(b) The module, FindCD(), will check whether a given CD exists in the collection. The module will be implemented as a function. The function will: • be called with two strings as …
Data types and records · 3 marks · official answer ready
(c) ProcessArray() is modified to make it general purpose. It will now be called with two parameters as follows: • an array • a string representing the name of a class contact fil…
Data types and records · 3 marks · official answer ready
(i) CharArray is a 1D array of type CHAR. It contains 200 elements. Write program code to change all the numeric characters ('0' to '9') in CharArray to '*'. Programming language …
Data types and records · 9 marks · official answer ready
1 (a) A program stores data about hospital patients. Give a suitable identifier name for each of the data items. Description of data item Suitable identifier name The temperature …
Data types and records · 7 marks · official answer ready
7 A function, ProcessMarks(), is required to analyse test marks for a class of students. • There are 20 students in the class. • A mark is between 0 and 100. • The marks for the c…
Data types and records · 6 marks · official answer ready
7 A function, IsFactor() takes two integer parameters and checks whether the second parameter is a factor of the first parameter. For example IsFactor(6,3) would return TRUE as si…
Data types and records · 4 marks · official answer ready
(i) Write pseudocode to define the data type StudentAssessment. ...................................................................................................................…
Data types and records · 3 marks · official answer ready
(ii) Data about all students and their assessments are stored in a file that uses random organisation. The StudentID is used as the key field. The program allows a user to enter d…
Arrays · 18 marks
(ii) State two things that built-in and user-defined functions have in common. 1 ..................................................................................................…
Data types and records · 7 marks
(v) Answer2 ................................... [1] 19 Appendix Built-in functions (pseudocode) ONECHAR(ThisString : STRING, Position : INTEGER) RETURNS CHAR returns the single ch…
Data types and records · 4 marks · official answer ready
(iii) Program code is to be designed and written for step 02.3 The program will use these identifiers: Identifier Data type Description PlayerName ARRAY[1 : 8] OF STRING Stores th…
