100% found this document useful (1 vote)
116 views57 pages

Cambridge International AS and A Level Computer Science Coursebook 2nd Edition Sylvia Langfield - The ebook in PDF format with all chapters is ready for download

The document provides information about various educational resources available for Cambridge International AS and A Level courses, including textbooks on subjects such as Computer Science, Marine Science, Chemistry, and History. It highlights the structure and content of the Computer Science Coursebook, emphasizing its alignment with the syllabus and the inclusion of key concepts like computational thinking and programming paradigms. Additionally, it outlines the features of the textbook designed to aid student learning, such as learning objectives, tasks, and worked examples.

Uploaded by

fofoetangim
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
100% found this document useful (1 vote)
116 views57 pages

Cambridge International AS and A Level Computer Science Coursebook 2nd Edition Sylvia Langfield - The ebook in PDF format with all chapters is ready for download

The document provides information about various educational resources available for Cambridge International AS and A Level courses, including textbooks on subjects such as Computer Science, Marine Science, Chemistry, and History. It highlights the structure and content of the Computer Science Coursebook, emphasizing its alignment with the syllabus and the inclusion of key concepts like computational thinking and programming paradigms. Additionally, it outlines the features of the textbook designed to aid student learning, such as learning objectives, tasks, and worked examples.

Uploaded by

fofoetangim
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/ 57

Explore the full ebook collection and download it now at textbookfull.

com

Cambridge International AS and A Level Computer


Science Coursebook 2nd Edition Sylvia Langfield

https://textbookfull.com/product/cambridge-international-as-
and-a-level-computer-science-coursebook-2nd-edition-sylvia-
langfield/

OR CLICK HERE

DOWLOAD EBOOK

Browse and Get More Ebook Downloads Instantly at https://textbookfull.com


Click here to visit textbookfull.com and download textbook now
Your digital treasures (PDF, ePub, MOBI) await
Download instantly and pick your perfect format...

Read anywhere, anytime, on any device!

Marine Science for Cambridge International AS A Level


Coursebook 2nd Edition Matthew Parkin

https://textbookfull.com/product/marine-science-for-cambridge-
international-as-a-level-coursebook-2nd-edition-matthew-parkin/

textbookfull.com

Cambridge International AS and A Level Chemistry


Coursebook Lawrie Ryan

https://textbookfull.com/product/cambridge-international-as-and-a-
level-chemistry-coursebook-lawrie-ryan/

textbookfull.com

Cambridge International AS Level History International


History 1870 1945 Coursebook 2nd Edition Phil Wadsworth

https://textbookfull.com/product/cambridge-international-as-level-
history-international-history-1870-1945-coursebook-2nd-edition-phil-
wadsworth/
textbookfull.com

Cambridge International AS Level History Modern Europe


1750 1921 Coursebook 2nd Edition Graham Goodlad

https://textbookfull.com/product/cambridge-international-as-level-
history-modern-europe-1750-1921-coursebook-2nd-edition-graham-goodlad/

textbookfull.com
Cambridge International AS A Level Marine Science Workbook
2nd Edition Matthew Parkin

https://textbookfull.com/product/cambridge-international-as-a-level-
marine-science-workbook-2nd-edition-matthew-parkin/

textbookfull.com

Cambridge International AS Level History The History of


the USA 1820 1941 Coursebook 2nd Edition Pete Browning

https://textbookfull.com/product/cambridge-international-as-level-
history-the-history-of-the-usa-1820-1941-coursebook-2nd-edition-pete-
browning/
textbookfull.com

Cambridge International AS & A Level Chemistry Coursebook


with Digital Access (2 Years) 3rd Edition Lawrie Ryan

https://textbookfull.com/product/cambridge-international-as-a-level-
chemistry-coursebook-with-digital-access-2-years-3rd-edition-lawrie-
ryan/
textbookfull.com

Cambridge International AS & A Level Physics Coursebook


with Digital Access (2 Years) 3rd Edition David Sang

https://textbookfull.com/product/cambridge-international-as-a-level-
physics-coursebook-with-digital-access-2-years-3rd-edition-david-sang/

textbookfull.com

Cambridge IGCSE Arabic as a First Language Coursebook


Cambridge International IGCSE Abdul Hameed

https://textbookfull.com/product/cambridge-igcse-arabic-as-a-first-
language-coursebook-cambridge-international-igcse-abdul-hameed/

textbookfull.com
Computer Science
for Cambridge International AS & A Level

Sylvia Langfield & Dave Duddell


Contents

Part 1: Theory fundamentals


Chapter 1 Information representation
Chapter 2 Communication and networking technologies

Chapter 3 Hardware

Chapter 4 Logic gates and logic circuits


Chapter 5 Processor fundamentals

Chapter 6 Assembly language programming

Chapter 7 Monitoring and control systems

Chapter 8 System software


Chapter 9 Security, privacy and data integrity
Chapter 10 Ethics and ownership

Chapter 11 Databases

Part 2: Fundamental problem-solving and programming skills


Chapter 12 Algorithm design and problem-solving
Chapter 13 Data types and structures

Chapter 14 Programming and data representation


Chapter 15 Software development

Part 3: Advanced theory


Chapter 16 Data representation
Chapter 17 Communication and Internet technologies
Chapter 18 Hardware and virtual machines

Chapter 19 Logic circuits and Boolean algebra

Chapter 20 System software

Chapter 21 Security

Chapter 22 Artificial Intelligence (AI)

Part 4: Further problem-solving and programming skills


Chapter 23 Algorithms

Chapter 24 Recursion

Chapter 25 Programming paradigms

Chapter 26 File processing and exception handling


Chapter 27 Object-oriented programming (OOP)

Chapter 28 Low-level programming


Chapter 29 Declarative programming

Acknowledgements
Introduction

This full-colour, illustrated textbook has been written by experienced authors specifically for the
Cambridge International AS & A Level Computer Science syllabus (9618) for examination from 2021. It
is based on the first edition by the same authors for the previous Cambridge International AS & A Level
Computer Science syllabus (9608). There are substantial changes, the most important being the
inclusion of the topic of Artificial Intelligence (See Chapter 22) and the replacement of the Pascal
programming language by the Java programming language.

The presentation of the chapters in this book reflects the content of the syllabus:

The book is divided into four parts, each of which is closely matched to the corresponding part of
the syllabus.
Each chapter defines a set of learning objectives which closely match the learning objectives set out
in the syllabus.
The chapters in Parts 1 and 3 have been written with emphasis on the promotion of knowledge and
understanding. The chapters in Parts 2 and 4 have been written with an emphasis on problem
solving and programming.

The key concepts for Cambridge International AS & A Level Computer Science are:

Computational thinking
Computational thinking is a set of skills such as abstraction, decomposition and algorithmic thinking.
Chapter 12 (Algorithm design and problem-solving), Chapter 15 (Software development) and Chapter
23 (Algorithms) concentrate on this key concept.

Programming paradigms
A programming paradigm is a way of thinking about or approaching problems. Most of the
programming in this book follows the imperative (procedural) paradigm. Chapter 25 (Programming
paradigms) gives an overview of other paradigms, while Chapter 6 (Assembly language programming),
Chapter 28 (Low-level programming), Chapter 27 (Object Oriented Programming) and Chapter 29
(Declarative programming) give an insight into these paradigms.

Communication
Communication in this context ranges from the internal transfer of data within a computer system to
the transfer of data across the internet. See Chapter 2 (Communication and networking technologies)
and Chapter 17 (Communication and internet technologies).

Computer architecture and hardware


Computer architecture is the design of the internal operation of a computer system. Computer systems
consist of hardware (internal components and peripherals) and software that makes the hardware
functional. See Chapter 3 (Hardware), Chapter 4 (Logic gates and logic circuits), Chapter 8 (System
software), Chapter 18 (Hardware and virtual machines), Chapter 19 (Logic circuits and Boolean
algebra) and Chapter 20 (System software).

Data representation and structures


An understanding of binary numbers and how they can be interpreted in different ways is covered in
Chapter 1 (Information representation) and Chapter 16 (Data representation). Chapter 11 covers
databases. Chapter 13 (Data types and structures) and Chapter 14 (Programming and data
representation) show how data can be organised for efficient use and storage.
The chapters in Parts 1 and 3 have a narrative which involve a number of interdependent topics. We
would encourage learners to read the whole chapter first before going back to revisit the individual
sections.
The chapters in Parts 2 and 4 contain many more tasks. We would encourage learners to approach
these chapters step-by-step. Whenever a task is presented, this should be carried out before
progressing further.
In particular, Chapter 12 (Algorithm design and problem-solving) may be worked through in parallel
with Chapter 14 (Programming and data representation). For example, Task 14.03 is based on Worked
Example 12.03. After studying this worked example, learners may wish to cover the first part of
Chapter 14 and write the program for Task 14.03. This will give the learner the opportunity to test their
understanding of an algorithm by implementing it in their chosen programming language. Then further
study of Chapter 12 is recommended before attempting further tasks in Chapter 14.
How to use this book

This book contains a number of features to help you in your study.

Learning objectives – each chapter


begins with a short list of the learning
objectives and concepts that are
explained in it.

Task –
exercises for
you to test your
skills.

Question – questions for you


to test your knowledge and
understanding.

Discussion Point – discussion points intended for class


discussion.

Reflection Point – opportunities for you to check your


understanding of the topic that has just been covered.

Extension Question – extended questions for consideration of more advanced aspects or topics
beyond the immediate scope of the Cambridge International AS & A Level syllabus.

Worked Example – step-by-step examples of solving problems


or implementing specific techniques.

Tip – quick
notes to
highlight
key facts
and
important
points.

Summary – these appear at


the end of each chapter to
help you review what you
have learned

Exam-style Questions – these


aim to test your skills, knowledge
and understanding using exam-
style questioning.
Part 1
Theory fundamentals
Chapter 1:
Information representation
1.01 Number systems
Denary numbers
As a child we first encounter the numbers that we use in everyday life when we are learning to count.
Specifically, we learn to count using 1, 2, 3, 4, 5, 6, 7, 8, 9, 10. This gives us ten different symbols to
represent each individual digit. This is therefore a base-10 number system. Numbers in this system are
called denary numbers or, more traditionally, decimal numbers.
When a number is written down the value that it represents is defined by the place values of the digits
in the number. This can be illustrated by considering the denary number 346 which is interpreted as
shown in Table 1.01.

Place value 102 = 100 101 = 10 100 = 1

Digit 3 4 6

Product of digit and place value 300 40 6

Table 1.01 Use of place values in the representation of a denary number

You can see that starting from the right-hand end of the number (which holds the least significant digit),
the place value increases by the power of the base number.

Binary numbers
The binary number system is base-2. Each binary digit is written with either of the symbols 0 and 1. A
binary digit is referred to as a bit.

As with a denary number, the value of a binary number is defined by place values. For example, see
Table 1.02 for the binary number 101110.

Place value 25 = 32 24 = 16 23 = 8 22 = 4 21 = 2 20 = 1

