[go: up one dir, main page]

0% found this document useful (0 votes)
18 views27 pages

1.4.1 Data Types

Descripción Escribe un resumen rápido: ¿De qué se trata este documento? ¿Dónde se originó? ¿Quién podría encontrar esta información útil? ¿Cuáles son los aspectos más destacados? Tu descripción debe tener un par de oraciones de largo. 0/100 Haz que tu documento sea fácil

Uploaded by

juanpuello220
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)
18 views27 pages

1.4.1 Data Types

Descripción Escribe un resumen rápido: ¿De qué se trata este documento? ¿Dónde se originó? ¿Quién podría encontrar esta información útil? ¿Cuáles son los aspectos más destacados? Tu descripción debe tener un par de oraciones de largo. 0/100 Haz que tu documento sea fácil

Uploaded by

juanpuello220
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/ 27

1(a). A supermarket uses a stock control system.

Details of products are stored on a stock database.

The quantity of a particular product in stock is stored as a binary number usingtwo bytes.
There are 312 tins of beans left in stock.

How would this quantity be represented as a binary number in the computer?

[2]
(b). The name of a product is stored using characters from the computer's character set.

(i) Explain what is meant by the character set of a computer.

[2]

(ii) Explain how codes are used to represent a character set.

[3]

© OCR 2019. You may photocopy this page. 1 of 27 Created in ExamBuilder


PhysicsAndMathsTutor.com
2(a). Convert the denary number 43 into an 8 bit binary number.

[1]
(b). Using binary subtraction, calculate your answer to the following. You must show your working.

[2]
(c). Using two’s complement convert the denary number −43 into an 8 bit binary number. You must show your
working.

[2]
(d).

(i) Using normalised floating point binary representation using 4 bits for the mantissa and 4 for the exponent,
represent the denary value 1.75. You must show your working.

[2]

(ii) Using normalised floating point binary representation using 4 bits for the mantissa and 4 for the exponent,
represent the denary value −1.75. You must show your working.

[2]

© OCR 2019. You may photocopy this page. 2 of 27 Created in ExamBuilder


PhysicsAndMathsTutor.com
3(a). Using the denary number 89 as an example, explain the relationship between binary and hexadecimal
representations.

[3]
(b).

(i) Change the denary number -89 into a two's complement, 8 bit binary number.

[1]

(ii) Change the denary number -72 into a two's complement, 8 bit binary number.

[1]

© OCR 2019. You may photocopy this page. 3 of 27 Created in ExamBuilder


PhysicsAndMathsTutor.com
(c).

(i) Add the two binary answers which you obtained, using 8 bit arithmetic.

You must show your working.

[2]

(ii) Explain why your answer to the addition sum is wrong.

[2]

© OCR 2019. You may photocopy this page. 4 of 27 Created in ExamBuilder


PhysicsAndMathsTutor.com
4(a). A Huffman code is a type of binary code where characters are represented by binary numbers of different
lengths. A possible Huffman code for a character set of four characters is:

A=0 B = 11 C = 100 D = 101


For example the word BAD would be represented by 110101.

State how the word CAB would be represented in this code.

[1]

The following algorithm takes a message as binary digits, one at a time, from a source and outputs the message
that is being transmitted.

(b). Explain the purpose of line 01.

[2]

© OCR 2019. You may photocopy this page. 5 of 27 Created in ExamBuilder


PhysicsAndMathsTutor.com
(c). State what the operation + does on line 04. State the name of this operation.

[2]

© OCR 2019. You may photocopy this page. 6 of 27 Created in ExamBuilder


PhysicsAndMathsTutor.com
(d).
The source of the message needs a routine to encode messages into the Huffman code. The routine should
allow the user to enter a message and output the encoded message.

Write this routine in a high level language you have studied, stating the name of the language you have used.
Yo u should use good program writing techniques to ensure that your routine is easy to understand.

You can assume that the message consists only of the characters A, B, C and D.

Name of language

Routine

[7]

© OCR 2019. You may photocopy this page. 7 of 27 Created in ExamBuilder


PhysicsAndMathsTutor.com
(e). Programming language environments provide several facilities for editing and debugging programs.

Name two of these facilities. Describe how each can be used when writing the routine in part (e).

[6]

© OCR 2019. You may photocopy this page. 8 of 27 Created in ExamBuilder


PhysicsAndMathsTutor.com
5(a). Give the number 55 in binary as an 8-bit unsigned integer.

[2]
(b). Represent the number 55 in normalised floating point binary notation, using 8 bits for the mantissa followed by 8
bits for the exponent, both in two's complement binary.

[2]
(c). Represent the number 55 in normalised floating point binary notation, with the mantissa and exponent both in
two's complement binary, using as few bits as possible.

