User-defined Data Types (Cambridge (CIE) A Level Computer Science): Exam Questions

Exam code: 9618

52 mins12 questions
1a
3 marks

Describe the user-defined data type set.

1b
4 marks

Write pseudocode statements to declare the set data type, SymbolSet, to hold the following set of mathematical operators, using the variable Operators.

+ – * / ^

2a
3 marks

Describe the user‑defined data type record.

2b
4 marks

A programmer defines a record, Order, to store the following data:

  • account number

  • order number

  • order price

  • order date.

Write pseudocode statements to define this record.

3
3 marks

Explain what is meant by non-composite and composite data types.

4a
3 marks

Explain what is meant by the term non-composite data type and give an example of a non-composite data type.

4b
4 marks

Write pseudocode statements to declare the set data type EvenNumbers to hold this set of even numbers between 2 and 12:

2, 4, 6, 8, 10,12

5
4 marks

Describe what is meant by enumerated and pointer data types.

6
4 marks

Describe what is meant by composite and non‑composite data types.

7
2 marks

A weather station program records the condition of the sky at each reading.

The sky condition is always exactly one of these five values:

Clear, Cloudy, Rain, Snow, Fog

Write the pseudocode statement to define the enumerated data type SkyState to hold these values.

8
3 marks

A program monitors the temperature inside a cold store. Each temperature is stored as a REAL value.

The program needs a user-defined non-composite data type that will hold the memory location of a temperature value, and a variable of that type.

Give the pseudocode statements to:

  • define the pointer data type TTempPointer

  • declare a variable TempStore of that type.

9
4 marks

A library program uses this user-defined data type:

TYPE MemberLevel = (Basic, Silver, Gold, Platinum)

The variable ThisMember, of type MemberLevel, has already been declared.

Write pseudocode to:

  • store the value Silver in ThisMember

  • output the message Discount applies when ThisMember holds Gold or Platinum

  • output the message No discount in every other case.

10
3 marks

A programmer is choosing a composite user-defined data type for each of three requirements.

Complete the table by writing the most appropriate composite user-defined data type for each requirement.

Requirement

Composite data type

A collection of the valid currency symbols used by a program. Every symbol is a CHAR and the order of the symbols does not matter.

A group of related items about one employee: family name, salary and start date.

A template that groups data together with the procedures and functions that operate on that data.

11
3 marks

A sports club program already contains this user-defined data type:

TYPE Membership = (Junior, Adult, Senior)

Write pseudocode statements to define the composite data type ClubMember to hold data about one member, including:

  • the family name of the member

  • the date the member joined the club

  • the membership category of the member.

Use the data type Membership in your answer.

12
5 marks

A sports club program contains these user-defined data types:

TYPE Membership = (Junior, Adult, Senior)

TYPE ClubMember
   DECLARE FamilyName : STRING
   DECLARE DateJoined : DATE
   DECLARE Category : Membership
ENDTYPE

The program declares an array that has already been filled with the 200 members of the club:

DECLARE Members : ARRAY[1:200] OF ClubMember

Write pseudocode to count how many members are in the Senior category, and to output that count after every member has been checked.