Digit 1 0 1 1 1 0

Product of digit and place


32 8 4 2 0
value

Table 1.02 Use of place values in the representation of a binary number

By adding up the values in the bottom row you can see that the binary number 101110 has a value
which is equivalent to the denary number 46.

You must be able to use the binary number system in order to understand computer systems. This is
because inside computer systems there is no attempt made to represent ten different digits individually.
Instead, all computer technology is engineered with components that represent or recognise only two
states: ‘on’ and ‘off’. To match this, all software used by the hardware uses binary codes which consist
of bits. The binary code may represent a binary number but this does not have to be the case.

Binary codes are most often based on the use of one or more groups of eight bits. A group of eight bits
is called a byte.

Hexadecimal numbers
These are base-16 numbers where each hexadecimal digit is represented by one of the following
symbols: 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F. The symbols A through to F represent the denary values 10
through to 15. The value of a number is defined by place values. For example, see Table 1.03 for the
hexadecimal number 2A6.

Place value 162 = 256 161 = 16 160 = 1

Digit 2 A 6
Product of digit and place value 512 160 6

Table 1.03 Use of place values in the representation of a hexadecimal number

Adding up the values in the bottom row shows that the equivalent denary number is 678.

In order to explain why hexadecimal numbers are used we need first to define the nibble as a group of
four bits.

A nibble can be represented by one hexadecimal digit. This means that each byte of binary code can be
written as two hexadecimal digits. Two examples are shown in Table 1.04 together with their denary
equivalent.

Binary Hexadecimal Denary

00001010 0A 10

11111111 FF 255

Table 1.04 Examples of a byte represented by two hexadecimal digits

Note here that if you were converting the binary number 1010 to a hexadecimal number as an exercise
on a piece of paper you would not bother with including leading zeros. However, a binary code must not
include blanks; all positions in the byte must have either a 0 or a 1. This is followed through in the
hexadecimal representation.
One example when you will see hexadecimal representations of bytes is when an error has occurred
during the execution of a program. A memory dump could be provided which has a hexadecimal
representation of the content of some chosen part of the memory. Another use is when the bytes contain
binary numbers in the charts that define character codes. This is discussed later in this chapter.

In the character code charts and in other online sources you may see references to octal numbers which
are base-8. You can ignore these.

Converting between binary and denary numbers


One method for converting a binary number to a denary number is to add up the place values for every
digit that has a value 1. This was illustrated in Table 1.02.

An alternative method is shown in Worked Example 1.01.

WORKED EXAMPLE 1.01

To carry out the conversion you start at the most significant bit and successively multiply by two
and add the result to the next digit. The following shows the method being used to convert the
binary number 11001 to the denary number 25:

1 × 2 = 2

add 2 to 1, then 2 × 3 = 6

add 6 to 0, then 2 × 6 = 12

add 12 to 0, then 2 × 12 = 24

add 24 to 1 to give 25.

To convert a denary number to binary begin by identifying the largest power of 2 that has a value less
than the denary number. You can then write down the binary representation of this power of 2 value.
This will be a 1 followed by the appropriate number of zeros.
Now subtract the power of two value from the denary number. Then identify the largest power of 2
value that is less than the remainder from the subtraction. You can now replace a zero in the binary
representation with a 1 for this new power of 2 position.
Repeat this process until you have accounted for the full denary number.
For example, for the denary number 78 the largest power of two value less than this is 64 so you can
start by writing down 1000000. The remainder after subtracting 64 from 78 is 14. The largest power of
two value less than this is 8 so the replacement of a zero by 1 gives 1001000. Repeating the process
finds values of 4 then 2 so the final answer is 1001110.
An alternative approach is shown in Worked Example 1.02.

WORKED EXAMPLE 1.02

A useful way to convert a denary value to its binary equivalent is the procedure of successive
division by two with the remainder written down at each stage. The converted number is then
given as the set of remainders in reverse order.
This can be illustrated by the conversion of denary 246 to binary:

246 ÷ 2 → 123 with remainder 0

123 ÷ 2 → 61 with remainder 1

61 ÷ 2 → 30 with remainder 1

30 ÷ 2 → 15 with remainder 0

15 ÷ 2 → 7 with remainder 1

7 ÷ 2 → 3 with remainder 1

3 ÷ 2 → 1 with remainder 1

1 ÷ 2 → 0 with remainder 1

Thus, the binary equivalent of denary 246 is 11110110.

TIP
To check that an answer with eight bits is sensible, remember that the maximum denary
value possible in seven bits is 27 – 1 which is 127 whereas eight bits can hold values up to
28 – 1 which is 255.

Conversions for hexadecimal numbers


It is possible to convert a hexadecimal number to denary by using the method shown in Table 1.03.
However, if there are more than a few digits, the numbers involved in the conversion become very
large. Instead, the sensible approach is to first convert the hexadecimal number to a binary number
which can then be converted to denary.
To convert a hexadecimal number to binary, each digit is treated separately and converted into a 4-bit
binary equivalent, remembering that F converts to 1111, E converts to 1110 and so on.

To convert a binary number to hexadecimal you start with the four least significant bits and convert
them to one hexadecimal digit. You then proceed upwards towards the most significant bit, successively
taking groupings of four bits and converting each grouping to the corresponding hexadecimal digit.

TASK 1.01
Convert each of the denary numbers 96, 215 and 374 into hexadecimal numbers.

Convert each of the hexadecimal numbers B4, FF and 3A2C to denary numbers.

Question 1.01
Does a computer ever use hexadecimal numbers?
1.02 Numbers and quantities
There are several different types of numbers within the denary system. Examples of these are provided
in Table 1.05.

Type of number Examples Comments

Integer 3 or 47 A whole number used for counting

The positive number has an implied +


Signed integer −3 or 47
sign

Fraction 2/3 or 52/17 Rarely used in computer science

A number with a whole


The positive number has an implied +
number part and a fractional −37.85 or 2.83
sign
number part

The value can be positive or negative


A number expressed in
−3.6 × 108 or 4.2 × 10–9 and the exponent can be positive or
exponential notation
negative

Table 1.05 Different ways to express a value using the denary number system

We will focus on how large values are represented. If we have a quantity that includes units of
measurement, it can be written in three different ways. For example, a distance could be written in any
one of these three ways:

23 567 m

23.567 × 103 m

23.567 km

The second example has used an exponential notation to define the magnitude of the value. The third
example has added a prefix to the unit to define this magnitude. We read this as 23.567 kilometres.

The ‘kilo’ is an example of a decimal prefix. There are four decimal prefixes commonly used for large
numbers. These are shown in Table 1.06.

Decimal prefix name Symbol used Factor applied to the value

kilo k 103

mega M 106

giga G 109

tera T 1012

Table 1.06 The decimal prefixes

Unfortunately, for a long time the computing world used these prefix names but with a slightly different
definition. The value for 210 is 1024. Because this is close to 1000, computer scientists decided that
they could use the kilo prefix to represent 1024. So, for example, if a computer system had the
following values quoted for the processor speed and the size of the memory and of the hard disk:

Processor speed 1.6 GHz

Size of RAM 8 GB

Size of hard disk 400 GB

The prefix G would represent 109 for the processor speed but would almost certainly represent 1024 ×
1024 × 1024 for the other two values.
This unsatisfactory situation has now been resolved by the definition of a new set of names which can
be used to define a binary prefix. A selection of these is shown in Table 1.07.

Binary prefix name Symbol used Factor applied to the value

kibi Ki 210

mebi Mi 220

gibi Gi 230

tebi Ti 240

Table 1.07 Some examples of binary prefixes

When a number or a quantity is presented for a person to read it is best presented with either one
denary digit or two denary digits before the decimal point. If a calculation has been carried out, the
initial result found may not match this requirement. A conversion of the presented value will be needed
by choosing a sensible magnitude factor. For example, consider the following two answers calculated
for the size of a file:

a 34 560 bytes

Here, a conversion to kibibytes would be sensible using the calculation:

344560B=345601024KiB=33.75 KiB
b 3 456 000 bytes

Here, a conversion to mebibytes would be sensible using the calculation:


3456000B=(34560001024)1024MiB=3.296 MiB

If a calculation is to be performed with values quoted with different magnitude factors there must first
be conversions to ensure all values have the same magnitude factor. For example, if you needed to know
how many files of size 2.4 MiB could be stored on a 4 GiB memory stick there should be a conversion of
the GiB value to the corresponding MiB value.

The calculation would be:


(4×1024)MiB2.4MiB=1076
1.03 Internal coding of numbers
The discussion in this chapter relates only to the coding of integer values. The coding of non-integer
numeric values (real numbers) is considered in Chapter 16 (Section 16.03).

Coding for integers


Computers need to store integer values for a number of purposes. Sometimes only a simple integer is
stored, with the understanding that it is a positive number. This is stored simply as a binary number.
The only decision to be made is how many bytes should be used. If the choice is to use two bytes (16
bits) then the range of values that can be represented is 0 to (216 – 1) which is 0 to 65 535.

However, in many cases we need to identify whether the number is positive or negative, so we use a
signed integer. A signed integer can just have the binary code for the value with an extra bit to define
the sign. This is referred to as ‘sign and magnitude representation’. For this the convention is to use a 0
to represent + and a 1 to represent –. A few examples of this are shown in Table 1.08.

However, there are a number of disadvantages to using this format, so signed integers are usually in
two’s complement form. Here we need two definitions.

The one’s complement of a binary number is defined as the binary number obtained if each binary
digit is individually subtracted from 1. This means that each 0 is switched to 1 and each 1 switched to 0.
The two’s complement is defined as the binary number obtained if 1 is added to the one’s complement
number.

If you need to convert a binary number to its two’s complement form, you can use the method indicated
by the definition but there is a quicker method. For this you start at the least significant bit and move
left ignoring any zeros up to the first 1, which you also ignore. Finally you change any remaining bits
from 0 to 1 or from 1 to 0.

For example, expressing the number 10100100 in two’s complement form leaves the right-hand 100
unchanged, then the remaining 10100 changes to 01011, so the result is 01011100.
To represent a positive denary integer value as the equivalent two’s complement binary form, the
process is as follows.

Use one of methods from Section 1.01 to convert the denary value to a binary value.

Add a 0 in front of this binary value.

To represent a negative denary integer value as the equivalent two’s complement binary form the
process is as follows.

Disregard the sign and use one of methods from Section 1.01 to convert the denary value to a
binary value.

Add a 0 in front of this binary value.

Convert this binary value to its two’s complement form.

A few simple examples of two’s complement representations are shown in Table 1.08.

To convert a two’s complement binary number representing a positive value into a denary value, the
leading zero is ignored and one of the methods in Section 1.01 is applied to convert the remaining
binary.

There are two alternative methods for converting a two’s complement binary number representing a
negative number into a denary value. These are illustrated in Worked Example 1.03.

WORKED EXAMPLE 1.03

Methods for converting a negative number expressed in two’s complement form to the
corresponding denary number
Consider the two’s complement binary number 10110001.
Method 1. Convert to the corresponding positive binary number then convert to denary before
adding the minus sign