[2]
(d). State why a programmer might choose to declare a variable as a floating point number.

[1]

© OCR 2019. You may photocopy this page. 9 of 27 Created in ExamBuilder


PhysicsAndMathsTutor.com
6. Asim is the head of a chess club. One of his jobs is to send out a monthly newsletter.

For the newsletter, club members send in descriptions of games they play using chess notation, which consist of
a sequence of symbols, letters and numbers. It is important that these descriptions are accurate.

One member sends in the description as a plain text file. The text file is saved using Unicode, an extract of which
is shown below.

(i) Explain what is meant by the term ‘Unicode’.

[3]

When Asim opens this file on the text editor on his computer it looks as below.

(ii) Explain why the text may not be displaying correctly.

[2]

© OCR 2019. You may photocopy this page. 10 of 27 Created in ExamBuilder


PhysicsAndMathsTutor.com
7. Express the denary number –43 in binary using 8-bit two's complement representation.

Show your working.

[4]

© OCR 2019. You may photocopy this page. 11 of 27 Created in ExamBuilder


PhysicsAndMathsTutor.com
8(a).
Convert the binary number 01101111 to a hexadecimal number.

[1]

(b). Convert the denary number −19 to an 8-bit number using:

(i) Two’s complement representation.

[1]

(ii) Sign and Magnitude representation.

[1]

(c). The two values below are stored using unsigned binary. Calculate the subtraction of 01110010 from 11000011.
Show your working.

[2]

© OCR 2019. You may photocopy this page. 12 of 27 Created in ExamBuilder


PhysicsAndMathsTutor.com
(d). Convert the denary number 15/8 (i.e. 1.625) to a normalised floating point binary number using 5 bits for the
mantissa and 3 bits for the exponent. Show your working.

[3]

© OCR 2019. You may photocopy this page. 13 of 27 Created in ExamBuilder


PhysicsAndMathsTutor.com
9(a).
Convert the denary number 72 to an unsigned 8-bit integer.

[1]

(b). Convert the unsigned binary number 10000101 to denary.

[1]

(c). Convert the denary number 104 to hexadecimal.

[1]

© OCR 2019. You may photocopy this page. 14 of 27 Created in ExamBuilder


PhysicsAndMathsTutor.com
(d). The following floating point binary number is represented using 7 bits for the mantissa and 4 bits for the
exponent, both using two’s complement.

Mantissa Exponent
0100101 0100

Convert the number to denary, showing your working.

[3]

(e). Given that computers store everything in binary, explain how they are able to represent text.

[2]

END OF QUESTION PAPER

© OCR 2019. You may photocopy this page. 15 of 27 Created in ExamBuilder


PhysicsAndMathsTutor.com
Question Answer/Indicative content Marks Guidance

1 a 0000000100111000 2 1 for correct binary, 1 for 16 digits.

Examiner's Comments

The question did state that a binary


number was required, this means that the
relatively common answer of using two
8-bit binary numbers that add up to 312
was not an answer to the question as set.
It was odd to see so many responses that
gave the 16 bit, 2's complement version of
–312

b i Normally equates to the symbols on a 2 Not: Stored on a computer


keyboard / digits / letters…
…that can be represented / interpreted
/ understood by a computer
May include control characters

ii Each symbol has a (binary) code / 3


number… Examiner's Comments
…which is unique.
Number of bits used for one character Many candidates adopted a scatter gun
= 1 byte approach to this pair of questions, inserting
Example code: ASCII / Unicode… the facts that they knew about character
…uses 8 bits /16 bits per character sets seemingly at random between the two
Use of more bits for extended parts.
character set Despite this most scored well here and
some candidates gave clear and well-
presented responses to both parts.

Total 7

2 a 00101011 1 For 1 mark.

b 00011010 2 For 2 marks.

1 mark for correct answer plus an


additional method mark for showing
borrowed bits.

No method mark for converting numbers to


denary performing subtraction and
converting back to binary.

Allow full marks for converting second


number to two’s complement and
performing addition.

c 11010101 2 For 2 marks – showing valid method 1


mark.

© OCR 2019. You may photocopy this page. 16 of 27 Created in ExamBuilder


PhysicsAndMathsTutor.com
Question Answer/Indicative content Marks Guidance

d i 0111 0001 2 For 2 marks – 1 mark for mantissa 1 mark


for exponent.

ii 1001 0001 2 For 2 marks – 1 mark for mantissa 1 mark


for exponent.

Total 9

© OCR 2019. You may photocopy this page. 17 of 27 Created in ExamBuilder


PhysicsAndMathsTutor.com
Question Answer/Indicative content Marks Guidance

