Data representation: user-defined types, files and floating point – A Level Computer Science (9618)
60 questions · page 3 of 4
Question text
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 denary value of the given normalised floating-point number.
Show your working.
Mantissa
Exponent
0
1
0
0
1
1
1
1
0
0
0
0
1
0
0
1
Working …
…
…
…
…
Answer …
[3]
(b) Calculate the normalised floating-point representation of –102.75 in this system.
Show your working.
Mantissa
Exponent
Working …
…
…
…
…
…
[3]
Question text
3
(a) Explain what is meant by non-composite and composite data types.
…
…
…
…
…
… [3]
(b) Write pseudocode statements to declare the record data type FootballClub to hold data
about football clubs in a league, to include:
•
name of team
•
date team joined the league
•
main telephone number
•
name of the manager
•
number of members
•
current position in the league.
…
…
…
…
…
…
…
…
…
… [4]
Question text
4
(a) Describe the sequential method of file access.
…
…
…
… [2]
(b) Explain how the sequential method of file access is applied to files with serial organisation
and to files with sequential organisation.
…
…
…
…
…
… [3]
Question text
1
(a) Describe the effect of changing the allocation of bits used for the mantissa and for the
exponent in a floating-point number with a fixed total number of bits.
…
…
…
… [2]
(b) Real 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.
Calculate the normalised floating-point representation of +54.8125 in this system.
Show your working.
Mantissa
Exponent
Working …
…
…
…
…
… [3]
Question text
3
(a) Explain what is meant by the term non-composite data type and give an example of a
non-composite data type.
…
…
…
…
…
Example …
[3]
(b) Write pseudocode statements to declare the set data type EvenNumbers to hold this set of
even numbers between 2 and 12:
2, 4, 6, 8, 10, 12
…
…
…
…
…
…
…
… [4]
Question text
7
(a) Outline what is meant by direct access as a method of file access.
…
…
…
… [2]
(b) Explain how direct access is used to locate a specific record in sequential files and random
files.
(i)
Sequential files …
…
…
… [2]
(ii)
Random files …
…
…
… [2]
Question text
3
(a) Explain what is meant by non-composite and composite data types.
…
…
…
…
…
… [3]
,
,
(b) Write pseudocode statements to declare the record data type FootballClub to hold data
about football clubs in a league, to include:
•
name of team
•
date team joined the league
•
main telephone number
•
name of the manager
•
number of members
•
current position in the league.
…
…
…
…
…
…
…
…
…
… [4]
Question text
1
Real 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.
(a) Write the normalised floating-point representation of +65.25 in this system.
Show your working.
Mantissa
Exponent
Working …
…
…
…
…
… [3]
(b) Explain the problem that will occur in storing the normalised floating-point representation of
+65.20 in this system.
…
…
…
… [2]
Question text
3
Describe what is meant by enumerated and pointer data types.
Enumerated …
…
…
…
Pointer …
…
…
…
[4]
Question text
4
(a) Describe sequential and random methods of file organisation.
Sequential file organisation …
…
…
…
…
Random file organisation …
…
…
…
…
[4]
(b) Outline the process of sequential access for serial and sequential files.
…
…
…
… [2]
Question text
8
(a) A pseudocode algorithm finds a customer account record in a random file and outputs it. The
records are stored using the user-defined data type TAccount.
TYPE TAccount
DECLARE AccountNumber : INTEGER
DECLARE LastName : STRING
DECLARE FirstName : STRING
DECLARE Address : STRING
DECLARE ContactNumber : STRING
ENDTYPE
Complete the file handling pseudocode.
The function Hash() takes the customer account number as a parameter, calculates and
returns the hash value.
DECLARE Customer : TAccount
DECLARE Location : INTEGER
DECLARE AccountFile : STRING
…
"AccountRecords.dat"
… AccountFile …
OUTPUT "Please enter an account number"
INPUT Customer.AccountNumber
Hash( … )
Location
SEEK … , Location
… AccountFile, …
OUTPUT Customer
// output customer record
CLOSEFILE AccountFile
[5]
(b) Define the term exception handling.
…
… [1]
(c) State two possible causes of an exception.
…
… [2]
Question text
1
(a) Real 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 the exponent.
Write the normalised floating‑point representation of –96.75 in this system.
Show your working.
Mantissa
Exponent
Working …
…
…
…
…
…
[3]
(b) Explain why a binary representation is sometimes only an approximation to the real number it
represents.
…
…
…
…
…
… [3]
Question text
2
Describe what is meant by composite and non‑composite data types.
Composite …
…
…
…
Non‑composite …
…
…
…
[4]
Question text
3
The location of a record in a random file is determined using a hashing algorithm.
A collision may occur during the process of adding a record.
(a) Outline what is meant by the term collision in this context.
…
…
…
… [2]
(b) Explain how a collision can be dealt with when writing records to a random file.
…
…
…
…
…
… [3]
Question text
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]
(b) Explain the problem that occurred in part (a) when representing the number in system 2.
…
…
…
… [2]