Converting 10110001 to two’s complement leaves unchanged the 1 in the least significant bit
position then changes all of the remaining bits to produce 01001111.

You ignore the leading zero and apply one of the methods from Section 1.01 to convert the
remaining binary to denary which gives 79.

You add the minus sign to give −79.

Method 2. Sum the individual place values but treat the most significant bit as a negative value
You follow the approach illustrated in Table 1.02 to convert the original binary number 10110001
as follows:

−27 26 25 24 23 22 21 20
Place
= = = = = = = =
value
−128 64 32 16 8 4 2 1
Digit 1 0 1 1 0 0 0 1
Product −128 0 32 16 0 0 0 1

You now add the values in the bottom row to get −79.

Some points to note about two’s complement representation are as follows.

There is only one representation of zero.

Starting from the lowest negative value, each successive higher value is obtained by adding 1 to the
binary code. In particular, when all digits are 1 the next step is to roll over to an all-zero code. This
is the same as any digital display would do when each digit has reached its maximum value.

Just adding a leading zero to an unsigned binary value converts it to the two’s complement
representation of the corresponding positive number

You use a two’s complement conversion to change the sign of a number from positive to negative or
from negative to positive. We say that the two’s complement values are self-complementary.

You can add any number of leading zeros to a representation of a positive value without changing
the value.

You can add any number of leading ones to a representation of a negative value without changing
the value.

Signed denary number to be Sign and magnitude Two’s complement


represented representation representation

7 0111 0111

1 0001 0001

0 0000 0000

–0 1000 Not represented

–1 1001 1111

–7 1111 1001

–8 Not represented 1000

Table 1.08 Representations of signed integers


TIP
If you are converting a negative denary number into two’s complement you begin by
converting the denary value to a binary value. Then you must not forget to add a leading
zero before taking the two's complement to convert the positive value to a negative value.

TASK 1.02
Take the two’s complement of the binary code for –7 and show that you get the code for +7.

TASK 1.03
Convert the two’s complement number 1011 to the denary equivalent. Then do the same for
111011 and convince yourself that you get the same value.

Discussion Point:
What is the two’s complement of the binary value 1000? Are you surprised by this?

Binary arithmetic
Before considering the addition of binary numbers it is useful to recall how we add two denary
numbers. Two rules apply. The first rule is that the process is carried out starting with addition of the
two least significant digits and then working right to left. The second rule is that if an addition produces
a value greater than 9 there is a carry of 1. For example in the addition of 48 to 54, the first step is
adding 8 to 4 to get 2 with a carry of 1. Then 5 is added to 4 plus the carried 1 to give 0 with carry 1.
The rules produce 102 for the sum which is the correct answer.
For binary addition, starting at the least significant position still applies. The rules for the addition of
binary digits are:

0+0=0

0+1=1

1 + 1 = 0 with a carry of 1

1 + 1 + 0 = 0 with a carry of 1

1 + 1 + 1 = 1 with a carry of 1

The last two rules are used when a carried 1 is included in the addition of two digits.
As an example, the addition of the binary equivalent of denary 14 to the binary equivalent of denary 11
can be examined.

1 0 1 1

+ 1 1 1 0

1 1 0 0 1

The steps followed from right to left are:

1 + 0 = 1 with no carry

1 + 1 = 0 with carry 1

0 + 1 + carried 1 = 0 with carry 1

1 + 1 + carried 1 = 1 with carry 1


The rules have correctly produced the 5-bit answer which is the binary equivalent of 25. In a paper
exercise like this these rules for addition will always produce the correct answer.
Again for subtraction we can first consider how this is done for denary numbers. As for addition the
process starts with the least significant digits and proceeds right to left. The special feature of
subtraction is the “borrowing” of a 1 from the next position when a subtracting digit is larger than the
digit it is being subtracted from.
For example in subtracting 48 from 64 the first step is to note that 8 is larger than 4. Therefore 1 has to
be borrowed as 10. The 10 added to 4 gives 14 and 8 subtracted from this gives 6. When we proceed to
the next digit subtraction we first have to reduce the 6 to 5 because of the borrow. So we have
subtraction of 4 from 5 leaving 1. The answer for the subtraction is 16.
For binary subtraction, starting at the least significant position still applies. The rules for the
subtraction of binary digits are:

0–0=0

0 – 1 = 1 after a borrow

1–0=1

1–1=0

As an example, the subtraction of the binary equivalent of denary 11 from the binary equivalent of
denary 14 can be examined.

1 1 1 0

− 1 0 1 1

0 0 1 1

The steps followed from right to left are:

1 is larger than 0 so 1 is borrowed giving subtraction of 1 from 10 leaving 1

Because of the borrow the 1 is reduced to 0 so that 1 is to be subtracted from 0. This requires a
further borrow giving subtraction of 1 from 10 leaving 1

Because of the borrow the 1 is reduced to 0 leaving subtraction of 0 from 0

1 – 1 gives 0

The answer is the binary value for denary 3.

When binary addition is carried out by a computer using internally stored numbers there is a major
difference. This arises from the fact that the storage unit will always have a defined number of bits. For
example, in the above addition, if binary values were limited to being stored in a nibble the result of the
addition would be incorrectly stored as 1001. This is an example of an overflow. The value produced is
too large to be stored.
When the values in a computer system are stored in two’s complement form this problem has a
characteristic behaviour.

In the following addition where +63 is added to +63 there is no problem; the answer is correctly
obtained as +126:

0 0 1 1 1 1 1 1

+ 0 0 1 1 1 1 1 1

0 1 1 1 1 1 1 0

However, if the binary for +96 is added to +96 the result is as follows:
0 1 1 0 0 0 0 0

+ 0 1 1 0 0 0 0 0

1 1 0 0 0 0 0 0

The overflow means that the answer has a leading 1, which causes a computer system to interpret the
answer as a negative number.

A similar problem can occur when two negative values are added. For example the addition of −96 to
the same value results in the following:

1 0 1 0 0 0 0 0

+ 1 0 1 0 0 0 0 0

(1) 0 1 0 0 0 0 0 0

This time there has been a carry when the most significant bits were added and the result obtained is a
positive number.
Clearly we need the processor to detect overflow and output an error message. There is a discussion of
how a processor can detect overflow in Chapter 6 (Section 6.07).
One of the advantages of using two’s complement representations is that it simplifies the process of
subtracting one number from another. The number being subtracted is converted to its two’s
complement form, which is then added to the other number.

TASK 1.04
Using a byte to represent each value, carry out the subtraction of denary 35 from denary 67
using binary arithmetic with two’s complement representations.

Binary coded decimal (BCD)


One exception to grouping bits in bytes to represent integers is the binary coded decimal (BCD)
scheme. This is useful in applications that require single denary digits to be stored or transmitted. The
BCD code uses a nibble to represent a denary digit. We consider the simple scheme where the digits are
coded as the binary values from 0000 to 1001. The remaining codes 1010 to 1111 do not have any
meaning.
If a denary number with more than one digit is to be converted to BCD there has to be a group of four
bits for each denary digit. There are, however, two options for BCD; the first is to store one BCD code in
one byte, leaving four bits unused. The other option is packed BCD where two 4-bit codes are stored in
one byte. Thus, for example, the denary digits 8503 could be represented by either of the codes shown
in Figure 1.01.

One BCD digit per byte 00001000 00000101 00000000 00000011

Two BCD digits per byte 10000101 00000011

Figure 1.01 Alternative BCD representations of the denary digits 8503

There are a number of applications where BCD can be used. The obvious type of application is where
denary digits are to be displayed, for instance on the screen of a calculator or in a digital time display. A
somewhat unexpected application is for the representation of currency values. When a currency value is
written in a format such as $300.25 it is as a fixed-point decimal number (ignoring the dollar sign). It
might be expected that such values would be stored as real numbers but this cannot be done accurately
(this type of problem is discussed in more detail in Chapter 16 (Section 16.03)). One solution to the
problem is to store each denary digit as a BCD code.
Let's consider how BCD arithmetic might be performed by a computer if fixed-point decimal values for
currency were stored as BCD values. Here is an example of addition.

Figure 1.02 Incorrect addition using BCD coding

We will assume a two-byte packed BCD representation. The first byte represents two denary digits for
the whole part of the number and the second byte represents two denary digits for the fractional part. If
the two values are $0.26 and $0.85 then the result of the addition should be $1.11. This would involve a
carry from the first decimal place to the whole number 1. However, applying simple binary addition of
the BCD codes would produce the result shown in Figure 1.02.
The additions for the fractional parts have produced values corresponding to the denary values 10 and
11 but a BCD value is supposed to be a single digit. The error has resulted in no carry to the whole
number column.
We need the processor to recognise that an impossible value has been produced and apply a method to
correct this. The solution is to add 0110 whenever the problem is detected. This is illustrated in Figure
1.03.

Figure 1.03 Use of the correction value to perform BCD addition

The steps shown in Figure 1.03 are as follows.

Starting with the least significant nibble, adding 0110 to 0101 gives 1011 which is recognised as
being incorrect.

The 0110 correction value is added to produce 10001.

The 0001 is stored and the leading 1 is carried to the next nibble.

In the first decimal position adding 0100 to 1000 then adding the carry bit 1 gives 1011 which is
recognised as being incorrect.

The 0110 correction is added to produce 10001.

The 0001 is stored and the leading 1 is carried to the next nibble.

In this example the two whole number nibbles have zero values so adding these has no effect.
1.04 Internal coding of text
To store text in a computer, we need a coding scheme that provides a unique binary code for each
distinct individual component item of the text. Such a code is referred to as a character code. There
have been many different examples of character coding schemes throughout the history of computing.

ASCII code
The scheme which has been used for the longest time is the ASCII (American Standard Code for
Information Interchange) coding scheme. The 7-bit version of the code (often referred to as US ASCII)
was standardised many years ago by ANSI (American National Standards Institute). The codes are
always presented in a table. Table 1.09 shows an edited version of a typical table. The first column
contains the binary code which would be stored in one byte, with the most significant bit set to zero and
the remaining bits representing the character code. The second column shows the hexadecimal
equivalent.

Binary code Hexadecimal equivalent Character Description

00000000 00 NUL Null character

00000001 01 SOH Start of heading

00100000 20 Space

00100001 23 # Number

00110000 30 0 Zero

00110001 31 1 One

01000001 41 A Uppercase A

01000010 42 B Uppercase B

01100001 61 a Lowercase a

01100010 62 b Lowercase b

Table 1.09 Some examples of ASCII codes stored in one byte with the remaining, most significant bit set
to zero

A full table would show the 27 (128) different codes available for a 7-bit code.

TIP
Do not try to remember any of the individual codes

You need to remember these key facts about the ASCII coding scheme.

A limited number of the codes represent non-printing or control characters; these were introduced
to assist in data transmission or for data handling at a computer terminal.

The majority of the codes are for characters that would be found in an English text and which are
available on a standard keyboard.