3 a –Split the binary number in groups of 4 3


–Change each into a single Examiner's Comments
value/(Hexadecimal) digit
–Digits which are between 10 and 15 are Candidates who answered this question by
given letters A to F demonstration, scored well. Those who
–In this example: 0101 = 5 and 1001 = tried to describe the process using prose
9/Therefore 89 = 59(hex) invariably lacked clarity and therefore did
not achieve full credit.

(1 per –, max 3)

b i 10100111 1
Examiner's Comments

Most candidates correctly converted from


denary to two's complement.

ii 10111000 1
Examiner's Comments

Most candidates correctly converted from


denary to two's complement.

c i 2 Note: follow through from candidate


answers to previous part

If ft answer generates no carries – max. 1


mark

(1 for 8 bit correct answer, 1 for showing Examiner's Comments


appropriate correct carries)
For the most part, those candidates with
correct answers for the previous question
parts produced correct answers for this but
some did not gain credit for an 8 bit answer
because they did not evidently discard the
9th carry bit.

ii –Answer needs 9 bits / Carry / overflow out 2 NOT simply "overflow"


of 8 bit byte
–Two negative numbers have been added Examiner's Comments
and the result is a positive number
–Answer is 95 Most candidates gained some credit for
identifying the need for 9 bits or the
discarded bit producing a positive answer.
(1 per –, max 2) Few candidates gained maximum credit
with some candidates stating that sign and
magnitude should be used for binary
subtraction.

© OCR 2019. You may photocopy this page. 18 of 27 Created in ExamBuilder


PhysicsAndMathsTutor.com
Question Answer/Indicative content Marks Guidance

Total 9

© OCR 2019. You may photocopy this page. 19 of 27 Created in ExamBuilder


PhysicsAndMathsTutor.com
Question Answer/Indicative content Marks Guidance

4 a 100011 1
Examiner's Comments

Almost all candidates achieved this mark

b Initialise the value of d (to the empty 2


string) Examiner's Comments
Before it gets used in line 04 / as it may
already contain a value/ to give it a Many good answers given, with most
starting value candidates gaining at least 1 mark,
although some candidates only stated “it
sets d to a null value”.

c Joins the strings d and x into one string 2 Allow append


Concatenation operator Do not accept ‘add’

Examiner's Comments

This was poorly understood by many


candidates. Most thinking it was a
mathematical addition, and unfortunately
not realising that the variables were
strings.

© OCR 2019. You may photocopy this page. 20 of 27 Created in ExamBuilder


PhysicsAndMathsTutor.com
Question Answer/Indicative content Marks Guidance

d Example (in pseudocode): 7 Cannot access bullet points 2, 3 & 5


without a loop

Allow for python's use of “str.replace”

Examiner's Comments

Those that did poorly on this question


showed a lack of understanding about the
difference between the variable A and the
string literal “A”. It was a shame that some
candidates also missed out on marks for
not inputting/passing the “message” in and
the indentation of their code. Python
seems to be the most common language
used but the syntax was not always used
correctly.

Award up to 5 marks for the algorithm:

INPUT message
Uses a loop
… to correctly visit each character
Replaces “A”, “B”, “C” and “D” with
correct code
Outputs the result

Award up to 2 marks for style

Meaningful identifiers
Commenting
Indenting

© OCR 2019. You may photocopy this page. 21 of 27 Created in ExamBuilder


PhysicsAndMathsTutor.com
Question Answer/Indicative content Marks Guidance

e eg 6 Not dry running / trace tables

Translator Diagnostics Steping


reports when syntax errors are made Executes each line in turn
and suggests solutions / example from
code
Breakpoints To allow checking of path(s)/values
Allows the code to stop at chosen point
To check variables / example from (Variable) watch
code To monitor the status of variables (and
objects)…
Award one mark for each correctly named … as you step through code / as they
facility, and up to two marks for the change
description.
Examiner's Comments

Translator Diagnostics, Breakpoints and


watches were generally well known but not
always expressed clearly. With
breakpoints, for example, most got the
point of stopping execution at a statement
but then just said “to find the error” rather
than checking variable values to see if they
matched expected values. In the case
stepping it was not always clear if they
were describing dry running or stepping.

Total 18

© OCR 2019. You may photocopy this page. 22 of 27 Created in ExamBuilder


PhysicsAndMathsTutor.com
Question Answer/Indicative content Marks Guidance

5 a 00110111 2
(1 mark per nibble) Examiner's Comments

This question was well answered, with


most candidates achieving full marks.

b 01101110 00000110 2
Examiner's Comments
(1 mark for mantissa, 1 for exponent)
Few candidates achieved full marks on this
question. Many represented a normalised
floating point mantissa with two of the
same bit at the start.

