Data representation: user-defined types, files and floating point – A Level Computer Science (9618)
29 questions · page 1 of 2 · Clear filters
Question text
1
The composite record data type, ClubMember, is defined in pseudocode as:
TYPE ClubMember
DECLARE Code : INTEGER
DECLARE LastName : STRING
DECLARE FirstName : STRING
DECLARE Telephone : STRING
DECLARE JoinDate : DATE
DECLARE Fees : REAL
DECLARE FeesPaid : BOOLEAN
ENDTYPE
(a) (i)
Write the pseudocode statement to set up a variable for one record of the composite
data type, ClubMember.
…
… [1]
(ii)
Write the pseudocode statements to assign the following values to the variable set up in
part (a)(i):
•
984632 to Code
•
TRUE to FeesPaid
…
…
…
… [2]
(b) An enumerated data type, Activity, is required, so that a new field, Choice, can be added
to the composite data type, ClubMember, to allow members to choose an activity.
(i)
Write the pseudocode statement for the type declaration of Activity to hold the
names of the available activities:
Badminton, Football, Golf, Snooker, Swimming, Tennis.
…
…
…
… [2]
(ii)
Write the new pseudocode statement required to update the declaration of Choice in
the definition of ClubMember.
…
… [1]
ĬÕú¾Ġ´íÈõÏĪÅĊàù¸þ×
Question text
2
Numbers are stored in a computer system 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) Write the normalised floating‑point representation of the following positive binary number
using this system.
0.00000001110101101
Mantissa
Exponent
[2]
(b) Calculate the normalised binary floating‑point representation of – 76.1875 in this system.
Show your working.
Mantissa
Exponent
Working …
…
…
…
…
…
…
…
[4]
Ĭ×ú¾Ġ´íÈõÏĪÅĊàû¸þ×
Question text
1
The composite data type, Car, is defined in pseudocode as:
TYPE Car
DECLARE
RegNumber : STRING
DECLARE
Make : STRING
DECLARE
Model : STRING
DECLARE
BodyStyle : STRING
DECLARE
Colour : STRING
DECLARE
IntoStock : DATE
DECLARE
Price : REAL
ENDTYPE
(a) (i)
Write the pseudocode statement to set up a variable for one record of the composite
data type, Car.
…
… [1]
(ii)
Write the pseudocode statements to assign the following values to the variable set up in
part (a)(i):
•
"Blue" to Colour
•
21/10/2025 to IntoStock
…
…
…
… [2]
(b) The data type for BodyStyle is changed to an enumerated type, Body.
(i)
Write the pseudocode statement for the type declaration of Body to hold the names of
the available choices:
Convertible, Hatchback, Saloon, SUV
…
…
…
… [2]
(ii)
Write the new pseudocode statement required to update the declaration of BodyStyle
in the definition of Car.
…
… [1]
ĬÍĊ®Ġ´íÈõÏĪÅĊÞù¸þ×
Question text
2
Numbers are stored in a computer system 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 denary value of the given normalised binary floating-point number.
Show your working.
Mantissa
Exponent
0
1
1
1
1
0
0
1
0
1
0
0
1
0
1
1
Working …
…
…
…
…
Denary value …
[3]
(b) Calculate the normalised binary floating-point representation of +26.6875 in this system.
Show your working.
Mantissa
Exponent
Working …
…
…
…
…
…
[3]
ĬÏĊ®Ġ´íÈõÏĪÅĊÞû¸þ×
Question text
1
(a) An enumerated data type, Spectrum, is required to hold the names of colours.
(i)
Write the pseudocode statement for the type declaration of Spectrum to hold the
names of the colours available:
Red, Orange, Yellow, Green, Blue, Indigo, Violet.
…
… [2]
(ii)
Identify two characteristics of the list of values given in an enumerated data type
declaration.
1 …
…
2 …
…
[2]
(b) ColourData is a composite data type to store definitions of colours.
Write pseudocode statements to declare ColourData to hold the following fields:
Field
Example data
XYZ12345
ColourCode
Red
Colour
650
Wavelength
4.62
Frequency
Yes
PrimaryColour
Use the most appropriate data type in each case, including the enumerated data type
Spectrum from part a(i).
…
…
…
…
…
…
…
… [4]
ĬÕú¾Ġ´íÈõÏĪÅĊÝû·þ×
Question text
2
Numbers are stored in a computer system 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
•
2 bytes in total.
(a) Outline the effect of changing the number of bits used to store the mantissa to 10 bits, in this
system.
…
…
…
…
…
… [3]
(b) Describe one example of a situation that could cause an overflow to occur and the
consequences of such an overflow.
…
…
…
…
…
… [3]
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]
ĬÏĊ®Ġ´íÈõÏĪÅĊßû¸Ā×