These include upper- and lower-case letters, punctuation marks, denary digits and arithmetic
symbols.

The codes for numbers and for letters are in sequence so that, for example, if 1 is added to the code
for seven, the code for eight is produced.

The codes for the upper-case letters differ from the codes for the corresponding lower-case letters
only in the value of bit 5, which allows a simple conversion from upper to lower case or the reverse.
(Don’t forget that the least significant bit is bit 0.)
Note that this coding for numbers is exclusively for use in the context of stored, displayed or printed
text. All of the other coding schemes for numbers are for internal use in a computer system and would
not be used in a text.
Although a standard version of ASCII has been created, different versions of 7-bit ASCII are tailored to
different software or different countries. Mostly, the coding for the printable characters has remained
unchanged. A notable exception was the use in some countries of the code 00100001 to represent a
currency symbol rather than #. However, because most of the control characters became of limited use,
there were versions of ASCII that used these codes to produce small graphic icons. For example, the
code 00000001 would show .

Extended ASCII is a code that uses all eight bits in a byte. The most used standardised version is often
referred to as ISO Latin-1. The name Latin-1 reflects the fact that many of the new character definitions
are for accented or otherwise modified alphabetic characters found in European languages, for example
Ç or ü. As with the 7-bit code, there are many variations of the standard code.

Question 1.02
Many years ago, a byte was defined as six bits. If a character was to be represented by one byte, which
characters would you expect to be representable and which ones would you expect to be unavailable?

Unicode
Although ASCII codes are widely used, they do not cover all the characters needed for some uses. For
this reason, new coding schemes have been developed and continue to be developed further. The
discussion here describes one of the Unicode schemes. It should be noted that Unicode codes have been
developed in tandem with the Universal Character Set (UCS) scheme, standardised as ISO/IEC 10646.
The aim of Unicode is to be able to represent any possible text in code form. In particular, this includes
all languages in the world. The most popular version of Unicode which is discussed here is named UTF-
8. The inclusion of 8 in the name indicates that this version of the standard includes codes defined by
one byte in addition to codes using two, three and four bytes.
Figure 1.04 shows the structure of the codes. The 1 byte code reproduces 7-bit ASCII. Because the byte
has the most significant bit set to 0 there can be no confusion with any byte which is part of a multiple
byte code. Note that for the two-byte, three-byte and four-byte representations all continuing bytes
have the two most significant bits set to 10. Whenever a byte has the most significant bits set to 11
there will be at least one continuation byte following.

0???????
110????? 10??????
1110???? 10?????? 10??????
11110??? 10?????? 10?????? 10??????

Figure 1.04 Byte formats for Unicode UTF-8

The number of codes available is determined by the number of bits that are not pre-defined by the
format. For example, there are eleven bits free to identify codes in the 2-byte format. This allows 211 =
2048 different codes.

Unicode has its own special terminology and symbolism. A character code is referred to as a ‘code
point’. In any documentation a code point is identified by U+ followed by a 4-digit hexadecimal number.
The code points U+0000 to U+00FF define characters which are a duplicate of those in the standard
Latin-1 scheme. The binary codes corresponding to U+0000 to U+007F use one byte only and range
from 00000000 through to 01111111. Then the binary codes for U+0080 to U+00FF require two bytes
and range from 11000000 for the first byte followed by 10000000 for the second byte through to
11000001 followed by 10111111.
1.05 Images
Images can be stored in a computer system for the eventual purpose of displaying the image on a
screen or for presenting it on paper, usually as a component of a document. Such an image can be
created by using an appropriate graphics package. Alternatively, when an image already exists
independently of the computer system, the image can be captured by using photography or by
scanning.

Vector graphics
In an image that is created by a drawing package or a computer-aided design (CAD) package each
component is an individual drawing object. The image is then stored, usually as a vector graphic file.

We do not need to consider how an image of this type would be created. We do need to consider how
the data is stored after the image has been created. A vector graphic file contains a drawing list. The
list contains a command for each object included in the image. Each command has a list of attributes,
each attribute defines a property of the object. The properties include the basic geometric data such
as, for a circle, the position of the centre and its radius. In addition, properties are defined such as the
thickness and style of a line, the colour of a line and the colour that fills the shape. An example of what
could be created as a vector graphic file is shown in Figure 1.05.

TASK 1.05
Construct a partial drawing list for the graphic shown in Figure 1.05. You can take measurements
from the image and use the bottom left corner of the box as the origin of a coordinate system. You
can invent your own format for the drawing list.

Figure 1.05 A simple example of a vector graphic image

The most important property of a vector graphic image is that the dimensions of the objects are not
defined explicitly but instead are defined relative to an imaginary drawing canvas. In other words, the
image is scalable. Whenever the image is to be displayed the file is read, the appropriate calculations
are made and the objects are drawn to a suitable scale. If the user then requests that the image is
redrawn at a larger scale the file is read again and another set of calculations are made before the
image is displayed. This avoids image distortion, such as the image appearing squashed or stretched.
Note that a vector graphic file can only be displayed directly on a graph plotter, which is an expensive
specialised piece of hardware. For the image to appear correctly on other types of display, the vector
graphic file often has to be converted to a bitmap.

Bitmaps
Most images do not consist of geometrically defined shapes, so a vector graphic representation is
inappropriate. Instead, generally an image is stored as a bitmap. Typical uses are when capturing an
existing image by scanning or perhaps by taking a screen-shot. Alternatively, an image can be created
by using a simple graphics package.
The fundamental concept underlying the creation of a bitmap file is that the picture element (pixel) is
the smallest identifiable component of a bitmap image. The image is stored as a two-dimensional matrix
of pixels. The pixel itself is a very simple construct; it has a position in the matrix and it has a colour. It
does not matter whether each pixel is a small rectangle, a small circle or a dot.
The scheme used to represent the colour has to be defined. The simplest option is to use one bit to
represent the colour, so that the pixel is either black or white. Storage of the colour in four bits allows
simple greyscale colouring. At least eight bits per pixel are necessary to provide a sufficient range of
colours to provide a reasonably realistic representation of any image. The number of bits per pixel is
sometimes referred to as the colour depth.
An alternative definition is the bit depth. Although these terms are sometimes used interchangeably,
bit depth is best defined as the number of bits used to store each of the red, green and blue primary
colours in the RGB colour scheme.
A colour depth of 8 bits per pixel provides 256 different colours. A bit depth of 8 bits per primary colour
provides 256 × 256 × 256 = 16 777 216 different colours. The eye cannot distinguish this number of
different colours. However, this many are needed if an image contains areas of gradually changing
colour such as in a picture of the sky. If a lower bit depth is used the image will show bands of colour.

We also need to decide which resolution to use for the image, which can be represented as the product
of the number of pixels per row times the number of rows. When considering resolution it is important
to distinguish between an image resolution, as defined in a bitmap file, and a screen resolution for a
particular monitor screen that might be used to display the image. Both of these have to be considered
if a screen display is being designed.
A bitmap file does not define the physical size of a pixel or of the whole image. When the image is
scaled the number of pixels in it does not change. If a well-designed image is presented on a suitable
screen the human eye cannot distinguish the individual pixels. However, if the image is magnified too
far the individual pixels will be seen. This is illustrated in Figure 1.06 which shows an original small
image, a magnified version of this small image and a larger image created with a more sensible, higher
resolution.

Figure 1.06 (a) a bitmap logo; (b) an over-magnified version of the image; (c) a sensible larger version

File size is always an issue with an image file. A large file occupies more memory space and takes
longer to display or to be transmitted across a network. Usually, a vector graphic file uses considerably
less memory space than a corresponding bitmap file.

You can calculate the size of a bitmap graphic knowing the resolution and the colour depth. As an
example, consider that a bitmap graphic is needed to fill a laptop screen where the resolution is 1366
by 768. If we want colour depth of 24 then the number of bits we need is:
1366 × 768 × 24 = 25 178 112 bits

The result of this calculation shows the number of bits, but a size is always quoted as a number of bytes
or multiples of bytes. For our bitmap graphic:

25 178 112 bits = 25 178 112 ÷ 8 = 3 147 264 bytes

= 3 147 264 ÷ 1024 = 3073.5 kibibytes (3073.5 KiB)


= 3073.5 ÷ 1024 = approximately 3 MiB

Note that this calculation has assumed that the colour depth specifies the total number of bits used to
define each pixel. If the information given was that the bit depth was eight, then the calculation would
use 8 + 8 + 8 for the number of bits per pixel.

WORKED EXAMPLE 1.04

You have been asked to calculate a value for the minimum size of a bitmap file. The bitmap is to use
a bit depth of 8 and the bitmap is to be printed with 72 dpi (dots per inch) and to have dimensions
5 inches by 3 inches.
We use the information provided about the colour depth or the bit depth to give the number of bits
per pixel. In this case the bit depth is 8, which means 8 bits for each of the RGB components, so 24
bits are needed for one pixel.
Let’s state that 72 dpi means 72 pixels per inch.
So, the number of pixels per row is 5 × 72 = 360

And the number of pixels per column is 3 × 72 = 216


Therefore, the total number of pixels is 360 × 216 = 77 760

The total number of bits is this value multiplied by 24. However, we want the size in bytes not bits,
so we multiply by 3 because there are 8 bits in a byte. So, we get:
77 760 × 3 = 233 280 bytes.

We can quote this in kibibytes by dividing by 1024:


233 280 / 1024 = 227.8 KiB

A bitmap file has to store the pixel data that defines the graphic, but the file must also have a file
header that contains information on how the graphic has been constructed. Because of this, the bitmap
file size is larger than the size of the graphic alone. At the very least the header will define the colour
depth or bit depth and the resolution.
The following are considerations when justifying the use of either a bit map or a vector graphic for a
specific task.

A vector graphic is chosen if a diagram is needed to be constructed for part of an architectural,


engineering or manufacturing design.

If a vector graphic file has been created but there is a need to print a copy using a laser or inkjet
printer the file has first to be converted to a bitmap.

A digital camera automatically produces a bitmap.

A bitmap file is the choice for insertion of an image into a document, publication or web page.
1.06 Sound
Natural sound consists of variations in pressure which are detected by the human ear. A typical sound
contains a large number of individual waves, each with a defined frequency. The result is a wave form in
which the amplitude of the sound varies in a continuous but irregular pattern.

If we want to store sound or transmit it electronically the original analogue sound signal has to be
converted to a binary code. The measured sound values are input to a sound encoder which has two
components. The first is a band-limiting filter. This is needed to remove high-frequency components. A
human ear cannot detect these very high frequencies and they could cause problems for the coding if
not removed. The other component in the encoder is an analogue-to-digital converter (ADC) which
converts the analogue data to digital data.

Figure 1.07 shows the sampling operation of the ADC. The amplitude of the wave (the red line) has to
be sampled at regular intervals. The blue vertical lines indicate the sampling times. The amplitude
cannot be measured exactly; instead the amplitude is approximated by the closest of the defined
amplitudes represented by the horizontal lines. In Figure 1.07, sample values 1 and 4 will be an
accurate estimate of the actual amplitude because the wave is touching an amplitude line. In contrast,
samples 5 and 6 will not be accurate because the actual amplitude is approximately half way between
the two closest defined values.

