Data representation: user-defined types, files and floating point – A Level Computer Science (old syllabus, to 2021) (9608)

30 questions · page 1 of 2

0 / 0Answer a question to start your score.
Quick quiz (10)Saved 0
Advertisement
1
9608/31/O/N/21 · Question 1Oct/Nov 2021Paper 317 marks
Loading question…
Question text

1
Data types can be defined using pseudocode.
The data type, ComputerRecord, is defined by the following pseudocode:
TYPE ComputerRecord
DECLARE ComputerID
: INTEGER
DECLARE ComputerType
: (Laptop, Desktop, Tablet)
DECLARE ComputerLocation : (Lab1, Lab2, Lab3, Mobile)
DECLARE DateTested
: DATE
ENDTYPE
A variable, SchoolComputer, is declared in pseudocode as:
DECLARE SchoolComputer : ComputerRecord
(a) Write pseudocode statements to assign 1234 to the ComputerID of SchoolComputer
and Lab2 to the ComputerLocation of SchoolComputer.
…
… [2]
(b) The type definition for ComputerRecord is changed.
(i)
The definition has been extended to include the student identification numbers,
StudentID, for up to 20 students who can use that computer. Each student identification
number is an integer.
Write the extra line of pseudocode needed in the type definition for ComputerRecord.
…
… [1]
(ii)
The values for the field ComputerID must be between 1000 and 1999 inclusive.
Rewrite one pseudocode line from the type definition of ComputerRecord to implement
the change.
…
… [1]
(c) Data about all the computers are stored in a file that uses random file organisation.
ComputerID is used as the key field.
Explain how a program could search for a record stored in this file.
…
…
…
…
…
… [3]

2
9608/32/O/N/21 · Question 1Oct/Nov 2021Paper 327 marks
Loading question…
Question text

1
Data types can be defined using pseudocode.
The data type, BicycleRecord, is defined in pseudocode as:
TYPE BicycleRecord
DECLARE BicycleID
:
INTEGER
DECLARE BicycleAvailable :
BOOLEAN
DECLARE BicycleLocation : (RiverSide, BusStation, TrainStation,
TownSquare, Library)
DECLARE DateChecked
:
DATE
ENDTYPE
A variable, LoanBicycle, is declared in pseudocode as:
DECLARE LoanBicycle : BicycleRecord
(a) Write pseudocode statements to assign 567 to the BicycleID of LoanBicycle and
FALSE to the BicycleAvailable of LoanBicycle.
…
… [2]
(b) The type definition for BicycleRecord is changed.
(i)
The definition has been extended to include borrower identification numbers,
BorrowerID, for the last 10 people who borrowed a bicycle. Each identification number
is an integer.
Write the pseudocode statement needed in the type definition of BicycleRecord.
…
… [1]
(ii)
The values for the field BicycleID must be between 500 and 599 inclusive.
Rewrite one pseudocode line from the type definition of BicycleRecord to implement
the change.
…
… [1]
(c) Data about all the bicycles are stored in a file that uses random file organisation.
BicycleID is used as the key field.
Explain how a program could add an extra record to this file.
…
…
…
…
…
… [3]

3
9608/31/O/N/20 · Question 1Oct/Nov 2020Paper 317 marks
Loading question…
Question text

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]

Advertisement
4
9608/31/O/N/20 · Question 2Oct/Nov 2020Paper 318 marks
Loading question…
Question text

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]

5
9608/32/O/N/20 · Question 1Oct/Nov 2020Paper 328 marks
Loading question…
Question text

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]
(ii)
Identify two problems that can occur due to the change in the representation of the
floating-point number.
Problem 1 …
…
Problem 2 …
…
[2]

6
9608/32/O/N/20 · Question 2Oct/Nov 2020Paper 326 marks
Loading question…
Question text

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]

7
9608/31/M/J/20 · Question 1May/June 2020Paper 319 marks
Loading question…
Question text

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]
(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]

8
9608/31/M/J/20 · Question 2May/June 2020Paper 314 marks
Loading question…
Question text

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]

Advertisement
9
9608/31/O/N/19 · Question 1Oct/Nov 2019Paper 3110 marks
Loading question…
Question text

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.
Two’s complement form is used for both the mantissa and 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)
Calculate the normalised binary number for −3.75. Show your working.
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]
(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]

