[go: up one dir, main page]

0% found this document useful (0 votes)
16 views91 pages

A2 Chapter 13 Data Representation

The document contains a series of questions and exercises related to floating-point representation, data types, and pseudocode in computer systems. It covers topics such as calculating normalized floating-point representations, defining user-defined data types, and explaining the implications of data storage methods. The exercises require both theoretical explanations and practical pseudocode implementations.

Uploaded by

willissaoirse2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views91 pages

A2 Chapter 13 Data Representation

The document contains a series of questions and exercises related to floating-point representation, data types, and pseudocode in computer systems. It covers topics such as calculating normalized floating-point representations, defining user-defined data types, and explaining the implications of data storage methods. The exercises require both theoretical explanations and practical pseudocode implementations.

Uploaded by

willissaoirse2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 91

2

1 Real numbers are stored in a computer system using floating-point representation with:

• 10 bits for the mantissa


• 6 bits for the exponent
• Two’s complement form for both the mantissa and the exponent.

(a) Calculate the normalised floating-point representation of –7.25 in this system.


Show your working.

Mantissa Exponent

Working .....................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................
[3]

(b) Calculate the denary value of the given binary floating-point number.
Show your working.

Mantissa Exponent

1 0 1 1 0 0 0 1 1 1 0 0 0 1 1 1

Working .....................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

Answer ......................................................................................................................................
[3]

© UCLES 2021 9618/31/M/J/21


3

(c) The given binary floating-point number is not normalised.

Normalise the floating-point number. Show your working.

Mantissa Exponent

0 0 0 0 0 0 0 1 1 1 1 0 0 1 1 1

Mantissa Exponent

Working .....................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................
[3]

(d) The denary number 513 cannot be stored accurately as a normalised floating-point number in
this computer system.

(i) Explain the reason for this.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

..................................................................................................................................... [3]

(ii) Describe an alteration to the way floating-point numbers are stored to enable this number
to be stored accurately using the same total number of bits.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

..................................................................................................................................... [2]