To code sound, we need to make two decisions. The first is the number of bits we will use to store the
amplitude values, which defines the sampling resolution. If we use only three bits then eight levels
can be defined as shown in Figure 1.07. If too few are used there will be a significant error when the
closest amplitude in the scale of values dictated by the sampling resolution is used as the approximation
for the real value. In practice, 16 bits provides reasonable accuracy for most digitised sound.

We also need to choose the sampling rate, which is the number of samples taken per second. This
should be in accordance with Nyquist’s theorem which states that sampling must be done at a
frequency at least twice the highest frequency of the sound in the sample.

Figure 1.07 ADC sampling

Once again file size can be an issue. An increased sampling rate and an increased sampling resolution
will both cause an increase in file size.
1.07 Compression techniques
Larger files require larger storage capacity but more importantly, larger files have lower transmission
or download rates. For this reason, compression techniques are often used to reduce file size.

There are two categories of compression. The first is lossless compression where the file size is
reduced but no information is lost. The process can be reversed to re-create the original file. The
second is lossy compression where the file size is reduced with some loss of information and the exact
original file can never be recovered. In many applications a combination of lossless and lossy methods
are used.

We could use the same type of lossless file compression for everything, because all files contain binary
codes. A good compression application will recognise patterns in files that it can compress, without any
knowledge of what file type the code represents. However, most compression techniques have been
developed to work with a particular type of file.
A common lossless compression technique is run-length encoding. This works particularly well with a
bitmap file. The idea is that compression converts sequences of the same byte value into a code that
defines the byte value and the number of times it is repeated (the count).
For example, the sequence of the same four bytes:
01100110 01100110 01100110 01100110

could be replaced by:

00000100 01100110
which says that there is a run of four of the bytes.
However, this is not the full story because in this simple form it is not obvious which byte represents the
number (count) in the sequence. There are a number of methods used to distinguish the count byte
from a data byte, but we do not need to go into the details.
If a file contains text, then compression must be lossless because any loss of information would lead to
errors in the text. One possible compression method is called Huffman coding. The procedure used to
carry out the compression is quite detailed, but the principle is straightforward. Instead of having each
character coded in one byte, the text is analysed to find the most often used characters. These are then
given shorter codes. The original stream of bytes becomes a bit stream.
A possible set of codes if a text contained only eight different letters is shown in Table 1.10. The
important point to note here is the prefix property. None of the codes begins with the sequence of bits
representing a shorter code. This means that there can be no ambiguity when the transmitted
compressed file has to be converted back to the original text.

Code Character

10 e

01 t

111 o

110 h

0001 l

0000 p

0011 w

0010 z

Table 1.10 An example of Huffman coding

Huffman coding can also be used for compressing a sound file. This is effective because some values for
the amplitude occur far more often than others do.
If a vector graphic file needs to be compressed it is best converted to a Scalable Vector Graphics
format. This uses a markup language description of the image which is suitable for lossless
compression.

Lossy compression can be used in circumstances where a sound file or an image file can have some of
the detailed coding removed or modified. This can happen when it is likely that the human ear or eye
will hardly notice any difference. One method for lossy compression of a sound file takes advantage of
the fact that the successive sampled values are unlikely to change very much. The file of individual
sample amplitudes can be converted to a file of amplitude differences. Compression is achieved by
using a lower sample resolution to store the differences. An alternative is to convert the sampled
amplitudes that represent time domain data and transform them to a frequency domain representation.
The values for frequencies that would be barely audible are then re-coded with fewer bits before the
data is transformed back to the original time domain form.
For a bitmap a simple lossy compression technique is to establish a coding scheme with reduced colour
depth. Then for each pixel in the original bitmap the code is changed to the one in the new scheme
which represents the closest colour.

Extension Question 1.01


Graphic files can be stored in a number of formats. For example, JPEG, GIF, PNG and TIFF are just a
few of the possibilities. What compression techniques, if any, do these use?

Reflection Point:
Can you recall the different possibilities for what one byte might be coded to represent?

Summary
■ A binary code or a binary number can be documented as a hexadecimal number.
■ Internal coding of signed integers is usually based on a two’s complement representation.
■ Binary addition can cause overflow.
■ BCD is a convenient coding scheme for single denary digits.
■ ASCII and Unicode are standardised coding schemes for text characters.
■ An image can be stored either in a vector graphic file or in a bitmap file.
■ An ADC works by sampling a continuous waveform.
■ Lossless compression allows an original file to be recovered by a decoder; lossy compression
irretrievably loses some information.
Exam-style Questions
1 A file contains binary coding. The following are two successive bytes in the file: 10010101 and
00110011
a One possibility for the information stored is that the two bytes together represent one unsigned
integer binary number.
i Calculate the denary number corresponding to this. [2]
ii Calculate the hexadecimal number corresponding to this. [2]
b Give one example of when a hexadecimal representation is used. [1]
c Another possibility for the information stored is that the two bytes individually represent two
signed integer binary numbers in two’s complement form.
i State which byte represents a negative number and explain the reason for your choice.
ii Calculate the denary number corresponding to each byte. [3]
d Give two advantages of representing signed integers in two’s complement form rather than using
a sign and magnitude representation. [2]
e Give three different examples of other options for the types of information that could be
represented by two bytes. For each example, state whether a representation requires two bytes
each time, just one byte or only part of a byte each time. [3]

2 A designer wishes to include some multimedia components on a web page.


a If the designer has some images stored in files there are two possible formats for the files.
i Describe the approach used if a graphic is stored in a vector graphic file. [2]
ii Describe the approach used if a graphic is stored in a bitmap file. [2]
iii State which format gives better image quality if the image has to be magnified and explain
why. [2]
b The designer is concerned about the size of some bitmap files.

i If the resolution is to be 640 × 480 and the colour depth is to be 16, calculate an approximate
size for the bitmap file. State the answer using sensible units. [2]
ii Explain why this calculation only gives an approximate file size. [1]
c The designer decides that the bitmap files need compressing.
i Explain how a simple form of lossless compression could be used. [2]
ii Explain one possible approach to lossy compression that could be used. [2]

3 An audio encoder is to be used to create a recording of a song. The encoder has two components.
a One of the components is an analogue-to-digital converter (ADC).

i Explain why this is needed. [2]


ii Two important factors associated with the use of an ADC are the sampling rate and the
sampling resolution. Explain the two terms. Sketch a diagram if this will help your
explanation. [5]
b The other component of an audio encoder has to be used before the ADC is used.

i Identify this component. [1]


ii Explain why it is used. [2]

4 a i Using two’s complement, show how the following denary numbers could be stored in an 8-bit
register:

124
–77
[2]

ii Convert the two numbers in part (a) (i) into hexadecimal. [2]
b Binary Coded Decimal (BCD) is another way of representing numbers.

i Write the number 359 in BCD form. [1]


ii Describe a use of BCD number representation. [2]

Cambridge International AS & A level Computer Science 9608 paper 13 Q1 June 2015
5 a Sound can be represented digitally in a computer.

Explain the terms sampling resolution and sampling rate. [4]


b The following information refers to a music track being recorded on a CD:

music is sampled 44 100 times per second

each sample is 16 bits

each track requires sampling for left and right speakers.

i Calculate the number of bytes required to store one second of sampled music. Show your
working. [2]
ii A particular track is four minutes long.
Describe how you would calculate the number of megabytes required to store this track. [2]
c When storing music tracks in a computer, the MP3 format is often used. This reduces file size by
about 90%.
Explain how the music quality is apparently retained. [3]