c 0110111 0110 2
Examiner's Comments
(1 mark for mantissa, 1 for exponent)
Few candidates achieved full marks on this
question. Many reduced the number of bits
by deleting the leading zero's, rendering
the result negative.

d The variable may need to store 1 Max. 1 mark


decimal numbers.
To store very large / small values. Examiner's Comments

This question was reasonably well


answered, with many candidates achieving
the mark.

Total 7

© OCR 2019. You may photocopy this page. 23 of 27 Created in ExamBuilder


PhysicsAndMathsTutor.com
Question Answer/Indicative content Marks Guidance

6 i Three of: 3 Accept each character is represented by


1byte / 2 bytes / 4bytes (or equivalent
value in bits) for BP 3
□ Unicode is a character set [1]
□ Mapping different binary values to Examiner's Comments
characters (on the screen).[1]
□ Each character is represented by 1-4 Many candidates' explanations lacked
bytes. [1] clarity. Although most did state that
□ It supports a very large number of Unicode was a character set.
characters [1]
□ It is backward compatible with ASCII
[1]

ii □ Asim's text editor may only support 2 Question states plain text file so no credit
ASCII which doesn't include characters for mention of missing graphics files.
for the chess piece [1]
□ Cannot recognize / understand the Examiner's Comments
binary values of the two pieces [1]
Few candidates referred to the codes that
OR represent the symbols in their
explanations, more so referring to the
symbols themselves which did not gain
□ Asim may be using a font which credit.
doesn't include a representation for the
chess pieces… [1]
□ …and so those characters can't be
represented. [1]

Total 5

© OCR 2019. You may photocopy this page. 24 of 27 Created in ExamBuilder


PhysicsAndMathsTutor.com
Question Answer/Indicative content Marks Guidance

7 Method [3 marks] 4
Examiner's Comments

□ Treat left most bit as negative value These questions were well answered, with
(e.g. –128) [1] many candidates achieving full marks.
□ Treat remaining bits as positive However, some candidates lost marks for
values [1] simple arithmetic errors. Candidates
□ Total them the relevant placeholder should be reminded to thoroughly check
values. [1] their responses.

OR

□ Work out the positive equivalent in


binary [1]
□ From the right, working left copy
down all the bits up to and including
the first 1 [1]
□ Flip the remaining bits [1]

OR

□ Work out the positive equivalent in


binary [1]
□ Take the one's complement (e.g. flip
the bits) [1]
□ Add one [1]

Answer [1 mark]

11010101 [1]

Total 4

© OCR 2019. You may photocopy this page. 25 of 27 Created in ExamBuilder


PhysicsAndMathsTutor.com
Question Answer/Indicative content Marks Guidance

8 a 6F 1

AO2.1
Examiner’s Comment
Very well answered by the majority of
candidates.

b i 11101101 1

AO2.1

ii 10010011 1

AO2.1
Examiner’s Comment
Very well answered by the majority of
candidates.

c 2 NB some candidates represent carries with


10 as binary 2 rather than 2
AO2.1 Accept answer with missing leading zero.

1 Mark for answer

1 Mark for showing working using


appropriate binary method.
Examiner’s Comment
Well answered although candidates were
required to show their binary working.

d 15/8 is 1.101 in fixed point (1 Mark) 3

binary point needs moving one place giving AO2.1

01101 001

One mark for Mantissa 01101

One mark for exponent 001 Examiner’s Comment


Again, this question was generally well
answered with most candidates showing
clear and logical workings.

Total 8

© OCR 2019. You may photocopy this page. 26 of 27 Created in ExamBuilder


PhysicsAndMathsTutor.com
Question Answer/Indicative content Marks Guidance

9 a 01001000 1

AO1.2
(1)

b 133 1

AO1.2
(1)

c 68 1
AO1.2 Examiner’s Comments
(1)
A significant number of candidates
achieved all three available marks across
the first three parts of this question.

d - Exponent is 4 3 Accept any other method if working is


- Move binary point 4 places to the right shown
- Answer is: 9.25 AO1.2
(1 per -, max 3) (3)
Examiner’s Comments

This question was well attempted by most


candidates. The methods used were
invariably, clearly shown.

e - Computers use a character set/ASCII/ 2


UNICODE
- To map binary values to characters AO1.1
- Each character is represented by a (2)
unique value
(1 per -, max 2) Examiner’s Comments

Most candidates achieved both available


marks. With the majority describing ASCII.

Total 8

© OCR 2019. You may photocopy this page. 27 of 27 Created in ExamBuilder


PhysicsAndMathsTutor.com

Powered by TCPDF (www.tcpdf.org)

You might also like