© UCLES 2021 9618/31/M/J/21 [Turn over


4

2 (a) Describe the purpose of a user-defined data type.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

(b) Define, using pseudocode, the following enumerated data types:

(i) SchoolDay to hold data about the days students are usually in school.

...........................................................................................................................................

..................................................................................................................................... [1]

(ii) WeekEnd to hold data about the days that are not school days.

...........................................................................................................................................

..................................................................................................................................... [1]

(c) Define, using pseudocode, the composite data type ClubMeet. This will hold data about club
members that includes:

• first name and last name


• the two days they attend:
ż one on a school day
ż one not on a school day.

Use the enumerated types you created in part (b).

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [4]

© UCLES 2021 9618/31/M/J/21


2

1 Data types can be defined using pseudocode.

The data type, LibraryRecord, is defined in pseudocode as:


TYPE LibraryRecord
DECLARE Title : STRING
DECLARE Fiction : BOOLEAN
DECLARE Author : STRING
DECLARE NumberOfCopies : INTEGER
ENDTYPE

A variable, LibraryBook, is declared in pseudocode as:


DECLARE LibraryBook : LibraryRecord

(a) Write pseudocode statements to assign:


• A Level Computer Science to Title of LibraryBook
• FALSE to Fiction of LibraryBook.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

(b) The type definition for LibraryRecord is changed.

(i) The value for NumberOfCopies must be between 1 and 10 inclusive.

Write the updated line of pseudocode from the type definition of LibraryRecord to
implement the change.

...........................................................................................................................................

..................................................................................................................................... [1]

(ii) Every copy of every book is now uniquely identified by an accession number,
AccessionNumber, as it is added to the library. Each library record will include one or
more accession numbers. Each accession number is an integer.

Write the extra line of pseudocode needed in the type definition of LibraryRecord.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

..................................................................................................................................... [2]

© UCLES 2022 9618/31/M/J/22


3

(c) A record is a user-defined composite data type.

Explain what is meant by a user-defined composite data type.


Include an example of another user-defined composite data type in your answer.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................
[3]

© UCLES 2022 9618/31/M/J/22 [Turn over


2

1 Data types can be defined using pseudocode.

The data type, BuildingRecord, is defined in pseudocode as:

TYPE BuildingRecord
DECLARE BuildingID : INTEGER
DECLARE BuildingGroup : STRING
DECLARE OwnerName : STRING
DECLARE BuildingAddress : STRING
DECLARE DateLastSold : DATE
DECLARE PriceLastSold : REAL
ENDTYPE

A variable, BuildingRegister, is declared in pseudocode as:


DECLARE BuildingRegister : BuildingRecord

(a) Write pseudocode statements to assign:

• 1067 to the BuildingID of BuildingRegister


• house to the BuildingGroup of BuildingRegister

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

(b) The type definition for BuildingRecord is changed. The data type for BuildingGroup is
changed to an enumerated type, BuildingType, with values of house, bungalow, apartment
and farm.

(i) Write the type declaration for BuildingType in pseudocode.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

..................................................................................................................................... [2]

(ii) Write the new declaration for BuildingGroup in pseudocode.

...........................................................................................................................................

..................................................................................................................................... [1]

(iii) Write the new pseudocode statement to assign house to BuildingGroup of


BuildingRegister.

...........................................................................................................................................

..................................................................................................................................... [1]

© UCLES 2022 9618/32/M/J/22


3

(c) The program is to be rewritten using Object-Oriented Programming (OOP). The data type
BuildingRecord is to be changed to a class, BuildingClass.

The properties for BuildingClass are BuildingID, BuildingGroup, OwnerName,


BuildingAddress, DateLastSold and PriceLastSold.

All the properties are set to PRIVATE, for example:


PRIVATE PriceLastSold : REAL

(i) Write the declaration in pseudocode for OwnerName as PRIVATE.

............................................................................................................................................................

..................................................................................................................................................... [1]

(ii) Explain why the properties have been set to PRIVATE.

............................................................................................................................................................

............................................................................................................................................................

............................................................................................................................................................

..................................................................................................................................................... [2]

© UCLES 2022 9618/32/M/J/22 [Turn over


2

1 Numbers are stored in two different computer systems by using floating-point representation.

System 1 uses:

• 10 bits for the mantissa


• 6 bits for the exponent
• two’s complement form for both the mantissa and the exponent.

System 2 uses:

• 8 bits for the mantissa


• 8 bits for the exponent
• two’s complement form for both the mantissa and the exponent.

(a) Calculate the normalised floating-point representation of 113.75 and show how it would be
represented in each of these two systems.

Show your working.

System 1

Mantissa Exponent

System 2

Mantissa Exponent

Working .....................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................
[4]

© UCLES 2023 9618/31/M/J/23


3

(b) Explain the problem that occurred in part (a) when representing the number in system 2.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

2 (a) Draw one line from each machine learning category to its most appropriate description.

Machine learning category Description

simulates the data-processing


capabilities of the human brain to
make decisions
Supervised
learning
enables learning by mapping an input
to an output based on example input–
output pairs
Reinforcement
learning
enables information related to errors
produced by the neural network to be
transmitted
Deep
learning
enables learning in an interactive
environment by trial and error using
its own experiences
Unsupervised
learning
enables learning by allowing the
process to discover patterns on its
own that were previously undetected
[4]

(b) Describe the purpose of both the A* algorithm and Dijkstra’s algorithm.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

© UCLES 2023 9618/31/M/J/23 [Turn over


2

1 Numbers are stored in a computer using floating point representation with:

• 10 bits for the mantissa


• 6 bits for the exponent
• two’s complement form for both the mantissa and exponent.

(a) Write the normalised floating-point representation of the following binary number using this
system:

0101010.111
Show your working.

Working .....................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

Mantissa Exponent

[2]

(b) Describe the reason why the normalised form of the following binary number cannot be
represented accurately using this system.

0101011.111001
...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [3]

© UCLES 2023 9618/32/M/J/23


3

2 (a) Describe how records are organised and accessed in a sequential file.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [3]

(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 modulus gives the remainder after integer division.


For example, 3003 modulus 5 = 3, so the record key 3003 gives a hash value of 3.

Complete the table to show the remaining hash values.

Record key Hash value

3003 3

1029

7630
[2]

© UCLES 2023 9618/32/M/J/23 [Turn over


4

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 modulus gives the remainder after integer division.


For example, 1030 modulus 3 = 1. Therefore, the record key 1030 gives a hash value of 1.

Complete the table to show the remaining hash values.

Record key Hash value


1030 1

1050

1025
[2]

(b) Describe what happens, in relation to the storage or retrieval of a record in the file, when
the calculated hash value is a duplicate of a previously calculated hash value for a different
record key.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [4]

© UCLES 2023 9618/31/M/J/23


5

4 Two descriptions of user-defined data types are given.

Give appropriate type declaration statements for each, including appropriate names.

(a) A data type to hold a set of prime numbers below 20. These prime numbers are:

2, 3, 5, 7, 11, 13, 17, 19

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

(b) A data type to point to a day in the week, for example Monday.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

5 (a) State, with a reason, where it would be appropriate to use circuit switching.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

(b) Give two benefits and two drawbacks of circuit switching.

Benefit 1 ...................................................................................................................................

...................................................................................................................................................

Benefit 2 ...................................................................................................................................

...................................................................................................................................................

Drawback 1 ...............................................................................................................................

...................................................................................................................................................

Drawback 2 ...............................................................................................................................

...................................................................................................................................................
[4]

© UCLES 2023 9618/31/M/J/23 [Turn over


7

6 (a) Write pseudocode statements to declare the composite data type, TAppointments, to hold
data about patients for a dental clinic. It will include for each patient:

• name (first name and last name)


• date of birth
• telephone number
• date of last appointment
• date of next appointment
• all treatments are complete (yes or no).

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [4]

(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 time.

Complete this file handling pseudocode:

DECLARE DentalRecord : ARRAY[1:250] OF TAppointments


DECLARE DentalFile : STRING
DECLARE Count : INTEGER
DentalFile "DentalFile.dat"
OUTPUT "The file ", DentalFile, " contains these records:"

OPENFILE .................................................................................................................

.......................................................................................... 1

REPEAT
SEEK DentalFile, Count

.....................................................................................................................
OUTPUT DentalRecord[Count]
Count Count + 1

.....................................................................(DentalFile)

.............................................................................................
[5]

© UCLES 2023 9618/32/M/J/23 [Turn over


2

1 (a) Numbers are stored in a computer using floating-point representation with:

• 12 bits for the mantissa


• 4 bits for the exponent
• two’s complement form for both the mantissa and exponent.

(i) Write the normalised floating-point representation of the following unsigned binary
number using this system.

1011100.011001
Working .............................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

Mantissa Exponent

[2]

(ii) State the consequence of storing the binary number in part (a)(i) as a floating-point
number in this system. Justify your answer.

Consequence ....................................................................................................................

...........................................................................................................................................

Justification .......................................................................................................................

...........................................................................................................................................

...........................................................................................................................................
[2]

(b) Explain the reason why binary numbers are stored in normalised form.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [3]
© UCLES 2021 9618/31/O/N/21
3

2 Draw one line from each programming paradigm to its most appropriate description.

Programming paradigm Description

Programs using the instruction set of a


processor

Declarative
Programs based on events such as user
actions or sensor outputs

Imperative
Programs using the concepts of class,
inheritance, encapsulation and
polymorphism
Low-level

Programs with an explicit sequence of


commands that update the program state,
Object-oriented with or without procedure calls

Programs that specify the desired result


rather than how to get to it

[4]

3 Enumerated and pointer are two non-composite data types.

(a) Write pseudocode to create an enumerated type called Parts to include these parts sold in
a computer shop:

Monitor, CPU, SSD, HDD, LaserPrinter, Keyboard, Mouse

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

(b) Write pseudocode to create a pointer type called SelectParts that will reference the
memory location in which the current part name is stored.

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

© UCLES 2021 9618/31/O/N/21 [Turn over


6

5 (a) Compare sequential and serial methods of file organisation.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [4]

(b) State the most suitable method of file access when a record is referenced by a unique
address on a disk-type storage medium.

............................................................................................................................................. [1]

(c) State the most suitable method of file access when a bank stores its data records in ascending
order of account number.

............................................................................................................................................. [1]

© UCLES 2021 9618/31/O/N/21


2

1 Real numbers are stored in a computer system using floating-point representation with:

• 8 bits for the mantissa


• 8 bits for the exponent
• two’s complement form for both mantissa and exponent.

(a) Write the normalised floating-point representation of +202 in this system.


Show your working.

Mantissa Exponent

Working .....................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................
[3]

(b) Write the normalised floating-point representation of –202 in this system.


Show your working.

Mantissa Exponent

Working .....................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................
[3]

© UCLES 2022 9618/31/O/N/22


3

(c) A binary number is stored in the computer system.

Mantissa Exponent

0 0 0 1 1 1 1 0 0 0 0 1 1 0 0 0

(i) State why the number is not normalised.

...........................................................................................................................................

..................................................................................................................................... [1]

(ii) Write the normalised floating-point representation of the number.

Mantissa Exponent

[2]

2 Outline the functions of the Transport and Internet layers of the TCP/IP protocol suite.

Transport layer .................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

Internet layer ....................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................
[5]

© UCLES 2022 9618/31/O/N/22 [Turn over


4

3 (a) State what is meant by the term enumerated data type.

...................................................................................................................................................

............................................................................................................................................. [1]

(b) State what is meant by the term pointer data type.

...................................................................................................................................................

............................................................................................................................................. [1]

(c) The months of the year are: January, February, March, April, May, June, July, August,
September, October, November and December.

Write the pseudocode statement to define the data type Quarter1, to hold the names of the
first three months of a year.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

(d) The composite data type Pet is used to store data about the various pets of a group of
students. It uses these fields:

Field name Data type


PetName String
AnimalType String
PetAge Integer
PetGender Char
OwnerName String

(i) Write the pseudocode statement to set up a variable for one record of the composite
data type Pet.

...........................................................................................................................................

..................................................................................................................................... [1]

© UCLES 2022 9618/31/O/N/22


5

(ii) Write pseudocode to store the details of the following pet, in the variable you set up in
part (d)(i).

PetName AnimalType PetAge PetGender OwnerName


Tibbles Cat 8 M Jasmine Smith

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

..................................................................................................................................... [3]

4 Draw one line to connect each stage of compilation to its most appropriate description.

Stage of compilation Description

minimising a program’s execution time and


memory requirement

Lexical analysis
converting an intermediate representation of
source code into an executable form

Syntax analysis
converting a sequence of characters into a
sequence of tokens

Code generation
directly executing instructions written in a
scripting language

Optimisation
using parsing algorithms to interpret the
meaning of a sequence of tokens

[4]

© UCLES 2022 9618/31/O/N/22 [Turn over


2

1 Normalised floating-point numbers are stored in a computer system using two’s complement for
both the mantissa and the exponent with:

• 11 bits for the mantissa


• 5 bits for the exponent.

(a) Write the largest positive two’s complement binary number that can be stored in this system.

Mantissa Exponent

[1]

(b) Calculate the denary value of the given binary floating-point number.
Show your working.

Mantissa Exponent

1 0 1 1 0 0 1 0 0 1 1 0 1 0 0 1

Working .....................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

Answer ......................................................................................................................................
[3]

(c) State when underflow occurs in a binary floating-point system.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

© UCLES 2022 9618/32/O/N/22


4

4 A program to manage regular flight details at an airport requires some user-defined data types.

(a) Write pseudocode statements to declare the enumerated data type Aircraft to hold data
about the types of aircraft used for a flight.

These types of aircraft are: C300, C350, D242, E757, X380.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

(b) Write pseudocode statements to declare the composite data type Flight to hold data about
flights to a specific destination. These include:

• flight number, which could be any combination of letters and numbers


• destination
• date of departure
• type of aircraft used.

Use the enumerated data type you created in part (a).

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [4]

(c) (i) Write the pseudocode statement to set up a variable for one record of the composite
data type Flight.

...........................................................................................................................................

..................................................................................................................................... [1]

© UCLES 2022 9618/32/O/N/22


5

(ii) Write pseudocode to store the details of the following flight in the variable you set up in
part (c)(i).

Field Data
flight number XA782
destination Cambridge
date of departure 12/12/2022
type of aircraft used C350

Use the field names you created in part (b).

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

..................................................................................................................................... [3]

5 Describe what is meant by a virtual machine.


Include in your answer two benefits and two drawbacks of using a virtual machine.

Description .......................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

..........................................................................................................................................................

Benefit 1 ...........................................................................................................................................

..........................................................................................................................................................

Benefit 2 ...........................................................................................................................................

..........................................................................................................................................................

Drawback 1 ......................................................................................................................................

..........................................................................................................................................................

Drawback 2 ......................................................................................................................................

..........................................................................................................................................................
[6]

© UCLES 2022 9618/32/O/N/22 [Turn over


2

1 In a particular computer system, real numbers are stored using floating-point representation with:

12 bits for the mantissa


4 bits for the exponent
two’s complement form for both mantissa and exponent.

(a) Calculate the normalised floating-point representation of +4.5 in this system. Show your
working.

Mantissa Exponent

Working .....................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

.............................................................................................................................................. [3]

(b)
working.

Mantissa Exponent

Working .....................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

.............................................................................................................................................. [3]

© UCLES 2018 9618/03/SP/21


1
3

(c) Calculate the denary value for the following binary floating-point number. Show your working.

Mantissa Exponent

0 0 0 1 1 0 0 0 0 0 0 0 0 1 0 1

Working .....................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

Answer ......................................................................................................................................
[3]

(d) (i) State whether the floating-point number given in part (c) is normalised or not normalised.

...................................................................................................................................... [1]

(ii) Justify your answer given in part (d)(i).

...........................................................................................................................................

...................................................................................................................................... [1]

(e) The system changes so that it now allocates eight bits to both the mantissa and the exponent.

Explain two effects this has on the numbers that can be represented.

1 ................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

2 ................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................
[4]

© UCLES 2018 9618/03/SP/21 [Turn over


2
2

1 (a) Numbers are stored in a computer using floating-point representation with:

• 12 bits for the mantissa


• 4 bits for the exponent
• two’s complement form for both the mantissa and exponent.

(i) Write the normalised floating-point representation of the following unsigned binary
number using this system.

1011100.011001
Working .............................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

Mantissa Exponent

[2]

(ii) State the consequence of storing the binary number in part (a)(i) as a floating-point
number in this system. Justify your answer.

Consequence ....................................................................................................................

...........................................................................................................................................

Justification .......................................................................................................................

...........................................................................................................................................

...........................................................................................................................................
[2]

(b) Explain the reason why binary numbers are stored in normalised form.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [3]
© UCLES 2021 9618/32/O/N/21
3
6

5 (a) Compare sequential and serial methods of file organisation.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [4]

(b) State the most suitable method of file access when a record is referenced by a unique
address on a disk-type storage medium.

............................................................................................................................................. [1]

(c) State the most suitable method of file access when a bank stores its data records in ascending
order of account number.

............................................................................................................................................. [1]

© UCLES 2021 9618/32/O/N/21


4
2

1 Real numbers are stored in a computer system using floating-point representation with:

• 10 bits for the mantissa


• 6 bits for the exponent
• Two’s complement form for both the mantissa and the exponent.

(a) Calculate the normalised floating-point representation of –7.25 in this system.


Show your working.

Mantissa Exponent

Working .....................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................
[3]

(b) Calculate the denary value of the given binary floating-point number.
Show your working.

Mantissa Exponent

1 0 1 1 0 0 0 1 1 1 0 0 0 1 1 1

Working .....................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

Answer ......................................................................................................................................
[3]

© UCLES 2021 9618/33/M/J/21


5
3

(c) The given binary floating-point number is not normalised.

Normalise the floating-point number. Show your working.

Mantissa Exponent

0 0 0 0 0 0 0 1 1 1 1 0 0 1 1 1

Mantissa Exponent

Working .....................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................
[3]

(d) The denary number 513 cannot be stored accurately as a normalised floating-point number in
this computer system.

(i) Explain the reason for this.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

..................................................................................................................................... [3]

(ii) Describe an alteration to the way floating-point numbers are stored to enable this number
to be stored accurately using the same total number of bits.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

..................................................................................................................................... [2]

© UCLES 2021 9618/33/M/J/21 [Turn over


6
4

2 (a) Describe the purpose of a user-defined data type.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

(b) Define, using pseudocode, the following enumerated data types:

(i) SchoolDay to hold data about the days students are usually in school.

...........................................................................................................................................

..................................................................................................................................... [1]

(ii) WeekEnd to hold data about the days that are not school days.

...........................................................................................................................................

..................................................................................................................................... [1]

(c) Define, using pseudocode, the composite data type ClubMeet. This will hold data about club
members that includes:

• first name and last name


• the two days they attend:
one on a school day
one not on a school day.

Use the enumerated types you created in part (b).

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [4]

© UCLES 2021 9618/33/M/J/21


7
8

(b) Explain the use of graphs to aid Artificial Intelligence (AI).

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [3]

6 Give two benefits and two drawbacks of packet switching.

Benefit 1 ...........................................................................................................................................

..........................................................................................................................................................

Benefit 2 ...........................................................................................................................................

..........................................................................................................................................................

Drawback 1 ......................................................................................................................................

..........................................................................................................................................................

Drawback 2 ......................................................................................................................................

..........................................................................................................................................................
[4]

© UCLES 2021 9618/33/M/J/21


8
2

1 Floating-point is to be used to represent real numbers with:

• 8 bits for the mantissa, followed by


• 4 bits for the exponent
• two’s complement used for both mantissa and exponent

(a) (i) Consider this binary pattern.

0 1 1 0 1 0 0 0 0 1 0 0

What number is this in denary? Show your working.

[3]

(ii) The representation shown in part (a)(i) is normalised.

Explain why floating-point numbers are normalised.

[1]

(iii) Show the binary pattern for the smallest positive number which can be stored using a
normalised 12-bit floating-point representation.

Mantissa:

Exponent:

Work out its denary value.

Denary: [3]

© UCLES 2012 9608/03/SP/15


9
3

(b) The developer of a new programming language decides that all real numbers will be stored
using 20-bit normalised floating-point representation. She cannot decide how many bits to
use for the mantissa and how many for the exponent.

Explain the trade-off between using either a large number of bits for the mantissa, or a large
number of bits for the exponent.

[2]

© UCLES 2012 9608/03/SP/15 [Turn over


10
2

1 In a particular computer system, two real numbers, A and B, are stored using floating-point
representation with:

• 12 bits for the mantissa


• 4 bits for the exponent
• two’s complement form for both mantissa and exponent.

Number A Mantissa Exponent

1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0

Number B Mantissa Exponent

0 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1

(a) (i) Identify whether each number is positive or negative. Justify your answer.

Number A .........................................................................................................................

...........................................................................................................................................

Number B .........................................................................................................................

...........................................................................................................................................
[2]

(ii) Convert the binary values of the mantissa and the exponent for each number to their
separate denary values.

A mantissa ........................................................................................................................

...........................................................................................................................................

A exponent ........................................................................................................................

...........................................................................................................................................

B mantissa ........................................................................................................................

...........................................................................................................................................

B exponent ........................................................................................................................

...........................................................................................................................................
[4]

© UCLES 2021 9608/33/M/J/21


11
3

(iii) Calculate the denary value of each floating-point number using your values from
part (a)(ii).

Number A .........................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

Number B .........................................................................................................................

...........................................................................................................................................

...........................................................................................................................................
[2]

(b) State which number, A or B, is stored in normalised floating-point form. Justify your answer.

Number .....................................................................................................................................

Justification ...............................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................
[3]

© UCLES 2021 9608/33/M/J/21 [Turn over


12
2

1 In a computer system, two real numbers, A and B, are stored using floating-point representation
with:

• 12 bits for the mantissa


• 4 bits for the exponent
• two’s complement form for both mantissa and exponent.

Number A Mantissa Exponent

0 1 1 0 0 0 0 0 0 0 0 0 1 1 1 1

Number B Mantissa Exponent

1 1 1 0 0 0 0 0 0 0 0 0 0 1 0 0

(a) (i) Convert the binary values of the mantissa and the exponent for each number to their
separate denary values.

A mantissa .......................................................................................................................

...........................................................................................................................................

A exponent .......................................................................................................................

...........................................................................................................................................

B mantissa .......................................................................................................................

...........................................................................................................................................

B exponent .......................................................................................................................

...........................................................................................................................................
[4]

(ii) Calculate the denary value of each floating-point number using your values from
part (a)(i).

Number A .........................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

Number B .........................................................................................................................

...........................................................................................................................................

...........................................................................................................................................
[2]

© UCLES 2021 9608/32/M/J/21


13
3

(b) State which number, A or B, is stored in normalised floating-point form. Justify your answer.

Number .....................................................................................................................................

Justification ...............................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................
[3]

2 The TCP/IP protocol suite can be viewed as a stack with four layers.

(a) Write the correct descriptions for the two layers and the correct layers for the two descriptions
given in the following table.

Layer Description

Application

Transport

Handles transmission of data

Handles how data is physically sent

[4]

(b) Identify and state the purpose of two communication protocols other than TCP/IP.

Protocol 1 .................................................................................................................................

Purpose ....................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

Protocol 2 .................................................................................................................................

Purpose ....................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................
[4]

© UCLES 2021 9608/32/M/J/21 [Turn over


14
2

1 In a particular computer system, real numbers are stored using floating-point representation with:

• 12 bits for the mantissa


• 4 bits for the exponent
• two’s complement form for both mantissa and exponent.

(a) The following floating-point number stored is not normalised.

Calculate the denary value for the floating-point number. Show your working.

Mantissa Exponent

0 0 0 0 1 1 0 0 0 0 0 0 0 1 0 1

Working .....................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

Denary value ............................................................................................................................


[3]

(b) (i) Normalise the floating-point number given in part (a).

Write your answer in the following boxes.

Mantissa Exponent

[2]

(ii) Describe one problem that can occur when floating-point numbers are not normalised.

...........................................................................................................................................

...........................................................................................................................................

..................................................................................................................................... [2]

© UCLES 2020 9608/33/O/N/20


15
3

2 Data types can be classified as composite or non-composite.

A record is declared of type box using the following pseudocode.

TYPE size = (small, medium, large)

TYPE box

DECLARE volume : size

DECLARE price : REAL

DECLARE colour : STRING

ENDTYPE

DECLARE myBox : ARRAY [1:6] OF box

(a) (i) Identify one composite and three non-composite data types used in the pseudocode.

Composite data type .........................................................................................................

Non-composite data type 1 ...............................................................................................

Non-composite data type 2 ...............................................................................................

Non-composite data type 3 ...............................................................................................


[4]

(ii) Identify the data type in the pseudocode that is enumerated.

..................................................................................................................................... [1]

(b) A box is red, with medium volume and a price of $10.99.

Write pseudocode to store the details of this box in the first element of the array.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [3]

© UCLES 2020 9608/33/O/N/20 [Turn over


16
2

1 In a particular computer system, real numbers are stored using floating-point representation, with:

• 12 bits for the mantissa


• 4 bits for the exponent
• two’s complement form for both mantissa and exponent.

(a) Calculate the denary value for the following floating-point number. Show your working.

Mantissa Exponent

0 1 0 1 0 0 0 0 0 0 0 0 0 1 1 0

Working .....................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

Denary value ............................................................................................................................


[3]

(b) A new operating system has been installed that has changed the way the floating-point
numbers are used. The order of the exponent and the mantissa are reversed.

(i) Calculate the new denary value for the following floating-point number that has the same
bit pattern as the number in part (a). Show your working.

Exponent Mantissa

0 1 0 1 0 0 0 0 0 0 0 0 0 1 1 0

Working .............................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

Denary value .....................................................................................................................


[3]

© UCLES 2020 9608/32/O/N/20


17
3

(ii) Identify two problems that can occur due to the change in the representation of the
floating-point number.

Problem 1 ..........................................................................................................................

...........................................................................................................................................

Problem 2 ..........................................................................................................................

...........................................................................................................................................
[2]

© UCLES 2020 9608/32/O/N/20 [Turn over


18
4

2 Data types can be classified as composite or non-composite.

(a) Draw one line from each data type to its correct classification.

Data type Classification

Pointer

Record Composite

Set

Class Non-composite

Integer

[2]

(b) A user-defined data type, timeOfDay, is declared using the following pseudocode.

TYPE timeOfDay = (morning, afternoon, evening, night)

(i) Identify the type of user-defined data type declared and state its classification.

Type ..................................................................................................................................

Classification .....................................................................................................................
[2]

(ii) Write pseudocode to declare the variable session of type timeOfDay.


Assign the value afternoon to the variable session.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

..................................................................................................................................... [2]

© UCLES 2020 9608/32/O/N/20


19
2

1 In a particular computer system, real numbers are stored using floating-point representation with:

• 10 bits for the mantissa


• 6 bits for the exponent
• two’s complement form for both mantissa and exponent.

(a) Calculate the normalised floating-point representation of +192.5 in this system. Show your
working.

Mantissa Exponent

Working .....................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [3]

(b) Calculate the normalised floating-point representation of –192.5 in this system. Show your
working.

Mantissa Exponent

Working .....................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [3]

© UCLES 2020 9608/33/M/J/20


20
3

(c) The floating-point representation has changed. There are now 12 bits for the mantissa and 4
bits for the exponent as shown.

Mantissa Exponent

Explain why +192.5 cannot be accurately represented in this format.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [3]

2 The diagram shows four files and three methods of file organisation.

Draw one line to match each file with its most appropriate method of file organisation.

File File organisation

Text file

Sequential

File for recording the temperature every hour

Random

Master file for paying each employee every month

Serial

Customer user name and password file

[4]

© UCLES 2020 9608/33/M/J/20 [Turn over


21
2

1 Real numbers are stored using floating-point representation in a computer system.

This representation uses:

• 8 bits for the mantissa, followed by


• 4 bits for the exponent.

(a) (i) A real number is stored as a 12-bit normalised binary number as follows:

Mantissa Exponent

0 1 0 1 0 0 1 0 0 0 1 0

Calculate the denary value for this binary number. Show your working.

Working .............................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

Denary value .....................................................................................................................


[3]

(ii)

Mantissa Exponent

Working .............................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................
[3]

(b) The number of bits available to represent a real number is increased to 16.

State the effect of increasing the size of the exponent by 4 bits.

...................................................................................................................................................

............................................................................................................................................. [1]

© UCLES 2019 9608/33/O/N/19


22
3

(c) State why some binary representations can lead to rounding errors.

...................................................................................................................................................

............................................................................................................................................. [1]

(d) Complete the following descriptions by inserting the two missing terms.

................................................ can occur in the exponent of a floating-point number, when the

exponent has become too large to be represented using the number of bits available.

A calculation results in a number so small that it cannot be represented by the number of bits

available. This is called ................................................ .


[2]

© UCLES 2019 9608/33/O/N/19 [Turn over


23
12

8 (a)
complement form. The twelve most significant bits are used for the mantissa and the four
least significant bits are used for the exponent.

Most Least
significant bit significant bit

0 1 1 1 0 0 0 0 0 0 0 0 1 1 0 1

(i) Identify the binary value of the exponent.

..................................................................................................................................... [1]

(ii) Identify the binary value of the mantissa.

..................................................................................................................................... [1]

(iii) State whether the number stored is positive or negative. Justify your choice.

Positive or negative ...........................................................................................................

Justification .......................................................................................................................

...........................................................................................................................................

...........................................................................................................................................
[2]

(iv) Convert the binary floating-point number in part (a) into denary. Show your working.

Working .............................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

Denary value .....................................................................................................................


[3]

© UCLES 2019 9608/32/O/N/19


24
13

(b) The number of bits used for the exponent is increased to eight, and the number of bits used
for the mantissa is decreased to eight.

State the effects of this change.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

© UCLES 2019 9608/32/O/N/19


25
9

6 (a) State what is meant by a user-defined data type.

...................................................................................................................................................

............................................................................................................................................. [2]

(b) A pseudocode declaration for a user-defined data type for the months of the year is as follows:

TYPE
DECLARE Months: (January, February, March, April, May, June, July,
August, September, October, November, December)
ENDTYPE

(i) Identify this type of user-defined data type.

...........................................................................................................................................

..................................................................................................................................... [1]

(ii) Write a pseudocode statement to declare a variable CurrentMonth of data type


Months.

...........................................................................................................................................

..................................................................................................................................... [1]

(iii) Write a pseudocode statement to assign the value August to the variable
CurrentMonth.

...........................................................................................................................................

..................................................................................................................................... [1]

© UCLES 2019 9608/32/O/N/19 [Turn over


26
2

1 In a computer system, real numbers are stored using normalised floating-point representation
with:

• twelve bits for the mantissa


• four bits for the exponent.

(a) Calculate the denary value for the following binary floating-point number.

Show your working.

Mantissa Exponent

1 0 0 1 0 1 1 1 0 0 1 1 0 1 1 1

Working .....................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

Answer ......................................................................................................................................
[3]

(b) Calculate the normalised floating-point representation of +1.5625 in this system.

Show your working.

Working .....................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

Mantissa Exponent

[3]

© UCLES 2019 9608/33/M/J/19


27
3

(c) (i) Write the largest positive number that can be stored as a normalised floating-point
number using this format.

Mantissa Exponent

[2]

(ii) Write the smallest non-zero positive number that can be stored as a normalised
floating-point number using this format.

Mantissa Exponent

[2]

(d) The developer of a new programming language decides that all real numbers will now be
stored using 20-bit normalised floating-point representation. She must decide how many bits
to use for the mantissa and how many bits for the exponent.

Explain the trade-off between using either a large number of bits for the mantissa, or a large
number of bits for the exponent.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [3]

© UCLES 2019 9608/33/M/J/19 [Turn over


28
2

1 (a) A computer stores real numbers using floating-point representation. The floating-point
numbers have:

• eight bits for the mantissa


• four bits for the exponent.

(i) Calculate the denary value of the following floating-point number.

Show your working.

Mantissa Exponent

0 0 1 1 0 1 1 1 0 1 0 1

Working .............................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

Answer ..............................................................................................................................
[3]

(ii) State why the floating-point number in part (a)(i) is not normalised.

...........................................................................................................................................

..................................................................................................................................... [1]

(iii) Give the floating-point number in part (a)(i)

Mantissa Exponent

[2]

© UCLES 2019 9608/32/M/J/19


29
3

(b) (i) Convert the denary number +11.625 into a normalised floating-point number.

Show your working.

Working .............................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

Mantissa Exponent

[3]

(ii)

Show your working.

Working .............................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

Mantissa Exponent

[3]

© UCLES 2019 9608/32/M/J/19 [Turn over


30
4

(c) A student enters the following into an interpreter:

OUTPUT(0.2 * 0.4)

The student is surprised to see that the interpreter outputs the following:

0.08000000000000002

Explain why the interpreter outputs this value.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [3]

2 Packet switching can be used to transmit data across the Internet.

Packet switching is not always the most appropriate method of transferring data.

(a) Name an alternative method of transferring data across the Internet.

............................................................................................................................................. [1]

(b) Give an example of a situation where the method you identified in part (a) is more appropriate.

Justify your choice.

Example ....................................................................................................................................

...................................................................................................................................................

Justification ...............................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................
[3]

© UCLES 2019 9608/32/M/J/19


31
3

1 Consider the following user-defined data type.

TYPE Book
DECLARE ISBN : INTEGER
DECLARE Author : STRING
DECLARE Title : STRING
DECLARE Supplier : (Amazone, Stones, Smiths, Blackwalls, Greens,
Coals, Boarders)
ENDTYPE

(a) Name the data type of Book.

...............................................................................................................................................[1]

(b) Name the non-composite data type used in the Supplier declaration.

...............................................................................................................................................[1]

(c) (i) Write a pseudocode statement to declare a variable, BestSeller, of type Book.

.......................................................................................................................................[1]

(ii) Write a pseudocode statement to assign “John Williams” to the author of


BestSeller.

.......................................................................................................................................[1]

© UCLES 2018 9608/33/O/N/18 [Turn over


32
4

2 (a) A computer system stores real numbers using floating-point representation. The floating-point
numbers have:

• eight bits for the mantissa


• four bits for the exponent.

(i) Calculate the denary value of the following floating-point number.

Mantissa Exponent

0 0 1 1 1 0 0 0 0 1 1 1

Show your working.

Working .............................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

Answer ..............................................................................................................................
[3]

(ii) State how you know the floating-point number in part (a)(i) is not normalised.

...........................................................................................................................................

.......................................................................................................................................[1]

(iii) Normalise the floating-point number in part (a)(i).

Mantissa Exponent

[2]

(b) (i) Write the largest positive number that this system can represent as a normalised
floating-point number in this format.

Mantissa Exponent

[2]

© UCLES 2018 9608/33/O/N/18


33
5

(ii) Write the smallest positive number that can be stored as a normalised floating-point
number in this format.

Mantissa Exponent

[2]

(c) The number of bits available to represent a real number is increased to 16.

State the effect this has on the numbers that can be represented, if the additional four bits are
used in the:

(i) mantissa ............................................................................................................................

.......................................................................................................................................[1]

(ii) exponent ...........................................................................................................................

.......................................................................................................................................[1]

(d) A student enters the following code into an interpreter.

X = 0.1
Y = 0.2
Z = 0.3
OUTPUT (X + Y + Z)

The student is surprised to see the output:

0.6000000000000001

Explain why this is output.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...............................................................................................................................................[3]

© UCLES 2018 9608/33/O/N/18 [Turn over


34
2

1 (a) A computer system uses floating-point representation to store real numbers. The floating-point
numbers have:

• 8 bits for the mantissa


• 8 bits for the exponent

(i) Calculate the denary value of the following floating-point number. It is not in normalised
form.

Mantissa Exponent

0 0 1 0 1 0 1 0 0 0 0 0 0 1 0 1

Show your working.

Working .............................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

Answer ..............................................................................................................................
[3]

(ii) Convert the denary number + 7.5 into a normalised floating-point number.

Show your working.

Mantissa Exponent

Working .............................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................
[3]

© UCLES 2018 9608/32/O/N/18


35
3

(iii)

Show your working.

Mantissa Exponent

Working .............................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................
[3]

(b) A normalised floating-point number is shown.

Mantissa Exponent

0 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1

(i) State the significance of this binary number.

...........................................................................................................................................

.......................................................................................................................................[1]

(ii) State what will happen if a positive number is added to this number.

...........................................................................................................................................

.......................................................................................................................................[1]

© UCLES 2018 9608/32/O/N/18 [Turn over


36
2

1 In a computer system, real numbers are stored using normalised floating-point representation
with:

• 12 bits for the mantissa


• 4 bits for the exponent

(a) Find the denary value for the following binary floating-point number.

Mantissa Exponent

1 0 1 1 1 0 0 1 1 0 1 0 0 1 0 1

Show your working.

Working .....................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

Answer ......................................................................................................................................
[3]

(b) Calculate the normalised floating-point representation of 5.25 in this system. Show your
working.

Working .....................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

Mantissa Exponent

[3]

© UCLES 2018 9608/33/M/J/18


37
3

(c) The size of the mantissa is decreased and the size of the exponent is increased.

State how this affects the range and precision of the numbers that the computer system can
represent.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...............................................................................................................................................[2]

2 A programmer uses non-composite and composite data types to create a program.

(a) Define the term non-composite data type.

...................................................................................................................................................

...............................................................................................................................................[1]

(b) Describe two different non-composite data types.

Data type 1 ...............................................................................................................................

Description ................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

Data type 2 ...............................................................................................................................

Description ................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................
[4]

(c) Define the term composite data type.

...................................................................................................................................................

...............................................................................................................................................[1]

© UCLES 2018 9608/33/M/J/18 [Turn over


38
4

(d) Describe two different composite data types.

Data type 1 ...............................................................................................................................

Description ................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

Data type 2 ...............................................................................................................................

Description ................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................
[4]

3 Star and bus are two types of topology that can be used in a Local Area Network (LAN).

Bus topology

Star topology

(a) (i) State one benefit and one drawback of the star topology.

Benefit ...............................................................................................................................

...........................................................................................................................................

Drawback ..........................................................................................................................

...........................................................................................................................................
[2]

(ii) State one benefit and one drawback of the bus topology.

Benefit ...............................................................................................................................

...........................................................................................................................................

Drawback ..........................................................................................................................

...........................................................................................................................................
[2]
© UCLES 2018 9608/33/M/J/18
39
2

1 Data types can be defined in a programming language.

The data type, StudentRecord, is defined by the code:

TYPE StudentRecord
DECLARE StudentID : INTEGER
DECLARE StudentFirstName : STRING
DECLARE StudentSurname : STRING
DECLARE StudentDOB : DATE
DECLARE StudentCourse : ARRAY[1:10] OF STRING
ENDTYPE

A variable, CollegeStudent, is declared with the code:

DECLARE CollegeStudent : StudentRecord

(a) Write a pseudocode statement to assign 6539 to the StudentID of CollegeStudent.

...............................................................................................................................................[1]

(b) The type definition for StudentRecord is changed.

(i) Students can take six courses from: Computer Science, Engineering, Science, Maths,
Physics, Chemistry, Music, Drama and English Language.

Rewrite one line from the type definition of StudentRecord to implement the change.

DECLARE ...........................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

.......................................................................................................................................[2]

(ii) The values for the field StudentID must be between 1 and 8000 inclusive.

Rewrite one line from the type definition of StudentRecord to implement the change.

DECLARE .......................................................................................................................[1]

© UCLES 2018 9608/32/M/J/18


40
3

(c) A programmer is asked to write a program to process the assessment data for each student.
Students sit one exam in every course they take.

A composite data type, StudentAssessment, needs to be defined with the following three
fields.

• a student assessment code (a unique code of three letters and two digits)
• the marks for the six exams
• the average mark of the six exams

(i) Write pseudocode to define the data type StudentAssessment.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

.......................................................................................................................................[4]

(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 data for a new student.

Explain how the program adds the new data to the file.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

.......................................................................................................................................[3]

© UCLES 2018 9608/32/M/J/18 [Turn over


41
6

(c) The syntax of variable is changed to allow one or more letters followed by an unsigned
integer.

Draw a syntax diagram for the new syntax of the variable.

[3]

3 In a computer system, real numbers are stored using normalised-floating point representation
with:

• 8 bits for the mantissa


• 4 bits for the exponent

(a) Calculate the normalised floating-point representation of + 21.75 in this system. Show your
working.

Working .....................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

Mantissa Exponent

[3]

© UCLES 2018 9608/32/M/J/18


42
7

(b) Find the denary value for the following binary floating-point number.

Mantissa Exponent

1 0 1 1 0 0 0 0 1 1 1 0

Show your working.

Working .....................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

Answer ......................................................................................................................................
[3]

4 The TCP/IP protocol suite is used on the Internet.

(a) The table has statements about transmitting data across the Internet.

Put a tick ( ) in each row to identify whether the responsibility belongs to TCP or IP.

Responsibility TCP IP

Correct routing

Host to host communication

Communication between networks

Retransmitting missing packets

Reassembling packets into the correct order

[5]

(b) Identify two other internet protocols. State a use for each protocol.

Protocol 1 .................................................................................................................................

...................................................................................................................................................

Use ...........................................................................................................................................

...................................................................................................................................................

© UCLES 2018 9608/32/M/J/18 [Turn over


43
2

1 In a particular computer system, real numbers are stored using floating-point representation with:

• 12 bits for the mantissa


• 4 bits for the exponent
• two’s complement form for both mantissa and exponent

(a) Calculate the floating-point representation of + 2.5 in this system. Show your working.

Mantissa Exponent


...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

.............................................................................................................................................. [3]

(b) Calculate the floating-point representation of − 2.5 in this system. Show your working.

Mantissa Exponent


...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

.............................................................................................................................................. [3]

© UCLES 2016 9608/33/O/N/16


44
3

(c) Find the denary value for the following binary floating-point number. Show your working.

Mantissa Exponent

0
•0 1 1 0 0 0 0 0 0 0 0 0 0 1 1

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

.............................................................................................................................................. [3]

(d) (i) State whether the floating-point number given in part (c) is normalised or not normalised.

...................................................................................................................................... [1]

(ii) Justify your answer given in part (d)(i).

...........................................................................................................................................

...................................................................................................................................... [1]

(e) The system changes so that it now allocates 8 bits to both the mantissa and the exponent.

State two effects this has on the numbers that can be represented.

1 ...............................................................................................................................................

...................................................................................................................................................

2 ...............................................................................................................................................

.............................................................................................................................................. [2]

© UCLES 2016 9608/33/O/N/16 [Turn over


45
2

1 (a) Consider the following user-defined data type:

TYPE LibraryBookRecord
DECLARE ISBN : INTEGER
DECLARE Title : STRING
ENDTYPE

(i) Write a pseudocode statement to declare a variable, Book, of type LibraryBookRecord.

.......................................................................................................................................[1]

(ii) Title of Book.

.......................................................................................................................................[1]

(b) The user-defined data type LibraryBookRecord needs to be modified by adding the
following fields:

• Genre
• NumberOfLoans which can be an integer value in the range 1 to 99

Write the updated version of LibraryBookRecord.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...............................................................................................................................................[3]

(c) A pointer is a variable that stores the address of a variable of a particular type.

Consider the code on page 3, which uses the following identifiers:

Identifier Data type Description


IntPointer ^INTEGER pointer to an integer
IntVar INTEGER an integer variable
Temp1 INTEGER an integer variable
Temp2 INTEGER an integer variable

© UCLES 2017 9608/33/M/J/17


46
3

IntVar 57 // assigns the value 57 to the integer


// variable IntVar
IntPointer @IntVar // assigns to IntPointer the address of the
// integer variable IntVar
Temp2 IntPointer^ // assigns to variable Temp2 the value at an
// address pointed at by IntPointer
IntPointer^ Temp1 // assigns the value in the variable Temp1 to
// the memory location pointed at by IntPointer

The four assignment statements are executed. The diagram shows the memory contents
after execution.

Memory
Variable Contents
address

...

8217
IntVar 8216 88
8215
8214

...

7307
IntPointer 7306 8216
7305

...

6717
Temp1 6716 88
Temp2 6715 57
6714

...

Use the diagram to state the current values of the following expressions:

(i) @Temp2 .........................................................................................................................[1]

(ii) IntPointer .................................................................................................................[1]

(iii) IntPointer^ ...............................................................................................................[1]

(iv) IntPointer^ = Temp2 + 6 .....................................................................................[1]

© UCLES 2017 9608/33/M/J/17 [Turn over


47
4

(d) Write pseudocode statements that will achieve the following:

(i) Assign the value 22 to the variable Temp2.

.......................................................................................................................................[1]

(ii) Place the address of Temp1 in IntPointer.

.......................................................................................................................................[1]

(iii) Copy the value in Temp2 into the memory location currently pointed at by IntPointer.

.......................................................................................................................................[1]

© UCLES 2017 9608/33/M/J/17


48
2

1 (a) Consider the following pseudocode user-defined data type:

TYPE MyContactDetail
DECLARE Name : STRING
DECLARE HouseNumber : INTEGER
ENDTYPE

(i) Write a pseudocode statement to declare a variable, NewFriend, of type


MyContactDetail.

.......................................................................................................................................[1]

(ii) Write a pseudocode statement that assigns 129 to the HouseNumber of NewFriend.

.......................................................................................................................................[1]

(b) The user-defined data type MyContactDetail needs to be modified by:

• Area which can take three values, uptown, downtown or midtown


• HouseNumber so that house numbers can only be in the range 1 to
499.

Write the updated version of MyContactDetail.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...............................................................................................................................................[3]

(c) A pointer is a variable that stores the address of a variable of a particular type.

Consider the pseudocode on page 3, which uses the following identifiers:

Identifier Data type Description


IPointer ^INTEGER pointer to an integer
Sum INTEGER an integer variable
MyInt1 INTEGER an integer variable
MyInt2 INTEGER an integer variable

© UCLES 2017 9608/32/M/J/17


49
3

Sum 91 // assigns the value 91 to the integer variable Sum


IPointer @Sum // assigns to IPointer the address of the
// integer variable Sum
MyInt1 IPointer^ // assigns to variable MyInt1 the value at an
// address pointed at by IPointer
IPointer^ MyInt2 // assigns the value in the variable MyInt2 to
// the memory location pointed at by IPointer

The four assignment statements are executed. The diagram shows the memory contents
after execution.

Memory
Variable Contents
Address

...

5848
5847
IPointer 5846 4402
5845

...

4403
Sum 4402 33
4401

...

3428
MyInt1 3427 91
MyInt2 3426 33
3425

...

Use the diagram to state the current values of the following expressions:

(i) IPointer .....................................................................................................................[1]

(ii) IPointer^ ...................................................................................................................[1]

(iii) @MyInt1 ......................................................................................................................[1]

(iv) IPointer^ = MyInt2 ...............................................................................................[1]

© UCLES 2017 9608/32/M/J/17 [Turn over


50
4

(d) Write pseudocode statements that will achieve the following:

(i) Place the address of MyInt2 in IPointer.

.......................................................................................................................................[1]

(ii) Assign the value 33 to the variable MyInt1.

.......................................................................................................................................[1]

(iii) Copy the value in MyInt2 into the memory location currently pointed at by IPointer.

.......................................................................................................................................[1]

© UCLES 2017 9608/32/M/J/17


51
8

4 (a) Three file organisation methods and two file access methods are shown below.

Draw lines to link each file organisation method to its appropriate file access method(s).

File organisation method File access method

random sequential

serial direct

sequential

[4]

(b) An energy company supplies electricity to a large number of customers. Each customer has
a meter that records the amount of electricity used. Customers submit meter readings using
their online account.

This data includes:

• account number
• personal data (name, address, telephone number)
• meter readings
• username and encrypted password.

The computer system uses three files:

File Content Use


A Account number and meter readings Each time a customer submits their
for the current month. reading, a new record is added to the
file.
B At the end of the month to create a
statement that shows the electricity
supplied and the total cost.
C Usernames and encrypted passwords. When customers log in to their
accounts to submit meter readings.

© UCLES 2017 9608/32/M/J/17


52
9

For each of the files A, B and C, state an appropriate file organisation method for the use
given in the table.

All three file organisation methods must be different.

Justify your choice.

(i) File A organisation .............................................................................................................

Justification .......................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

.......................................................................................................................................[3]

(ii) File B organisation ............................................................................................................

Justification .......................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

.......................................................................................................................................[3]

(iii) File C organisation ............................................................................................................

Justification .......................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

.......................................................................................................................................[3]

© UCLES 2017 9608/32/M/J/17 [Turn over


53
2

1 In a particular computer system, real numbers are stored using floating-point representation with:

• 8 bits for the mantissa


• 8 bits for the exponent
• two’s complement form for both mantissa and exponent

(a) Calculate the floating point representation of + 3.5 in this system. Show your working.

Mantissa Exponent

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

.............................................................................................................................................. [3]

(b) Calculate the floating-point representation of –3.5 in this system. Show your working.

Mantissa Exponent

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

.............................................................................................................................................. [3]

© UCLES 2016 9608/32/O/N/16


54
3

(c) Find the denary value for the following binary floating-point number. Show your working.

Mantissa Exponent

0 1 1 1 0 0 0 0 0 0 0 0 0 1 0 0

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

.............................................................................................................................................. [3]

(d) (i) State whether the floating-point number given in part (c) is normalised or not normalised.

...................................................................................................................................... [1]

(ii) Justify your answer given in part (d)(i).

...........................................................................................................................................

...................................................................................................................................... [1]

(e) Give the binary two’s complement pattern for the negative number with the largest magnitude.

Mantissa Exponent

[2]

© UCLES 2016 9608/32/O/N/16 [Turn over


55
8

4 (a) Three file organisation methods and two file access methods are shown below.

Draw lines to link each file organisation method to its appropriate file access method or
methods.

File organisation method File access method

serial direct

sequential sequential

random

[4]

© UCLES 2016 9608/33/M/J/16


56
9

(b) A bank has a very large number of customers. The bank stores data for each customer. This
includes:

• unique customer number


• personal data (name, address, telephone number)
• transactions

The bank computer system makes use of three files:

• A – a file that stores customer personal data. This file is used at the end of each month
for the production of the monthly statement.
• B – a file that stores encrypted personal identification numbers (PINs) for customer bank
cards. This file is accessed when the customer attempts to withdraw cash at a cash
machine (ATM).
• C – a file that stores all customer transaction records for the current month. Every time
the customer makes a transaction, a new record is created.

For each of the files A, B and C, state an appropriate method of organisation. Justify your
choice.

(i) File A organisation ............................................................................................................

Justification ........................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

.......................................................................................................................................[3]

(ii) File B organisation ............................................................................................................

Justification ........................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

.......................................................................................................................................[3]

(iii) File C organisation ............................................................................................................

Justification ........................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

.......................................................................................................................................[3]

© UCLES 2016 9608/33/M/J/16 [Turn over


57
8

4 (a) Three file organisation methods and two file access methods are shown below.

Draw lines to link each file organisation method to its appropriate file access method or
methods.

File organisation method File access method

serial direct

sequential sequential

random

[4]

© UCLES 2016 9608/32/M/J/16


58
9

(b) A bank has a very large number of customers. The bank stores data for each customer. This
includes:

• unique customer number


• personal data (name, address, telephone number)
• transactions

The bank computer system makes use of three files:

• A – a file that stores customer personal data. This file is used at the end of each month
for the production of the monthly statement.
• B – a file that stores encrypted personal identification numbers (PINs) for customer bank
cards. This file is accessed when the customer attempts to withdraw cash at a cash
machine (ATM).
• C – a file that stores all customer transaction records for the current month. Every time
the customer makes a transaction, a new record is created.

For each of the files A, B and C, state an appropriate method of organisation. Justify your
choice.

(i) File A organisation ............................................................................................................

Justification ........................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

.......................................................................................................................................[3]

(ii) File B organisation ............................................................................................................

Justification ........................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

.......................................................................................................................................[3]

(iii) File C organisation ............................................................................................................

Justification ........................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

.......................................................................................................................................[3]

© UCLES 2016 9608/32/M/J/16 [Turn over


59
2

1 In a particular computer system, real numbers are stored using floating-point representation with:

• 8 bits for the mantissa, followed by


• 8 bits for the exponent

Two’s complement form is used for both mantissa and exponent.

(a) (i) A real number is stored as the following two bytes:

Mantissa Exponent

0 0 1 0 1 0 0 0 0 0 0 0 0 0 1 1

Calculate the denary value of this number. Show your working.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

.......................................................................................................................................[3]

(ii) Explain why the floating-point number in part (a)(i) is not normalised.

...........................................................................................................................................

.......................................................................................................................................[2]

(iii) Normalise the floating-point number in part (a)(i).

Mantissa Exponent

[2]

© UCLES 2015 9608/33/O/N/15


60
3

(b) (i) Write the largest positive number that can be written as a normalised floating-point
number in this format.

Mantissa Exponent

[2]

(ii) Write the smallest positive number that can be written as a normalised floating-point
number in this format.

Mantissa Exponent

[2]

(iii) If a positive number is added to the number in part (b)(i) explain what will happen.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

.......................................................................................................................................[2]

(c) A student writes a program to output numbers using the following code:

X 0.0
FOR i 0 TO 1000
X X + 0.1
OUTPUT X
ENDFOR

The student is surprised to see that the program outputs the following sequence:

0.0 0.1 0.2 0.2999999 0.3999999 ……

Explain why this output has occurred.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...............................................................................................................................................[3]

© UCLES 2015 9608/33/O/N/15 [Turn over


61
2

1 In a particular computer system, real numbers are stored using floating-point representation with:

• 8 bits for the mantissa, followed by


• 4 bits for the exponent

Two’s complement form is used for both mantissa and exponent.

(a) (i) A real number is stored as the following 12-bit binary pattern:

0 1 1 0 1 0 0 0 0 0 1 1

Calculate the denary value of this number. Show your working.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

.......................................................................................................................................[3]

(ii) Give the normalised binary pattern for +3.5. Show your working.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

.......................................................................................................................................[3]

(iii) Give the normalised binary pattern for –3.5. Show your working.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

.......................................................................................................................................[3]

© UCLES 2015 9608/32/O/N/15


62
3

The number of bits available to represent a real number is increased to 16.

(b) (i) If the system were to use the extra 4 bits for the mantissa, state what the effect would be
on the numbers that can be represented.

...........................................................................................................................................

.......................................................................................................................................[1]

(ii) If the system were to use the extra 4 bits for the exponent instead, state what the effect
would be on the numbers that can be represented.

...........................................................................................................................................

.......................................................................................................................................[1]

(c) A student enters the following expression into an interpreter:

OUTPUT (0.1 + 0.2)

The student is surprised to see the following output:

0.3000000000000001

Explain why this output has occurred.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...............................................................................................................................................[3]

© UCLES 2015 9608/32/O/N/15 [Turn over


63
8

4 (a) A particular programming language allows the programmer to define their own data types.

An example of a user-defined data type for an address is:

TYPE ThisAddress
DECLARE ThisHouseNo : INTEGER
DECLARE ThisStreet : STRING
DECLARE ThisTown : STRING
ENDTYPE

A variable of this new type is declared as follows:

DECLARE HomeAddress : ThisAddress

(i) Write the statement that assigns the house number 34 to HomeAddress.

.......................................................................................................................................[1]

(ii) The type definition for ThisAddress is to be changed.

Rewrite one line from the definition for each of the following changes.

House numbers are in the range from 1 to 10.

DECLARE ...........................................................................................................................

The possible towns are limited to: Brightown, Arunde and Shoram.

DECLARE .......................................................................................................................[2]

© UCLES 2015 9608/33/M/J/15


64
9

(b) Temperature data from a number of weather stations are to be processed by a program.

The following data are to be stored:

• weather station ID (a unique four-letter code)

• latitude (to 2 decimal places)

• average temperature (to the nearest whole number) for each year from 2001 to 2015
inclusive

A programmer designs a composite data type WeatherStation. A variable of this type can
be used to store all the data for one particular station.

(i) Write the definition for the user-defined data type WeatherStation.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

.......................................................................................................................................[5]

(ii) The programmer decides to store all the data in a file. The number of weather stations
could grow to reach 20000, but not all stations will be present at first.

The programmer decides on random organisation for the file.

Describe three steps which show how a new weather station record is added to the file.

1 ........................................................................................................................................

...........................................................................................................................................

2 ........................................................................................................................................

...........................................................................................................................................

3 ........................................................................................................................................

.......................................................................................................................................[3]

© UCLES 2015 9608/33/M/J/15 [Turn over


65
6

3 (a) A particular programming language allows the programmer to define their own data types.

ThisDate is an example of a user-defined structured data type.

TYPE ThisDate
DECLARE ThisDay : (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 29, 30, 31)
DECLARE ThisMonth : (Jan, Feb, Mar, Apr, May, Jun, Jul, Aug,
Sep, Oct, Nov, Dec)
DECLARE ThisYear : INTEGER
ENDTYPE

A variable of this new type is declared as follows:

DECLARE DateOfBirth : ThisDate

(i) Name the non-composite data type used in the ThisDay and ThisMonth declarations.

.......................................................................................................................................[1]

(ii) Name the data type of ThisDate.

.......................................................................................................................................[1]

(iii) The month value of DateOfBirth needs to be assigned to the variable


MyMonthOfBirth.

Write the required statement.

.......................................................................................................................................[1]

© UCLES 2015 9608/32/M/J/15


66
7

(b) Annual rainfall data from a number of locations are to be processed in a program.

The following data are to be stored:

• location name
• height above sea level (to the nearest metre)
• total rainfall for each month of the year (centimetres to 1 decimal place)

A user-defined, composite data type is needed. The programmer chooses


LocationRainfall as the name of this data type.

A variable of this type can be used to store all the data for one particular location.

(i) Write the definition for the data type LocationRainfall.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

.......................................................................................................................................[5]

(ii) The programmer decides to store all the data in a file. Initially, data from 27 locations will
be stored. More rainfall locations will be added over time and will never exceed 100.

The programmer has to choose between two types of file organisation. The two types are
serial and sequential.

Give two reasons for choosing serial file organisation.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

.......................................................................................................................................[2]

© UCLES 2015 9608/32/M/J/15 [Turn over


67

You might also like