Cambridge International AS & A level Computer Science 9608 paper 12 Q4 November 2015
Discovering Diverse Content Through
Random Scribd Documents
“Amesville! Of course! Thought I wasn’t mistaken.” Mr. York smiled
in satisfaction. “I’ll tell you where I saw you, Mr. Craig, and how. It
was about three months ago. I stopped off at Amesville to see a
friend of mine, John Holden. Perhaps you know him?”
Sam shook his head.
“Well, he’s a newcomer in Amesville; practising law; a nice chap.
You ought to meet him. When you go home drop into his office
some day and tell him John York said you were to be friends. You’ll
like him and he will like you.”
Sam murmured rather embarrassed thanks.
“It happened to be a Saturday and Johnny and I, having nothing
better to do, jumped on a car and went out to see the high school
team play ball with some visiting nine; forget who the other chaps
were. Johnny used to play shortstop when I was catching for Warner
College, and we’re both fans. So we went out and saw that game. It
was a good one, too. You were catching for the Amesville team,
Craig.” Mr. York paused for corroboration and Sam nodded.
“You fellows won. You had a pitcher who had grey matter under
his cap. Had a lot on the ball, too. What was his name?”
“Pollock, sir.”
“That’s it! I remember it was some sort of a fish. Well”—Mr. York
turned to the others enthusiastically—“that chap Pollock turned the
trick in the last inning as neatly as you please. As I recall it the score
stood something like three to one in favour of Amesville. That right,
Craig?”
“Yes, sir.”
“The visitors were at bat and there were two out and the bases
were filled. Mind you, the visitors only needed two to tie, and, with
two gone, they were desperate. This chap Pollock had pitched a fine,
heady game, and he went after the next batter as cool as a
cucumber. Had two strikes on him, I think, when the man on third lit
out for the plate on the wind-up. I suppose when Pollock got himself
together that runner was halfway to the plate. Now”—Mr. York put
the question to one of the Mount Placid councillors—“what would
you have done, Williams, if you’d been in Pollock’s place?”
Mr. Williams hesitated. “Only one thing to have done,” he said
finally. “Plug to the catcher as fast as I knew how!”
Mr. York chuckled. “That’s what I’d have done. I guess that’s what
Craig here expected. But this Pollock chap had a head on his
shoulders. When the man on third dug for the plate the other
runners set out after him, of course. Well, Pollock realised that if he
threw to the catcher the ball might go wide or the catcher might—
begging Mr. Craig’s pardon—might drop it or it might be too late in
any event to make the out. So what does he do but whirl around
and slam the ball over to third baseman, who was running back to
cover the bag. Third baseman makes a nice catch, blocks off the
runner from second and—there you are! Three out and the score
three to two!”
“Clever work!” said Mr. Williams. “You’re right, Mr. York; that fellow
had brains.”
“You bet he had! Where is he now, Craig?”
“Amesville, sir. He has two more years in High School.”
“Isn’t that the same chap who visited camp a week or so ago?”
asked Mr. Gifford.
“Yes, that was Tom,” replied Sam. “He’s a nice fellow and we think
he’s a pretty fine pitcher.”
“Looked so to me,” agreed Mr. York. “And I want to say, too, that
you caught as pretty a game as I want to see, Craig. As I used to
wear a mask myself I always watch the catcher’s work, and you
certainly played a nice game. Are you catching to-day?”
“Yes, sir. At least, I’m going to start the game.”
“How’s your pitcher?”
“Fairly good for a youngster,” said Mr. Gifford. “Porter’s only
fifteen, I believe.”
“You don’t say?” The speaker turned, with a laugh, to Mr. Williams.
“You’ll have to watch out, Williams, and not let the kid outpitch you.”
The councillor looked a bit dismayed. “Perhaps we ought to let
one of the boys pitch,” he said doubtfully. “It doesn’t seem quite a
fair thing. We thought, Mr. Langham, that probably one of your
councillors would pitch for you.”
“Don’t let that worry you,” replied the Chief. “We have Mr. Gifford
here to step into the breach if he’s needed. Porter’s a pretty clever
pitcher if he is young. By the way, what time do we start, Scovill?”
“Three o’clock. It will be a little cooler by then. Besides, it gives a
chance for the Greenwood boys to get over here. There’s another
camp on the other side of the mountain, Langham. We had a sort of
a date to play with them to-day, but they were quite satisfied to
postpone it.”
“Why, I’m sorry! I didn’t know we were interfering with——”
“Not a bit! Not a bit! Greenwood’s just as well pleased to come
over and look on to-day. It takes them nearly an hour to hike around
here, and that’s one reason I thought we’d wait until three.” He
looked at his watch. “They ought to be showing up pretty soon now.
I suppose your boys will want to do a little practising before the
game. Any time they’d like to go down to the field I’ll send someone
along to show them the way.”
Mr. Gifford consulted his watch in turn. “It’s twenty past two,” he
said. “Perhaps we’d better go now, Mr. Scovill. I’d like them to put in
about twenty minutes or so to limber up.”
“Certainly. Joe, you show Mr. Gifford the way, will you?”
Mr. Phillips assented with alacrity and Mr. Gifford, Sam, and Steve
went off to get into their togs and gather the players together. When
they had left, Mr. York said: “A born ball-player, that young Craig. I’ll
be glad to see him in action again. It’s funny about catchers. Their
job is the pivotal one on the team and yet they don’t get half the
credit they deserve. I suppose the average fan will tell you what
every man on the team did in a game before he will mention the
catcher’s work at all. There’s not very much chance for spectacular
stunts behind the plate, and I guess that’s why the catcher doesn’t
get in the spotlight more. Just the same, if I had to build up a ball
team I’d start in by finding a good catcher—if I could. There aren’t
so many of them, by jingo! And then I’d build up the team around
that catcher. Someone ought to grab Craig about now and take him
in hand. A man who knew how could make a fine backstop of that
fellow!”
“Why don’t you try it?” asked Mr. Scovill, with a laugh.
“Not a bad idea,” replied Mr. York soberly. “At least, I might put
someone onto him. I wouldn’t mind seeing him playing with Warner
in a year or two. Happen to know, Mr. Langham, whether he has his
college picked out?”
“No, I don’t. But”—and here Mr. Langham’s eye twinkled—“there
are three loyal Burton men at my camp, and——”
“Help!” laughed Mr. York. “Nuf ced! Still, if he did manage to
escape you chaps I’d like a chance at him. Suppose we walk down
and see them practise.”
Mr. Langham remained behind with Mr. Scovill, at the latter’s
request, to meet the Greenwood party who were just then coming
into sight up the road, while one of the councillors was despatched
to the kitchen to see about a supply of lemonade which Mr. Scovill
had ordered to be prepared and taken to the ball-ground. When Mr.
York and his companions reached the field the visiting players had
just started their practice and the audience had already begun to
assemble. The field was a fine, level expanse of close turf about an
eighth of a mile from the camp, reached by a well-worn path
through the woods. The foul-lines and boxes had been freshly
marked out in honour of the event and the lime shone dazzlingly in
the sunlight. By degrees The Wigwam boys gathered together at the
farther side of the diamond, making themselves comfortable on the
warm grass. Mr. Gifford and Steve Brown were batting to infielders
and outfielders respectively, and Sam was at the plate, feeding the
balls to Mr. Gifford. The fellows went at practice with plenty of snap
and the ball fairly flew about the bases. At ten minutes to three the
visitors yielded the field to the home team and at a few minutes past
the hour Mr. York called, “Play ball!”
CHAPTER XIII
OUT AT THIRD!

Had you looked over Will Temple’s shoulder you’d have seen, very
neatly set down in his score-book—a brand-new one for the occasion
—the following batting orders of the rival camps:
The Wigwam—Brown, 2b.; Thursby, ss.; Meldrum, rf.; Gifford, lf.;
Groom, cf.; Crossbush, 3b.; Murdock, 1b.; Craig, c.; Porter, p.
Mount Placid—Cochran, 1b.; Benson, ss.; Smith, lf.; Walters, cf.;
Connell, 3b.; Phillips, 2b.; Hanford, c.; Williams, p.; Cather, rf.
At the last moment The Wigwam had thought it best to put its full
strength in the field at the start, and so it was decided that Mr.
Gifford should take Peterson’s place in left. In that way the line-up
would contain the best batting talent. In arranging the order of
batting Mr. Gifford started out on the assumption that Steve Brown
was the fastest man on bases and that, once on first, he would be
able to advance without aid. Consequently, Ed Thursby was to follow
him, since Ed, although not a hard hitter, was a fast runner between
bags. Meldrum was as good a bunter as the team possessed, and
Mr. Gifford was placed fourth in the hope that he would be able to
score one or more of the preceding players. Groom and Crossbush
were fair hitters, while Murdock was rather weak. Sam was to follow
the latter and, if possible, clean up. Porter was the weak man at bat.
Of the Mount Placid team, Cochran, Connell, Phillips, and Williams
were councillors, although, as The Wigwam learned afterwards, only
Cochran and Williams were players of experience.
Both teams showed nervousness in the first inning or two and the
play was rather ragged. The Mount Placid fellows were at least a
year older than their rivals, all being, probably, over sixteen, while
the visiting boys were all under that age, with one, Ralph Murdock,
only fourteen. Along the base-lines was assembled quite a good-
sized audience, representing Mount Placid, Greenwood, and The
Wigwam. Naturally enough, the Greenwood fellows rooted for Mount
Placid, and, so far as cheering was concerned, The Wigwam was
bested from the start. Mount Placid, bunched together some seventy
strong behind the third base-line, chanted: “Rah, rah rah! Who are
we? We are the boys of M. P. C.! Team! Team! Team!” Greenwood,
nearby, gave less often her, “Greenwood! Greenwood! Greenwood!
Rah, rah, rah! Rah rah, rah! Greenwood!” The Wigwam, still fewer in
numbers, did its best under the leadership of Dick Barry, and its
novel cheer, short and sharp, was applauded from across the
diamond: “W! Rah! I! Rah! G! Rah, rah, rah! W! Rah! A! Rah! M!
Rah, rah, rah! Wigwam!” In spite of the fact that there were only
some thirty Wigwam supporters there, Dick Barry managed to get
excellent results.
Steve Brown started the game by striking out, and Thursby and
Meldrum were thrown out at first. Mount Placid fared no better at
bat. Cochran flied to Mr. Gifford, Benson struck out, and Smith made
the third, Crossbush to Murdock. No runs, and, so far, no errors. But
the second inning told a different tale. Mr. Gifford flied out to left
field and Groom fell victim to Mr. Williams’s slow ball. And then, with
two gone, the Mount Placid third baseman fumbled an easy attempt
of Tom Crossbush’s and that youth reached first. Murdock received
an in-shoot on the elbow and took his base, briskly rubbing his arm.
Then Sam, cheered hopefully by The Wigwam boys, lined one into
deep centre and Crossbush reached the plate a yard ahead of the
ball and scored the first tally. That gave the blue-shirted youths
something to celebrate, and Dick Barry didn’t let the opportunity get
by them. A minute later, however, the inning was over, George Porter
fanning.
There was no scoring in the last of the second and none in either
half of the third. In the latter inning Mount Placid got to Porter for
two singles, but no one went beyond third. In the fourth it looked for
a while as if the visitors were going to score again, for, with one
down, Crossbush singled sharply to left and went to second on
Murdock’s out, pitcher to first. Sam was again called on for a hit, but
this time Mr. Williams fooled him badly and he struck out, and again
Porter proved easy. Mount Placid filled the bases in their half, but
George Porter, with one out, made Mr. Cochran hit into a double, and
once more The Wigwam barked its cheer into the air.
The fifth began with the score still one to nothing, and Steve
Brown tried desperately to get a start. But the rival pitcher’s skill was
too much for Steve, and when, as a last resort, the latter got in the
way of the ball the thing was so palpable that Mr. York laughingly
shook his head and Mount Placid jeered good-naturedly. Thursby laid
down a bunt in front of the plate, but he couldn’t beat the throw to
first. Meldrum made the third out, short to first. The Mount Placid
shortstop, Benson, opened the inning for the home team with a slow
bunt down third-base line that neither Crossbush nor Porter could
field, and an instant later he stole second, being aided by a poor
pitch of Porter’s that Sam couldn’t pick from between his feet in time
to throw.
Mount Placid, and Greenwood too, was cheering lustily now, and
the coachers were adding their turmoil to the total of sound. With
two strikes and one ball on Smith, Porter let down and handed out a
base. With a man on first and second, Walters flied out to Mr.
Gifford, who held the runners. Then Mr. Connell, one of the
councillors, and third baseman, found Porter for a long fly into right,
which George Meldrum badly misjudged, and two runs trickled
across. Mr. Connell took third on the throw-in. Mr. Phillips scored him
a minute later when he landed a Texas Leaguer behind first base.
There was still but one out. Sam walked down and whispered to
Porter. He had nothing to say to the pitcher, for George was pitching
coolly and well, but he seemed to be planning all sorts of strategies,
and The Wigwam cheered and the rivals indulged in the usual
humourous remarks held sacred to such occasions: “That’s right, talk
it over!” “Let’s all hear it!” “I’ll bet it’s a good story!” “They’re
changing the signals. It’s all up now!” “Play ball, Wigwam! Tell him
about it afterwards!”
Mr. York cautioned Sam that he was taking too much time, and
Sam, nodding untroubledly, donned his mask again and stooped
behind Hanford, the Mount Placid catcher. Hanford liked a low ball
and Sam saw that he didn’t get one. A strike, breast-high, went over.
Then an out-shoot that might have been a strike or ball, and was
judged by the umpire as the latter. Then another ball, much too
high. Then a waister, that the batter struck at and missed, was
followed by a foul. Sam, pulling his mask down again, laid one finger
against the back of his big mitt. Porter rubbed the back of his head
reflectively and, had anyone been regarding Steve Brown attentively,
he would have seen that player turn slightly toward second base.
Then Porter stepped forward and the ball whizzed to the plate. It
was one of George’s fast, straight ones, and, while it actually crossed
the centre of the plate lower than Sam wanted it to, it did the
business. Hanford swung too late and missed it by inches. It
thumped into Sam’s glove, was plucked forth instantly and sent, fast
and true, to second. Steve was already awaiting it. Almost with one
motion he caught the throw, knee-high, and swept the ball to the
left. Mr. Phillips, sliding feet-first, was out by a yard! And some thirty
blue-shirted youths cheered and capered!
But Mount Placid had a two-run lead now and The Wigwam tried
hard to cut it down in the first half of the sixth. Mr. Gifford landed on
a straight ball and hit safely for two bases into far left. Then Joe
Groom fouled out to first baseman. Crossbush fanned. With two out
the inning seemed over, but when Murdock knocked a slow grounder
across to third baseman that youth, pausing to hold the runner at
second, threw wide to first and Murdock was safe. When, however, a
double steal was called for a few moments later, Hanford proved too
much for the success of the venture. Although Sam swung at the
ball, the Mount Placid catcher side-stepped quickly and plugged to
third. The decision was a close one and Sam looked sorrowfully at
Mr. York when the latter waved Mr. Gifford out. Mount Placid, too,
failed to get a runner across in that inning and the seventh started
with the score still 3 to 1.
Sam was up, having been left at bat in the sixth, and Sam wanted
desperately to start something! But Mr. Williams had a slow ball that
he didn’t at all like. Twice Sam tried for it and each time hit too
soon. The first result was a foul that third baseman narrowly missed
and the second a mighty swipe through empty air and a loud and
disgusted grunt from Sam. After that, with two strikes and one ball
against him, Sam let two more go by and things looked brighter. The
next delivery was palpably bad and Sam, dropping his bat, trotted to
first amidst the acclaim of The Wigwam boys, wishing that he had
Steve’s ability to purloin bases!
As it turned out, however, Sam was not called on to steal. Mr.
Williams at once set about trying to catch him off his base. He
apparently resented that youth’s luck, and, as Sam thought, even
showed some temper in the vindictive way in which he slammed the
ball across to Mr. Cochran. Sam each time took as much of a lead as
he dared, more than willing that the pitcher should throw across.
Five times Mr. Williams attempted to surprise Sam and five times he
failed, but always by so narrow a margin that he was encouraged to
try it again. Then the pitcher disgustedly turned his attention to
Porter, who was impatiently waiting at the plate, and Sam, watching
for a signal, poised himself on his toes.
The first ball pitched was too good to refuse and Porter leaned
against it. Off it travelled, straight between first and second, and
Sam, racing for the next base, had to leap aside to avoid it. It was
too fast for handling by the infielders, although second baseman
made a gallant attempt, and Sam reached third well ahead of the
throw, while George Porter, a much surprised youth, perched himself
on first. A minute later he was sent to second and stole handily,
Hanford being unwilling to risk a throw-down for fear that Sam
would score. The Wigwam supporters were now making enough
noise for twice their number, and even Mr. Haskins was seen
shouting himself red in the face. Steve, who had sacrificed a strike
when Porter had gone to second, now tried hard to find something
he could hit. But Mr. Williams, after one attempt to catch Porter at
second, settled down again and disposed of Steve with four
deliveries, and there was one gone. Ed Thursby tried bravely to
bring in a run, but only succeeded in making the next out, second to
first. Meldrum was next in order, but Mr. Gifford, trusting to the
psychological effect of introducing a pinch-hitter, called him back and
sent Pete Simpson in to bat for him. Simpson was no more of a
hitter than Meldrum, but that was something the opponents couldn’t
know. Nor did they know the new player’s batting weakness as they
now knew Meldrum’s. Pete was a small youth, rather stocky, and
only fourteen years of age, and he didn’t look especially formidable
as he walked to the plate and, with a somewhat nervous smile which
he strove to make appear confident, swung his bat invitingly.
Hanford experimented with a low ball which Pete disdained and
which went for a strike. Then came a slow one and Mr. York called
“Ball!” Pete knew what he wanted, but Hanford hadn’t yet
discovered it. As a matter of fact, what Pete was wishing for was a
plain, every-day waister in the groove, which was about the only sort
of a ball he could hit! It didn’t look as though he was to get one,
though, for after teasing him with another slow one which was just
too wide of the plate to be a strike, Mr. Williams curved one over the
outer corner and the umpire announced “Strike two!”
“It only takes one, Pete!” called Tom Crossbush from the bench.
“Make him pitch to you!”
Then Mr. Williams slipped a cog and what was meant for a
straight, slow ball went past well over Steve’s shoulder and a howl of
delight went up from the bench.
“He’s got to put it over now!” called Mr. Gifford. “Just tap it, Pete!”
Hanford glanced a bit nervously toward where Sam was taking a
ten-foot lead off third. Suddenly the Mount Placid catcher became
alarmed. A hit meant two runs and a tied score! Beckoning to Mr.
Williams, he advanced halfway toward the box and the two
consulted. This was the visitors’ chance to jibe and they took
advantage of it.
“You’ve got them worried, Pete!” “Up in the air, fellows! Here’s
where we tie it up!” “Play ball! Play ball!”
The coachers added their contributions, while Sam, dancing about
at third, seriously interfered with the conversation between Mr.
Williams and Hanford by threatening to steal home every instant.
Finally the Mount Placid battery returned to their places and Hanford
knelt and gave his signal, or pretended to. What followed was a
pitch-out, a quick peg to the pitcher by Hanford and an equally
speedy throw to third, and Sam, two yards from base, was caught
flat-footed for the third out!
CHAPTER XIV
TIED IN THE EIGHTH

