Data representation: user-defined types, files and floating point – A Level Computer Science (9618)
60 questions · page 2 of 4 · Clear filters
Question text
1
A programmer is writing a program to manage bookings for a small taxi company. The programmer
requires some user-defined data types.
(a) Write a pseudocode statement to declare the enumerated data type, Vehicle, to hold the
identity code of each of the company’s taxis:
M100, M230, T101, T102, T120, T150
…
… [2]
(b) Write pseudocode statements to declare the composite data type, Booking, to hold data
about taxi bookings. The data required includes:
•
booking number (any combination of letters and numbers)
•
destination
•
client name
•
client telephone number
•
date of departure
•
address for pick-up
•
the identity code of the taxi used.
Use the most appropriate data type in each case, including the enumerated data type from
part (a).
…
…
…
…
…
…
…
… [4]
ĬÍĊ®Ġ´íÈõÏĪÅĊàù·þ×
Question text
2
Numbers are stored in a computer using binary 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) Write the normalised floating-point representation of the following binary number using this
system.
0.00000011010111
Mantissa
Exponent
[2]
(b) Calculate the normalised binary floating-point representation of –25.3125 in this system.
Show your working.
Mantissa
Exponent
Working …
…
…
…
…
…
…
…
[4]
ĬÏĊ®Ġ´íÈõÏĪÅĊàû·þ×
Question text
1
Data types can be defined using pseudocode.
The composite record data type, Departure, is used to represent flights from Cambridge Airport
and is defined in pseudocode as:
TYPE Departure
DECLARE FlightNumber : STRING
DECLARE Destination : STRING
DECLARE FlightDate : DATE
DECLARE Gate : STRING
DECLARE Airline : STRING
ENDTYPE
A variable, Flight1, is declared in pseudocode as:
DECLARE Flight1 : Departure
(a) Write pseudocode to store the following details to Flight1:
Field
Data
FlightNumber
SB2789
Destination
Dublin
FlightDate
30/07/2025
Gate
N03
Airline
Cambridge Airways
…
…
…
…
…
… [3]
(b) The data type for Gate is changed to an enumerated data type, GateID.
(i)
Write a pseudocode statement to declare GateID to hold the identity codes for the
airport gates:
N01, N02, N03, W01, W02, W03, W04
…
… [2]
(ii)
Write the new pseudocode statement required to replace the declaration of Gate in
Departure.
… [1]
ĬÍĊ®Ġ´íÈõÏĪÅĊÞû·þ×
Question text
2
Numbers are stored in a computer using binary floating-point representation with:
•
12 bits for the mantissa
•
4 bits for the exponent
•
two’s complement form for both the mantissa and the exponent.
(a) Calculate the normalised binary floating-point representation of +124.4375 in this system.
Show your working.
Mantissa
Exponent
Working …
…
…
…
…
…
[3]
(b) Calculate the denary value of the following normalised binary floating-point number.
Show your working.
Mantissa
Exponent
1
0
1
0
0
0
1
0
1
0
1
1
0
1
1
0
Working …
…
…
…
…
Denary value …
[3]
ĬÏĊ®Ġ´íÈõÏĪÅĊÞù·þ×
Question text
1
A programmer is writing a program to manage a video library. They require a user-defined data
type.
(a) Write pseudocode statements to declare the composite data type VideoLibrary to hold
data about each video in the collection. This data includes:
•
identity code (any combination of letters and numbers)
•
title
•
year released
•
date purchased
•
format (for example DVD, Blu-ray, 4K, MP4)
•
running time (minutes)
Use the most appropriate data type in each case.
…
…
…
…
…
…
…
… [4]
(b) Identify one field in VideoLibrary that could be an efficient enumerated data type and give
a reason for your choice.
Field …
…
Reason …
…
[2]
ĬÍĊ®Ġ´íÈõÏĪÅĊÝú·þ×
Question text
2
Numbers are stored in a computer using binary floating-point representation with:
•
8 bits for the mantissa
•
8 bits for the exponent
•
two’s complement form for both the mantissa and the exponent.
(a) Give the largest normalised positive two’s complement binary number that can be stored in
this system and state its denary equivalent.
The denary answer should be expressed in terms of powers of 2.
Mantissa
Exponent
Denary …
[2]
(b) Calculate the normalised binary floating-point representation of –3.59375 in this system.
Show your working.
Mantissa
Exponent
Working …
…
…
…
…
…
…
…
[4]
ĬÏĊ®Ġ´íÈõÏĪÅĊÝü·þ×
Question text
1
Numbers are stored in a computer using binary 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 binary floating-point representation of +201.125 in this system.
Show your working.
Mantissa
Exponent
Working …
…
…
…
…
…
[3]
(b) Calculate the denary value of the given normalised binary floating-point number.
Show your working.
Mantissa
Exponent
1
0
1
0
1
1
0
0
1
1
0
0
0
1
0
1
Working …
…
…
…
…
…
Answer …
[3]
ĬÍĊ®Ġ´íÈõÏĪÅĊÞü¸þ×
Question text
5
(a) Explain what is meant by a hashing algorithm in the context of file access.
…
…
…
…
…
… [3]
(b) The use of a hashing algorithm can result in the same storage location being identified for
more than one record.
Outline two methods of overcoming this issue.
1 …
…
2 …
…
[2]
ĬÍĊ®Ġ´íÈõÏĪÅĊàü¸Ā×
Question text
6
(a) Describe the user-defined data type set.
…
…
…
…
…
… [3]
(b) Write pseudocode statements to declare the set data type, SymbolSet, to hold the following
set of mathematical operators, using the variable Operators.
+
–
*
/
^
…
…
…
…
…
…
…
… [4]
ĬÏĊ®Ġ´íÈõÏĪÅĊàú¸Ā×
Question text
2
(a) Describe serial file organisation as a method of storing data records in a file.
…
…
…
… [2]
(b) State one example of a use for serial file organisation.
…
… [1]
ĬÍĊ®Ġ´íÈõÏĪÅĊÞû·þ×
Question text
3
(a) Describe the user‑defined data type record.
…
…
…
…
…
… [3]
(b) A programmer defines a record, Order, to store the following data:
•
account number
•
order number
•
order price
•
order date.
Write pseudocode statements to define this record.
…
…
…
…
…
…
…
… [4]
ĬÏĊ®Ġ´íÈõÏĪÅĊÞù·þ×
Question text
4
Numbers are stored in a computer using binary floating‑point representation with:
•
12 bits for the mantissa
•
4 bits for the exponent
•
two’s complement form for both the mantissa and the exponent.
(a) Calculate the denary value of the given normalised binary floating‑point number.
Show your working.
Mantissa
Exponent
1
0
0
0
1
1
1
0
1
1
1
0
1
1
1
0
Working …
…
…
Answer …
[2]
(b) Calculate the normalised binary floating‑point representation of – 49.1875 in this system.
Show your working.
Mantissa
Exponent
Working …
…
…
…
…
…
…
…
[4]
ĬÍĊ®Ġ´íÈõÏĪÅĊàû·Ā×
Question text
1
Numbers are stored in a computer using binary 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 binary floating-point representation of +201.125 in this system.
Show your working.
Mantissa
Exponent
Working …
…
…
…
…
…
[3]
(b) Calculate the denary value of the given normalised binary floating-point number.
Show your working.
Mantissa
Exponent
1
0
1
0
1
1
0
0
1
1
0
0
0
1
0
1
Working …
…
…
…
…
…
Answer …
[3]
ĬÍĊ®Ġ´íÈõÏĪÅĊÝù¸þ×
Question text
5
(a) Explain what is meant by a hashing algorithm in the context of file access.
…
…
…
…
…
… [3]
(b) The use of a hashing algorithm can result in the same storage location being identified for
more than one record.
Outline two methods of overcoming this issue.
1 …
…
2 …
…
[2]
ĬÍĊ®Ġ´íÈõÏĪÅĊßù¸Ā×
Question text
6
(a) Describe the user-defined data type set.
…
…
…
…
…
… [3]
(b) Write pseudocode statements to declare the set data type, SymbolSet, to hold the following
set of mathematical operators, using the variable Operators.
+
–
*
/
^
…
…
…
…
…
…
…
… [4]
ĬÏĊ®Ġ´íÈõÏĪÅĊßû¸Ā×