Computer Science Ocr - j277
Computer Science Ocr - j277
Computer
Science
OCR J277
S Robson and
PM Heathcote
Contents
Paper 1 – Computer systems
Section 1
Systems architecture, memory and storage 1
Section 1.1 Architecture of the CPU 2
1.2 CPU performance 5
1.3 Memory 8
1.4 Secondary storage 10
Section 2
Data representation 16
Section 2.1 Units of data storage and binary numbers 17
2.2 Binary arithmetic and hexadecimal 20
2.3 Characters 24
2.4 Images 25
2.5 Sound 28
2.6 Compression 29
Section 3
Computer networks, connections and protocols 34
Section 3.1 The Internet and wide area networks 35
3.2 Local area networks 38
3.3 Wireless networking 43
3.4 Client-server and peer-to-peer networks 45
3.5 Standards, protocols and layers 48
Section 4
Network security and systems software 53
Section 4.1 Network threats 54
4.2 Identifying and preventing vulnerabilities 58
4.3 Operating systems 61
4.4 Utility software 64
iv
Section 5
Ethical, legal, cultural and environmental impacts of digital technology67
Section 5.1 Computer systems in the modern world 68
5.2 Ethical, cultural and environmental issues 72
5.3 Legislation and privacy 76
Section 7
Programming 105
Section 7.1 Programming fundamentals 106
7.2 Sequence and selection 111
7.3 Iteration 114
7.4 Arrays 117
7.5 Procedures and functions 120
7.6 Records and files 124
Section 8
Logic and languages 131
Section 8.1 Logic diagrams and truth tables 132
8.2 Defensive design 135
8.3 Errors and testing 138
8.4 Translators and facilities of languages 144
8.5 The Integrated Development Environment 146
v
Paper 1 – Computer systems
Section 1
Systems architecture, memory and storage
1.1 Architecture of the CPU 2
1.2 CPU performance 5
1.3 Memory 8
1.4 Secondary storage 10
Objectives
• Describe the architecture of the CPU 1
• Explain the purpose of the CPU as fetching and executing instructions stored in memory
• Describe what actions occur at each stage of the fetch-execute cycle
• D
escribe common CPU components and their function: ALU (Arithmetic Logic Unit),
CU (Control Unit), cache, registers
• Explain the role and operation of the following CPU registers used in Von Neumann
architecture: MAR (Memory Address Register), MDR (Memory Data Register), Program
Counter, Accumulator
• Describe how common characteristics of CPUs affect their performance: clock speed,
cache size, number of cores
• Explain the purpose and give typical characteristics and examples of embedded systems
• Explain the need for primary storage
o Describe the key characteristics and purpose of RAM and ROM
o Explain the need for virtual memory
• Describe the need for secondary storage including optical, magnetic and solid state storage
• Compare advantages and disadvantages between each type of storage device/medium
• Discuss data capacity of storage devices and calculate data capacity requirements
• S
elect suitable storage devices and storage media for a given application and the advantages
and disadvantages of these, using characteristics: capacity, speed, portability, durability,
reliability, cost
Memory
CPU
Input (processor) Output
Secondary
1 storage
All computer systems must have a central processing unit (CPU), also called simply the
processor, and at least one input device that gets data from the real world. This could be a
mouse and keyboard on a conventional PC, a temperature sensor (thermistor) in a commercial
greenhouse or the microphone on a mobile phone.
Input devices take real world data and convert it into a form that can be stored on the computer.
The input from these devices is processed and the computer system will generate outputs. The
output device could be, for example, a conventional computer screen, an actuator that opens
or closes a greenhouse window, or the speaker that produces sound on a phone.
The computer must have memory (primary storage), used for holding instructions currently
being executed and data that is being used.
Any computer system will have these four basic components.
The fifth component is secondary storage. The computer system may need to use stored data
to perform the processing and, as a result of processing input, may generate data that is then
stored. Storage devices such as hard disks can hold large amounts of data including databases,
text documents, programs, music files and photographs.
78235 10011
97+
1 1 1 11 1 +
1 1
78332 11010
Notice that you carry 1 when you get to Notice that: 0+0=0
ten in a column so 5+7=12, write 2 in 0 + 1 or 1 + 0 = 1
that column but carry 1 group of ten.
1 + 1 = 0 carry 1
1 + 1 + 1 = 1 carry 1
2 10101100
00010001+
00101101
10000101+
00101101
10000111+
10111101 10110010 10110100
Overflow
The biggest number you can represent with 8 bits is 255 (i.e. 128+64+32+16+8+4+2+1).
If you add two binary numbers together that result in a number bigger than 255, it will need
9 or more bits. A computer stores things in memory in a finite amount of space. If you cannot
represent the number in that amount of space because it is too big, then overflow occurs.
For example:
(252) 11111100
(15) 00001111+
(267) 100001011
The computer would need 9 bits to represent 267 so this 9th bit doesn’t fit in the byte allocated.
This is what is meant by an overflow error.
Lossy compression is a data encoding method where files are compressed by removing some
of the detail. For example, photographs can be stored using fewer colours so fewer bits are
needed per pixel. This type of compression is used to compress images, audio files and video
files, where it is easy to recognise an image or sound clip even if some data is missing.
A bitmap image (.bmp) is an uncompressed version of an image. If you save the same
photograph as a JPEG file then it is still a high quality image with a colour depth of 24 bits but
some of the data is lost where it is unlikely to be noticed.
Reduction of file size can also be achieved by reducing the colour depth from 24-bit colour, to
8-bit colour, for example. The human eye can tell the difference at this stage. You will see solid
blocks of colour instead of gradual transitions in the photograph.
Here is a section of a photograph enlarged so you can see the difference:
(b) n overflow error can occur when adding two 8-bit binary numbers.
A
Describe what is meant by an overflow error. [2]
OCR A451 June 2014 Qu 3
(b) The security code for an alarm system is a long binary number which begins
10001111100101111011 …
The technicians prefer to use hexadecimal to enter the security code.
2 (i) When the number is converted into hexadecimal, the first two digits are 8F
as shown below.
Complete the gaps to show the next three digits.
Binary 1000 1111 1001 0111 1011
Hexadecimal 8 F …….. …….. ……… [3]
(ii) Explain why the technicians prefer to use hexadecimal. [2]
OCR A451 June 2013 Qu 5
(b) In the ASCII character set, the character codes for the first three capital letters are
given below.
Letter ASCII character code
A 0100 0001
B 0100 0010
C 0100 0011
(i) State how the ASCII character set is used to represent text in a computer. [2]
(ii) Convert the word CAB into binary using the ASCII character set. [2]
(iii) Explain why the ASCII character set is not suitable for representing text in all the
languages of the world. [2]
OCR A451 Jan 2013 Qu 8
Encryption is used primarily to protect data in case it has been hacked or accessed illegally. Data
that is being transmitted over the Internet is vulnerable to hackers. For example, someone who
uses an online shopping site will have to type in their payment details, such as a credit or debit
card number, and it is essential that this information is kept secure. If they are paying by PayPal,
they will have to type in their email address and password, which needs to be kept safe from
anyone intercepting the transmission.
Whilst encryption won’t prevent hacking, it makes the data incomprehensible unless the recipient
has the necessary decryption tools.
Encryption terminology
• Plaintext: the original message to be encrypted
• Ciphertext: the encrypted message
• Encryption: the process of converting plaintext into ciphertext
• Key: a sequence of letters, numbers and other characters used to encrypt or decrypt
• Encryption algorithm: the method for encrypting the plaintext
Symmetric encryption
Symmetric encryption uses a secret key which can be a combination of letters, numbers and
other characters. A single key is used to encrypt and decrypt a message and must be given to
the recipient of your message so that they can decrypt and read it.
Cipertext Ciphertext sent Message
Plaintext Message
Key shared with recipient separately
Key Key
A very simple example of symmetric encryption is the Caesar shift cipher, in which each letter is
replaced by a letter n number of positions further on in the alphabet. The key in this case is 3:
X Y Z A BCDE F GH
Y Z A BCDE F GH I
Q2 Given the key 5, decode the encrypted message KNWJHWFHPJW BNQQ QTXJ
Computer technology impacts just about everything we do. Here are a few areas to consider.
Communication
We can keep in touch with friends and family all over the world through email, texting, phone
calls and social networking sites. The latest news about world events can be spread instantly. We
can find out whether a train is on time, what’s on at the cinema, or exactly where a friend is at
this moment, using our smartphones.
Can you imagine having to wait months for news of a family member who has emigrated to
another country?
Employment
Computer technology has had a huge impact on employment. Many types of work have
disappeared, and new jobs have been created.
Computer technology has already led to the loss of thousands of different jobs, for example in:
• clerical work
• manufacturing
• journalism
Robots could soon surpass humans in routine legal work, language translation and medical
diagnosis – but plumbers, gardeners and physiotherapists will be hard to replace.
Name three jobs that you think could be computerised, and five jobs that cannot
Q1 easily be computerised.
Shopping
Online shopping has given customers access to many different products that were traditionally
difficult to purchase, as well as day to day items. This easy access has, in many towns,
contributed to the closing of local and national stores leading to empty shops on the high street.
The same list of numbers is sorted into ascending order using an insertion sort:
9, 5, 4, 15, 3, 8, 11, 2
On each pass, the current data item is checked against those already in the sorted list (as
shaded in the diagram). If the data item being compared in the sorted list is larger than the
current data item, it is shifted to the right. This continues until we reach a data item in the sorted
90 Section 6 Algorithms
Example 8
if emailAddress is not
lowercase then
emailAddress No display Convert to lowercase
contains @? error message
endif
Yes
Write emailAddress to
emailAddress No convert to
customer file 6
lowercase? lowercase
Yes
write emailAddress
to customer file
END
The if statement to check whether the address is lowercase is not needed. Modify
Q20 the algorithm so that it performs the same task without the if statement.
Write a pseudocode algorithm which inputs 10 numbers. Each time a number less
Q21 than zero is input, the program displays which number it is, and its value. When all
numbers have been input, display the average of all the negative numbers. Your
algorithm should allow for the fact that there may be no negative numbers.
Sample output could be, for example:
Number 3 -8
Number 7 -20
Average of negative numbers = -14
Error diagnostics
Once a program has been entered it can be saved and translated to machine code by an
interpreter or a compiler. The interpreter or compiler will run error diagnostics on each line
that the programmer has entered, when they try to run the saved program. The IDE will then
allow them to correct any syntax errors, save the program, translate to object code using the
interpreter or compiler and run it again. When the syntax errors have all been corrected and the
program is run again, the IDE may discover and report a runtime error.
Can you identify the problem? What must be amended to correct the program? There
Q8
are more errors in the program – if you are a Python programmer you can try running
the program.
4 4
8 8
6 6
2 2
3 3
5 5
7 7
1 1
Section
Section
Section
Section
Section
Section
Section
Section
Section
Section
Section
Section
Section
Section
Section
Section
Paper 1: Computer systems
Paper 1: Computer systems
1.1 Systems architecture
1.1
1.2
Systems architecture
Memory and storage
1.2
1.3
Memory and storage
Computer networks, connections and protocols
1.3
1.4
Computer networks, connections and protocols
Network security
1.4
1.5
Network security
Systems software
1.5
1.6
Systems software
Ethical, legal, cultural impacts of digital technology
1.6 Ethical, legal, cultural impacts of digital technology
Paper 2: Computational thinking, algorithms and programming
Paper 2: Computational thinking, algorithms and programming
2.1 Algorithms
2.1
2.2
Algorithms
Programming fundamentals
2.2
2.3
Programming fundamentals
Producing robust programs
2.3
2.4
Producing robust programs
Boolean logic
2.4
2.5
Boolean logic
Programming languages and IDEs
2.5 Programming languages and IDEs
The content in each section of the textbook covers the same specification points as the corresponding downloadable
The content
teaching unit,ine.g.
each section
Section of the textbook
1 complements covers
Unit 1. the same specification points as the corresponding downloadable
teaching unit, e.g. Section 1 complements Unit 1.