The Wigwam was quiet and disappointed while the teams changed
places. From across the diamond came the applauding cheers of the
enemy. Sam, thoroughly disgusted with himself, donned protector
and mask in grim silence. Joe Groom, who had been coaching at
third, generously strove to take the blame.
“That was my fault, sir! I ought to have known they were up to
some silly trick!”
“No one’s fault but mine,” replied Sam decisively. “I played it like
an idiot!”
Benson went to bat for the home team in the last of the seventh
and cracked out a two-bagger over shortstop and was caught off
second a minute or two later by a quick return from Sam to Porter,
who whirled instantly and pegged to Thursby. The Wigwam
recovered from its gloom and cheered. Then the Mount Placid left
fielder fouled out to Sam and two were gone. But the inning was not
yet over, for Walters, a thin, freckled-faced youth with extraordinarily
long legs, took it into his head to bunt, after once trying to knock
the cover off the ball, and caught Crossbush napping. By the time
Tom had gathered in the rolling ball and sent it to first Walters was
making the turn. Mr. Connell was up next, and, profiting by Walters’
example, he laid the sphere down a few feet from the plate and lit
out for the base like a runaway horse. By the time Sam had dashed
his mask aside, got the ball and pegged to Murdock, the runner was
safe and Walters was on second, and the grey shirts and the green
shirts were shouting madly.
Mr. Phillips, the next batter, had one hit to his credit and, as Sam
had discovered, liked a low ball. So Porter fed him high ones and got
two strikes and one ball on his. Then came a foul and a second
strike. Porter wasted one then and the score was two and two. Sam
called for a fast one and Porter tried it. Unfortunately, Mr. Phillips
outguessed him and when the ball came along he met it squarely for
a long fly into left. Mr. Gifford was after it like a shot, but he had to
run back a dozen yards and when he finally got his hand on it he
failed to hold it. The best he could do was to recover quickly and
throw to third in time to hold the second runner there. Walters
scored and the game stood 4 to 1. With runners on second and
third, things still looked dubious for The Wigwam, and Porter made
them more so by utterly failing to locate the plate with the first three
deliveries! Hanford, who was up, swung his bat and stepped back
and forth in the box. Sam signalled a straight ball and got it for a
strike. Hanford let it go past unchallenged, for he had two more
chances and was waiting for the last one. Again Porter essayed a
fast one in the groove, but this time he failed and Mr. York waved
Hanford to first. The bases filled, Mount Placid cheered exultantly
and the grey-shirted coachers danced and yelped; and the base-
runners too did their level best to rattle the pitcher.
Mr. Williams was at bat now and Sam had what he would have
called a “hunch” to the effect that Mr. Williams was dangerous at this
stage of affairs. While Porter sent the first delivery in, a curve that
failed to win approval from Mr. York, Sam studied the runners on the
bases. At third, Walters was taking a good lead on the wind-up, but
hugging the bag safely at other times. On second Mr. Connell was
watching the baseman carefully in spite of his seeming recklessness.
At first, though, Hanford, feeling safe from attack, was leading a
good twelve feet. Sam tossed the ball back to Porter.
“Keep after him, George!” he called. Then he stooped, dropped his
mitt between his knees, and gave the signal. But it was a closed fist
that Porter saw, and that called for a throw-out. Porter walked to the
side of the box, picked up an imaginary pebble and tossed it away.
Then he tugged at his cap, wound up and sped the ball four feet
wide of the batsman and straight into Sam’s waiting mitt. One step
forward toward first, a quick throw, and the trick was won! Frantic
shouts of warning from coachers, a desperate slide to the bag by
Hanford, a scurry for the plate by Walters! But Murdock had been
ready. At the instant the ball had settled in Sam’s mitt he had run
toward the bag. The throw was perfect and Murdock caught it, fell to
one knee and let Hanford slide into the ball as he tried for safety!
The shouts of delight came from the third-base side of the field,
for across the diamond a dense silence reigned. Sam and Ralph
Murdock received an ovation as they returned to the bench. Mr.
Gifford slapped Sam on the back and many of the boys would have
followed suit had they dared. Pandemonium reigned until Mr. York
called, “Batter up, please!” When Sam, passing the plate to reach
the coacher’s box at first, went by him the umpire smiled as he said
softly: “Quick work, Craig!”
Four to one now and only two innings left! The Wigwam realised
the fact that if the game was to be pulled out of the fire, and they
had by no means given up hope yet, something must be done now,
that it wouldn’t do to count on a ninth-inning rally. And so they went
at the task very determinedly, very carefully. Mr. Gifford, the first
man up, showed no eagerness to hit. Instead he allowed Mr.
Williams to put a strike and two balls over before he made his first
attempt. Then he swung and a foul-tip resulted. At two-and-two Mr.
Williams chose to try a curve and, since the batter refused to be
deceived by it, put himself in the hole. Amidst a strained silence Mr.
Williams wound up again and sent in one of his deceptive slow balls.
But Mr. Gifford had profited by experience, and guessed what was
coming. The result was that he hit slowly and caught the offering
fairly a foot from the end of his bat and the ball went arching gaily
and gracefully into centre field and Mr. Gifford went speeding quite
as gaily—if not so gracefully—to first base. That hit, for it was a hit,
landed untouched between centre fielder and shortstop, with second
baseman just out of the running. It was the fielder who scooped up
the rolling ball and set himself for the throw to second.
Unfortunately for him, however, second base was for the moment
uncovered. Mr. Williams and Mr. Gifford arrived there simultaneously
an instant later, but by that time the centre fielder saw no reason for
throwing!
That was a fine opening for the inning, and no mistake! And The
Wigwam jumped and shouted and pounded each other’s backs and
barked out their cheer. And Steve Brown scuttled to third and
shouted himself hoarse in the desperate attempt to upset Mr.
Williams’ coolness; desperate, since the Mount Placid pitcher was not
easily rattled.
Joe Groom went to the plate looking determined, but only
succeeded in flying out to shortstop. Tom Crossbush managed to
reach first on a scratch-hit past third baseman. Murdock struck out
miserably. The Wigwam’s hopes began to dim. But with Sam up
something might yet happen to their liking, and so they cheered him
encouragingly and held their breaths while Mr. Williams did his
utmost to put him out of the way.
A strike—a ball—another ball, by a scant margin—a foul-strike!
Sam watched and waited, gripping his bat tightly, and looking as
cool as if the outcome of the game might not depend on the next
delivery. Perhaps Sam’s confidence affected Mr. Williams. At least it is
probable that the Mount Placid pitcher never intended to send across
just what he did, for the ball came up to Sam with nothing on it but
the cover and Sam smote it lustily and thirty-odd youths sprang into
the air and shrieked deliriously!
Around the bases sped Mr. Gifford, his flannel trousers a grey
streak above the turf, and behind him came Tom Crossbush. Off for
first leaped Sam, while, far out in right field, the ball was leisurely
descending to earth. Eight fielder was sprinting desperately toward
the fence that enclosed the ground on that side. If only, prayed the
Wigwam supporters, that ball would land on the other side! But it
didn’t. It came down a dozen feet inside the boundary, and Cather,
with a final plucky spurt, shot his hand into the air and—well, then
fielder and ball went down together and rolled over! There was one
breathless instant of uncertainty, broken by the triumphant yells of
The Wigwam when Cather, scrambling to his feet, searched the turf
hurriedly, recovered the ball and made a wretched throw to second
baseman. At that moment Mr. Gifford was trotting across the plate,
Tom Crossbush was past third, and Sam was rounding second.
Second baseman sped the ball home, but too late to catch Tom, and
Hanford desperately pegged it to third. But Sam reached the bag
just as the ball did and had one scuffed shoe snuggled against it
when Mr. Connell tagged him none too gently.
Four to three now! Only one run needed to tie! Two out, but a
man on third! If only Porter could make good! Mr. Gifford consulted
Thursby and The Wigwam waited anxiously. Then a cheer went up,
for Peterson was off the bench and pawing at the bats! Porter was
coming out! Peterson was to bat for him! A hit would tie the game!
Dan Peterson received a veritable ovation as he hurried to the
plate. He was loudly invited to contribute a hit, a two-bagger, a
home run! To bust it! To tear the cover off! To—to——
Then quiet returned, or, rather, comparative quiet, for the
coachers had no intention of letting up on their babel. From back of
first base Joe Groom shouted at the top of his lungs to Sam on third,
and back of Sam Mr. Gifford clapped his hands and added to the
noise. And then Mr. Williams brought down upon himself ridicule and
wrath by deliberately passing Peterson! The Wigwam was incensed
indeed! Mount Placid and Greenwood, however, laughed and
applauded, and Peterson, deprived of the chance to distinguish
himself as a pinch-hitter, scowled darkly at Mr. Williams as he walked
unwillingly to base.
Steve Brown was up then, and Steve had played in hard luck all
day. Not once had he been able to get to first. This rankled in
Steve’s breast, and as he faced the Mount Placid pitcher he resolved
that this time, his last opportunity, he would not be foiled! On the
first ball pitched Peterson legged it for second and Sam danced
forward halfway along the base line toward home. But Hanford knew
better than to risk a throw to second and contented himself with a
motion that sent Sam scuttling back to third. Steve had offered at
the delivery and so had one strike on him. To bring in a run he must
hit safely and Steve waited his chance. But before it came something
happened.
On second Peterson, perhaps disgruntled at the trick worked on
him, was set on showing his contempt for the enemy by risking a
lead that simply cried for punishment. On each wind-up he went
fully half the distance to third. Now Hanford was canny enough, but
that was too great a temptation for him to resist. And so he gave a
signal, Mr. Williams turned quickly, stepped out and shot the ball to
shortstop. Peterson was twelve feet off base and there was but one
thing to do and that was to keep away from the ball long enough for
Sam to score. So he set out toward third and Sam looked on and
watched his chance. It came when shortstop tossed the ball over
Peterson’s head to third baseman. Then Sam set out desperately.
And that, of course, was what Hanford wanted. Third baseman
turned and pegged to the plate while Sam was still ten feet away.
But, alas for Hanford’s hopes! The ball slammed into the dust and,
although he tried desperately to get it, he failed, and while he was
still groping for it with one hand and striving to block off Sam with
his body that youth slid to safety in a cloud of red dust and Peterson
romped to third!
Mount Placid listened gloomily to the visitors’ wild outpouring of
joy, saw them drag the runner to his feet and pull him ecstatically to
the bench, saw Hanford, rather pale and wrathful, slap the dust from
his clothes, recover his mask, and disspiritedly send the ball back to
Mr. Williams; saw, too, Mr. Connell on third trying his best to look as
if he didn’t know he had thrown the game away!
“W! Rah! I! Rah! G! Rah, rah, rah! W! Rah! A! Rah! M! Rah, rah,
rah! Wigwam! Wigwam!! Wigwa-a-arm!!!” And Dick Barry cavorting
about like a thing built of springs, waving his arms and kicking his
legs and shouting his voice away! And the score 4 to 4, and
everyone on the third base side very, very happy and noisy!
And then, after a minute, when one more run might have given
the visitors the victory, when Steve had still another strike to be
scored against him, Peterson, made careless by his previous good
fortune, took just that extra inch forbidden by safety—and the
coacher—and slid back to the bag too late!
That was disappointing, but there was another inning, and if only
they could keep Mount Placid from adding to her score; and could
themselves put just one other little tally across——
And so Mount Placid went to bat for her half of the eighth looking
firmly resolved to do or die, and Mr. Gifford, pulling a pitcher’s glove
on, stepped into the box to do his best. Peterson took the
councillor’s place in left field, Peterson rather chastened in spirit
now. Mr. Williams, first batter, was an easy victim to the infield,
going out at first, Steve to Murdock, and Cather followed him, the
assist going to Tom Crossbush. That brought the head of the Mount
Placid list up, and Mr. Cochran had a fearsome glint in his eye as he
faced the substitute pitcher. Mr. Gifford’s offerings were not very
baffling and the rival first baseman landed on the second delivery
and sent it speeding down the alley between shortstop and third.
One base was all he got, however, for Joe Groom, running in like a
streak, fielded prettily to second. Then Benson followed with a hit
past third and Mount Placid had runners on first and second. But the
danger was over a moment later when Smith, lifting a long fly to the
outfield, saw it settle cosily into Simpson’s hands.
Then it was the ninth, with Steve Brown up and only one run
needed. Steve and Mr. Gifford and Ed Thursby consulted a minute
ere Steve stepped to the plate. “You’ve got to get your base
somehow, Steve,” said Mr. Gifford. “Think you can hit him?” Steve
looked doubtful.
“I’m going to make an awful try,” he said grimly.
“Maybe if you can get him in a hole——” began Ed.
“Bunt,” said Mr. Gifford. “That’s your best chance. Swing like fury
on one and then watch for a good one and just hold your bat in
front of it. If you connect, run like the dickens, Steve!”
“If I should get to first don’t you sacrifice, Ed. Make the bluff, but
don’t swing. That fellow Hanford’s slow on throwing-down and I can
beat him easily.”
“Batter up!” called Mr. York.
CHAPTER XV
STEVE SCORES