10
9608/31/O/N/19 · Question 5Oct/Nov 2019Paper 3110 marks
Loading question…
Question text

5
(a) Explain why user-defined data types are necessary.
…
…
…
… [2]
(b) An organisation stores data about its employees.
•
Employee ID is a five-digit number, for example, 01234.
•
Employee name is a string, for example, ‘Kiri Moana’.
•
Department is one of three values: Sales, Technical, Customer services.
•
Salary is an integer value in the range 25 000 to 150 000.
(i)
Complete the following pseudocode definition of a user-defined data type to store the
employee data.
TYPE Employee
…
DECLARE EmployeeID
:
DECLARE EmployeeName :
STRING
( …
DECLARE Department
:
… )
DECLARE Salary
:
25000..150000
…
[4]
(ii)
Write a pseudocode statement to declare a variable, NewEmployee of data type
Employee.
…
… [1]
(iii)
Write a pseudocode statement that assigns 02244 to the EmployeeID of
NewEmployee.
…
… [1]
(iv)
Employee is an example of a record that is a composite data type.
State two other composite data types.
1 …
2 …
[2]

11
9608/31/O/N/19 · Question 9Oct/Nov 2019Paper 317 marks
Loading question…
Question text

9
(a) The following incomplete table shows descriptions relating to computer architectures.
Complete the table by inserting the appropriate terms.
Description
Term
• There are several processors.
A
• Each processor executes different sets of instructions …
on one set of data at the same time.
• The processor has several ALUs.
B
• Each ALU executes the same set of instructions on …
different sets of data at the same time.
• There is only one processor.
C
• The processor executes one set of instructions on one …
set of data.
• There are several processors.
D
• Each processor executes a different set of instructions. …
• Each processor operates on different sets of data.
[4]
(b) State three characteristics of massively parallel computers.
1 …
…
2 …
…
3 …
…
[3]
Permission to reproduce items where third-party owned material protected by copyright is included has been sought and cleared where possible. Every
publisher will be pleased to make amends at the earliest possible opportunity.
To avoid the issue of disclosure of answer-related information to candidates, all copyright acknowledgements are reproduced online in the Cambridge
Assessment International Education Copyright Acknowledgements Booklet. This is produced for each series of examinations and is freely available to download
at www.cambridgeinternational.org after the live examination series.
Cambridge Assessment International Education is part of the Cambridge Assessment Group. Cambridge Assessment is the brand name of the University of

12
9608/32/O/N/19 · Question 5Oct/Nov 2019Paper 3210 marks
Loading question…
Question text

5
A weather station uses monitoring and control systems.
(a) Describe the difference between a monitoring system and a control system.
…
…
…
… [2]
(b) (i)
The weather station records how the outside temperature changes over a period of time.
The system will read the temperature once every hour, over a period of 100 days.
The temperature readings are automatically stored in a file. No other data are stored.
Explain why the weather station has decided to use serial organisation for the file.
…
…
…
… [2]
(ii)
Serial files can be accessed using sequential access.
Explain how sequential access could be used for the temperature readings file.
…
…
…
… [2]
(iii)
Name and describe a method of file organisation other than serial or sequential.
Method …
Description …
…
…
…
…
…
[4]

13
9608/32/O/N/19 · Question 6Oct/Nov 2019Paper 325 marks
Loading question…
Question text

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]

Advertisement
14
9608/32/O/N/19 · Question 8Oct/Nov 2019Paper 329 marks
Loading question…
Question text

8
(a) The following 16-bit binary pattern represents a floating-point number stored in two’s
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]
(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]
Permission to reproduce items where third-party owned material protected by copyright is included has been sought and cleared where possible. Every
publisher will be pleased to make amends at the earliest possible opportunity.
To avoid the issue of disclosure of answer-related information to candidates, all copyright acknowledgements are reproduced online in the Cambridge
Assessment International Education Copyright Acknowledgements Booklet. This is produced for each series of examinations and is freely available to download
at www.cambridgeinternational.org after the live examination series.
Cambridge Assessment International Education is part of the Cambridge Assessment Group. Cambridge Assessment is the brand name of the University of

15
9608/31/M/J/19 · Question 1May/June 2019Paper 3113 marks
Loading question…
Question text

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.
The mantissa and exponent are both in two’s complement form.
(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]
(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]

Advertisement