Computer Science For First Examination In 2021 9618 · 10

Data types and structures

223 questions. Open a question to solve it and check the official answer.

2023 May-June · Paper 32 · Q2(b)

Data types and records · 2 marks · official answer ready

(b) A hashing algorithm is used to calculate storage locations for records in a random access file. The algorithm calculates hash values using the function modulus 5. The function…

2023 May-June · Paper 32 · Q6(b)

Data types and records · 5 marks · official answer ready

6 (b) This pseudocode algorithm reads dental records stored in a random file using the user‑defined data type TAppointments and prints the contents of the file, one record at a ti…

2023 May-June · Paper 32 · Q11(a)(i)

Data types and records · 2 marks · official answer ready

(i) Study the pseudocode and insert the identifiers to complete this table. Identifier Data type Description STRING An array to store the contents of the queue. INTEGER Points to …

2023 May-June · Paper 32 · Q11(a)(ii)

Introduction to abstract data types · 5 marks · official answer ready

(ii) Complete the given pseudocode. [5] 14

2023 May-June · Paper 32 · Q11(b)

Introduction to abstract data types · 3 marks · official answer ready

(b) Explain the reasons why a queue ADT works better than a stack ADT in organising print jobs. ...................................................................................…

2023 May-June · Paper 33 · Q3(a)

Data types and records · 2 marks · official answer ready

3 (a) A hashing algorithm is used to calculate storage locations for records in a random access file. It calculates hash values by using the function modulus 3. The function modul…

2023 May-June · Paper 33 · Q11(a)

Introduction to abstract data types · 3 marks · official answer ready

(a) Write the pseudocode to declare MaxSize, FrontPointer, RearPointer, Length and Queue. .........................................................................................…

2023 May-June · Paper 33 · Q11(c)

Introduction to abstract data types · 4 marks · official answer ready

(c) Explain how a new element can be added to the queue if it is implemented using two stacks. ....................................................................................…

2023 May-June · Paper 41 · Q3(a)

Arrays · 3 marks · official answer ready

(a) The program contains the following global arrays and variables: • 1D array Animal to store the names of up to 20 animals. • 1D array Colour to store the names of up to 10 colo…

2023 May-June · Paper 42 · Q2(a)

Data types and records · 2 marks · official answer ready

(a) Write program code to declare a record structure, SaleData, to store the data about each sale. Save your program as Question2_J2023. Copy and paste the program code into part …

2023 May-June · Paper 42 · Q2(b)

Data types and records · 4 marks · official answer ready

(b) Write program code to: • declare a global array, CircularQueue, of 5 items to store the sale records • declare the global pointers Head and Tail • declare the global variable …

2023 May-June · Paper 42 · Q3(a)(i)

Data types and records · 5 marks · official answer ready

(i) Write program code to declare the class Employee. You only need to declare the class and its constructor. Do not declare any other methods. Use your programming language appro…

2023 May-June · Paper 42 · Q3(a)(iii)

Data types and records · 3 marks · official answer ready

(iii) The method SetPay(): • takes a week number and the number of hours worked that week as parameters • calculates the pay for that week by multiplying the hourly pay by the num…

2023 May-June · Paper 42 · Q3(a)(iv)

Data types and records · 2 marks · official answer ready

(iv) The method GetTotalPay() returns the total of all the values in PayYear2022. Write program code for the method GetTotalPay(). Save your program. Copy and paste the program co…

2023 May-June · Paper 42 · Q3(b)(ii)

Data types and records · 3 marks · official answer ready

(ii) The Manager method SetPay() overrides the method from the parent class and: • takes the week number and number of hours worked as parameters • increases the number of hours w…

2023 May-June · Paper 42 · Q3(d)

Data types and records · 4 marks · official answer ready

(d) The file HoursWeek1.txt stores the number of hours each employee has worked in week 1, in the order: • employee number • number of hours worked. For example, the first set of …

2023 May-June · Paper 42 · Q3(e)(i)

Data types and records · 2 marks · official answer ready

(i) The main program needs to call EnterHours() and use the method GetTotalPay() to output the employee number and total pay for each of the eight employees. Amend the main progra…

2023 May-June · Paper 43 · Q3(a)

Arrays · 3 marks · official answer ready

(a) The program contains the following global arrays and variables: • 1D array Animal to store the names of up to 20 animals. • 1D array Colour to store the names of up to 10 colo…

2022 October-November · Paper 12 · Q1(a)

Files · 5 marks · official answer ready

1 (a) Draw one line from each utility software to its most appropriate purpose. Utility software Purpose to reorganise files so they are contiguous virus checker to scan for malic…

2022 October-November · Paper 22 · Q1(a)(ii)

Data types and records · 2 marks · official answer ready

(ii) A procedure header is shown in pseudocode: PROCEDURE MyProc(Count : INTEGER, Message : STRING) Give the correct term for the identifiers Count and Message and explain their u…