Mr. Williams motioned the infielders in and Steve’s hopes dropped.


Evidently the pitcher was looking for an attempt at a bunt. At all
events, Steve’s chance of “getting away with it,” as he mentally
phrased it, seemed pretty slim. He wished he could manage to lay
against the ball just hard enough to carry it out of the diamond,
since, with the infielders all inside the base lines, a short, low fly
would be the safest sort of a hit. But it was soon evident that Mr.
Williams had no idea of letting him so much as touch that ball! The
Mount Placid pitcher was never more deliberate or careful. The first
offering went as a ball and the second looked low, but was called a
strike by Mr. York. Mr. Gifford and Sam were shouting encouragingly.
“Hit it out, Steve!” “Choose your alley!” “All the way ’round this time,
Steve!” Mr. Williams studied the catcher’s signal very attentively,
hesitated, shook his head, looked again, nodded, wound up, and
pitched. The ball broke to the right and Steve stepped warily back
only to realise the next instant that the sphere had crossed the inner
corner of the plate and to hear the umpire fatefully announce,
“Strike—two!”
Steve glared wrathfully at the pitcher as that gentleman again
settled the ball between his fingers, and tried to guess what the next
one was to be. With two strikes against him, it was probable that Mr.
Williams would waste one, but Steve wasn’t certain and so, when
the dirty-white sphere again shot toward him, he glued his eyes to it
and in the scant moment of time that elapsed tried his hardest to
judge it. Then he brought his bat around, there was a slight tingle in
his hands and he was sprinting toward first. But luck was still against
him, for the discouraging cry of “Foul!” caught him halfway along the
path, and he turned back, picked up his bat, and again faced the
pitcher. Steve was hopeless now, and a little desperate. The absurd
notion of striking at the next delivery, no matter what it might be,
and so ending the suspense, came to him, and he dallied with it
while Mr. Williams, slowly and deliberately, wound-up, stepped
forward, and shot the ball once more toward the plate. And then
Steve found himself suddenly undecided, quite lost sight of the ball
for an instant, found it again just as it came close, brought his bat
around half-heartedly in a despairing effort which he was perfectly
certain was a hopeless one, and then felt the shock of bat and ball,
heard the sudden shriek that went up from behind him and, digging
his toes into the dust, put his head down and raced!
That hit was the joke of the game. The ball would have crossed
the outer corner of the plate at about a level with the top of Steve’s
shoes had he allowed it to. Hanford had dropped to his knees to get
it, and whether Hanford or Steve was the more surprised is hard to
say. The latter’s ridiculous swing had, by some stroke of luck, caught
the ball on the tip of the bat. There had been no force in the swing,
Steve had even failed to grasp the stick firmly, but the result could
have been no more satisfactory had he studied and worked for it, for
that ball arose from almost in the dust and described a pretty arch
over the pitcher’s head and descended fifteen feet behind the base
line, and a little to the right of second. Second baseman tried for it
desperately, and first baseman went to his assistance, but the hit
was never in danger of being caught. Had the second baseman been
playing his usual position he would only have had to step back a
couple of yards and put his hand up to have caught it, but with that
player well inside the diamond the ball was quite safe. And so was
Steve, one toe poised on first base and a look of deep surprise on
his countenance. Mr. Gifford was slapping him on the back and
saying, for the sole benefit of the enemy: “No one out, Steve! Play it
safe and look out for a double!”
At the plate Ed Thursby faced the pitcher and gave an excellent
imitation of a man wanting to bunt. Steve took a six-foot lead. Mr.
Williams turned. Steve slid back to base. The ball slapped into first
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

textbookfull.com

You might also like