Professional Documents
Culture Documents
Here you will find the answers to the ‘Check Hardware (page 7)
your understanding’ questions and the ‘Now test
yourself’ exercises in the book. 1 Device Reason
Keyboard Typing in data to a computer
Unit 1 Scanner Copying documents
Foot mouse Useful for someone who cannot
Hardware (page 3) move their arms
1 Any five from Microphone Entering sounds into the
• printer computer
• central processing unit (CPU)
• soundcard 2 Device Input Output
• motherboard
Keyboard ¸
• graphics processing unit (GPU)
• scanner Scanner ¸
• storage units (primary and secondary) Foot mouse ¸
• mouse, roller ball, touch pad
• sip-puff tube, foot mouse, eye-typer Printer ¸
• microphone Roller ball ¸
• monitor
• speaker. Monitor ¸
2 • Von Neumann model 3 a) RAM is volatile
• Harvard model
3 Hardware (page 9)
CIR Current Instruction Register
MAR Memory Address Register 1 1024
ACC Accumulator 2 One character
3 It helps speed up processing when applications
PC Program Counter
are using 3D graphics and video animation.
Hardware (page 5) 4 Any one from
• mobile phones
1 • video game consoles
CU Decode ALU • digital cameras
• DVD players
• GPS
• microwave ovens.
te
cu
Fet
Exe
128 64 32 16 8 4 2 1 Denary
0 0 1 1 0 1 0 0 52
0 0 0 1 1 0 1 0 26
ii) Mesh 0 0 0 0 1 1 0 1 13
to keep the computer running smoothly by, for program is linked to library routines that
instance, defragmenting the hard drive. do not exist.
• Run-time errors – occur when the program
Principles of programming (page 41) is being run. For example, a program is
asked to display the price of an item but
High-level Low-level that item cannot be found.
B A b) i) Lexical analysis – All comments and
spaces are removed, keywords are
E C
replaced by ‘tokens’ and a symbol table
F D is created which holds the addresses of
variables, labels and subroutines.
Now test yourself (page 41) ii) Syntax analysis – Each statement is checked
against the rules of syntax for the assembler,
1 a) Both are low-level languages, but machine
such as spelling or grammar, and that the
code uses pure binary numbers while
sequence of characters, symbols, items or
assembly code uses mnemonics.
tokens obey the rules of syntax.
b) Java is an example of a high-level language.
Programmers prefer to use high-level languages iii) Semantic analysis – Checking that the
because they are generally easier to use and statements, structure and data types obey
understand than low-level languages. They are the rules of the compiler and making sure
problem orientated, which facilitates creating that variables used in the program have
programs for a particular use or problem. been declared.
They tend to have built-in functions and single iv) Code generation – Generating the machine
commands that can carry out complex tasks. code.
They are like natural spoken languages and v) Optimisation – Attempting to reduce the
it is possible to use meaningful and complex execution time of the object program.
variable names.
c) A compiler translates a complete program
Now test yourself (page 43) written in a high-level language, known as
the source code, into machine code in one go
1 a) Three from: without stopping.
• Trace – prints out or displays the order in The advantages of a compiler are that
which the lines of a program are executed, • a compiled program runs faster than an
and possibly the values of variables as the interpreted program
program is being run. • it checks all lines of coding whereas an
• Break point – interrupts a program at a interpreter only checks the one being
specific line allowing the programmer to executed.
check the current value of a variable.
The disadvantages are that
• Variable watch – also displays the current
• you only see the errors at the end, making
value of any variable.
the program harder to debug
• Single stepping – allows the program code
• the process takes a long time as the whole
to be executed one line at a time
program has to be recompiled every time
• Store dump – displays the contents of all
an error is corrected.
the stores used in the program.
• Memory inspector – displays the contents Security and data management (page 49)
of all the stores in a defined section of
memory. 1 A strong password contains a mixture of upper
• Error diagnostics – displays error and lowercase letters, digits and special symbols,
messages to help the programmer is changed regularly, is not related to any
diagnose what has gone wrong. personal details like dates of birth or pet names
b) Your IDE will almost certainly have some or all and is never revealed to anyone.
of the tools mentioned in part (a) above. Well original file size
2 Compression ratio =
done for programming using an IDE! compressed file size
Now test yourself (page 46) The compression ratio is 7:1 which means that
the original file is seven times bigger than the
1 a) Two from: compressed one.
• Syntax errors – occur when the program 50 × 7 = 350
is being compiled, such as by not closing
brackets. The original file was 350 KB.
set maximum = 0
set minimum = 0 Compare 8 and 9.
output “Please type in a number: “
No swap necessary. 8 and 9 are now in position
input y
maximum = y Start from the beginning again
minimum = y
4 3 8 9
while y <> 0
if y > maximum 4 is larger than 3 so swap.
maximum = y
end if 3 4 8 9
if y < minimum
minimum =y 4 is less than 8 so no swap
end if
output “Please type in a number: “
3 4 8 9
input y 8 is less than 9 so no swap
end while
All numbers are now in the correct order.
output “Minimum is “,minimum,” and
“,”Maximum is “,maximum b) 8 4 9 3 8 5 7 3
Python answer: Choose the middle number and compare it
maximum = 0 with 4. (Because there are an even number of
minimum = 0 numbers, we take the one nearest the middle.)
y = int(input(“Type in a number: “))
4 is less than 8 so discard the 8 and everything
maximum = y
to the right.
minimum = y
while y != 0: 8 4 9 3
if y > maximum:
maximum = y Choose the middle number and compare it
if y < minimum: with 4.
minimum =y 4 is less than 9 so discard the 9 and everything
y = int(input(“Type in a number: “)) to the right.
if y == 0:
break 8 4
print( “Minimum is “,minimum,” and
“,”Maximum is “,maximum) 4 is the correct number and so we can stop.
2 a) 8 4 9 3 Programming languages (page 78)
Compare 8 and 4.
8 is larger than 4 so they swap places. Mnemonic code Description of action