Professional Documents
Culture Documents
Module 1
Objective one: State the purpose of the main components of a computer system
Input devices are used to send signals/data to the system from the outside world while output
devices are used to receive information/data from the system.
Input devices: Keyboard, Mouse, Light (optical) Pen, Barcode Scanner, Joystick, Gamepad,
Webcam, and Scanner.
Considered Both: Camera, Headset, Touch screen, Flash Stick and Modem
A port serves as an interface between the computer and other computers or peripheral devices.
Specialized Devices
Voice Recognition
Text to Speech
-Memory Types
The data stored in the RAM can be accessed much faster than data stored in secondary
storage devices.
Done By: Gideon Ramcharan
It is volatile/dynamic which means if the computer switches off; the RAM loses all the
information stored on it.
It holds data and programs which are require for the computer to start.
It is non-volatile.
It can have programs or data written to it after manufacturing but cannot be re-written.
It can be erased after data/programs are stored on it by the use of ultra violet light then
written to again.
-Memory Features
Word Size- The number of bits that a CPU can process at one time
Volatility- Volatile memory is computer memory that requires power to maintain information
stored on it while Non-Volatile memory does not require power to maintain information stored
on it.
Done By: Gideon Ramcharan
-Storage Devices
Access Speed: The rate at which data can be retrieved from storage devices
Serial Access: records are accessed in the order in which they have been stored (Magnetic Tape Drives)
Direct Access: records are accessed by simply selecting file name from options.
-Security
Voltage Regulators: Provides a constant voltage rate when electricity is being passed.
Uninterruptible Power Supplies (UPS): Used to prevent against damage to hardware in the event
of a power loss by switching to battery backup when the power shuts down.
-Types of computers
Supercomputer:
-Very expensive
-For special applications that require a lot of mathematical calculations such as animated
graphics, fluid dynamic calculations, nuclear research, and weather forecasting.
Mainframe:
Microcomputer:
-Small
-Inexpensive
Laptop:
-Inexpensive
PDA:
-mobile device
MODULE 2
Problem Solving- The process of working through details of a problem to reach a solution,
Problem solving may include mathematical or systematic operations and can be a measurement
of an individual's critical thinking skills
5) Implement it
6) Review it
1) Narrative
2) Flow Charts
3) Pseudocode
Done By: Gideon Ramcharan
I/O statements
Selection/decision logic- One of a number of statements is executed depending on the state of the
programs.
This is where a set of instructions are repeated based upon the satisfaction of a specific
criteria (unbounded) or achieving a set number of times to be repeated (bounded).
Bounded Iteration- where there is a set start and stop value to execute a set of instructions (For
Loop)
Unbounded Iteration- Where execution is dependent on particular criteria to loop (While, Repeat
Until / Do While)
Done By: Gideon Ramcharan
GENERAL TERMS
Variables- a named container of a specific data type that can hold a value which may change
(are common in pseudocode)
Constant- is a value that never changes throughout the execution of an operation/program (are
capital in pseudocode)
Data Type- allows the system to know what type of operations can be performed on the data
Boolean or Logical Data Types- a variable that holds only true or false values
Functions
A function is a named set of instructions which is apart from where execution started and does a
specific task. It may or may not return a value and accepts 0 or more parameters/arguments.
[return value]functionName([value1],[value2])
Mathematical functions-
Random()
String Fuctions-
Date(), Time()
Done By: Gideon Ramcharan
Operators
Operators are used to compare/join two or more values and give a numerical/logical/Boolean
result.
Mathematical Operators- joins two numerical values and gives a numerical result
+-/*%^
Logical Operators- joins two boolean values and gives a logical result.
NOT AND OR
Arrays
A method that allows for multiple values to be stored in a single variable and individually
accessed via an index
Structures
An abstract data type that has multiple native variables used together to form a user defined
variable
Done By: Gideon Ramcharan
MODULE 3
Programming Paradigms
Procedural/Imperative-
Object Oriented-
These objects may then act as templates for other objects which can
inherit their behaviours and attributes or supersede their super classes
own.
Properties
Where functions, not objects nor procedures, are used as the building
blocks of the program
Properties-
Declarative-
Scripting-
The process whereby tokens from the lexer are converted into a node
on a syntax tree
5) Code Optimization-
The process whereby the optimizer analyzes the intermediate code for
redundancies and useless code
6) Code Generation-
Assemblers-
Compiler-
Virtual Machines
Interpreters
Machine code
All programs are converted into machine code before they can
be executed.
Assembly language
High Level
Programming Languages
It performs preliminary operations, such as including files, to the code before the
compiler ‘sees’ it.
Linker- a program that takes in object files generated by a compiler and library
files and combines them into a single executable program.
CPU components
ALU(Arithmetic Logic Unit)
CU(Control Unit)
Registers- special, small, high speed storage area within the CPU. The store
data/instructions or addresses to data/instructions that is to be processed by the
CPU.
Done By: Gideon Ramcharan
NAME Purpose
Accumulator (AC) & Multiplier (MQ) Temporarily holds operands and results of
ALU operations.
Done By: Gideon Ramcharan
Instruction Format
An instruction must include and operation code (op code) and zero or more
operands.
-stack is used, pops two operands from the stack and pushes the result
Example:
Evaluate X=(A+B)*(C+D)
ADD TOS<-A+B
ADD TOS<-C+D
MUL TOS<-(C+D)*(A+B)
POP M[X]<-TOS
Done By: Gideon Ramcharan
Example:
OPCODE ADDRESS
X=(A + B)X(C + D)
LOAD A ; AC <- M [A]
ADD B ; AC <- AC + M[B]
STORE T ; M [T] <- AC
LOAD C ; AC <- M [C]
ADD D ; AC <- AC + M[D]
MUL T ; AC <- ACxM[T]
STORE X ; M[X] <- AC
-Assumes the destination address is the same as that of the first operand
-Memory addresses for the two operands and one destination needs to be specified
-Each address fields can be used to specify either a processor or a memory operand
OPCODE OPERAND
0 3 4 7
16 bits:
FIXED VARIABLE
Arguably faster execution Uses less memory
Used in RISC (Reduced instruction set Used in CISC machines (Complex
computing) processors (PowerPC and Instruction set computer)
Alpha)
Memory space is wasted as all Each instruction uses the exact amount
instructions must occupy the same of memory space it requires
amount of memory even though the
instructions may not need that amount
Done By: Gideon Ramcharan
of memory space
Addressing Modes -Specifies a rule for interpreting or modifying the address field
of an instruction before the opcode is actually executed
1) Immediate-
Eg. ADD 5
5 is the operand
2) Direct-
Eg. ADD A
3) Indirect
FETCH
DECODE
Execute
6) The Control Unit (CU) then passes the decoded instruction to the Arithmetic
Logic Unit (ALU) where it is executed.
Done By: Gideon Ramcharan
Instruction Set- The basic types of instructions that the CPU can execute
Types-
ADD
COMPARE
INPUT
JUMP
JUMP IF
LOAD
OUTPUT
STORE
Cache Memory- Specialized fast memory near the CPU which holds data or
instructions that are frequently used, allowing for faster access times.
Clock Speed- Also called clock rate, the speed at which a microprocessor executes
instructions. Every computer contains an internal clock that regulates the rate at
which instructions are executed and synchronizes all the various computer
components. The CPU requires a fixed number of clock ticks (or clock cycles) to
execute each instruction. The faster the clock, the more instructions the CPU can
execute per second.
Clock speeds are expressed in megahertz (MHz) or gigahertz ((GHz).
Data Representation
Done By: Gideon Ramcharan
Decimal Binary Octal Hexadecimal Binary Coded Digit
0 0 0 0 0000
1 01 1 1 0001
2 10 2 2 0010
3 11 3 3 0011
4 100 4 4 0100
5 101 6 5 0101
6 110 7 6 0110
7 111 7 0111
8 1000 8 1000
9 1001 9 1001
As we go left, the value of each digit is increased two-fold. First, determine the position value of
each digit. Write the value (weight) above each digit .
25 24 23 22 21 20
weight 32 16 8 4 2 1
binary digit 1 1 0 1 0 1
Perform repeated divisions by 2 and save the remainders. The remainders, in order, from bottom
to top, forms the binary equivalent from right to left.
43/2 = 21 remainder 1
21/2 = 10 remainder 1
10/2 = 5 remainder 0
5/2 = 2 remainder 1
2/2 = 1 remainder 0
1 / 2 = 0 remainder 1
The remainders from bottom to top form the binary equivalent from left to right, thus:
43 = 101011
BINARY ADDITION
Very rarely will we find it necessary to add more than two binary numbers at any one time.
1. If we add a binary zero to another binary zero, the result will be binary zero.
1. If we add a one to a zero (or zero to one) the result will be one.
1. If we add a one to a one in decimal the answer is two, but in binary there is no such thing as
a binary digit “2”. We must carry a binary digit “1” to the next position to the left.
0 0 1 1
+0 +1 +0 +1
0 1 1 10
E.g.
1011
BINARY SUBTRACTION
Just as we carry the value two in binary addition, so, in subtraction, we need to borrow two
sometimes in order to subtract.
1. If we were to subtract 1 from 10, we would expect the answer to be 1 since 1 + 1 =10 in
binary.
02
10 10
-1 -1 Just as in decimal, we can borrow 10 from the place to the left in order to
E.g.
12
1001
-111
0100
Done By: Gideon Ramcharan
BINARY FRACTIONS
100.10112
The positions after the decimal (1) .5 or ½ ; (2) .25 or 1/4 ; (3) .125 or 1/8; (4) .0625 or 1/16
.5
.0
.125
.0625
Convert Decimal to Binary: The whole number is calculated using the division by 2. (Multiply
by the fraction part until 0 is realized) the answer is written downwards using the values before
the decimal.
1.375 X 2
0.750 X 2
1.500 X 2
109/8 = 13 remainder 5
13/8 = 1 remainder 5
109/16 = 6 remainder 13
Use 3 bits to represent the binary of each digit in Octal Nos. and 4 bits to represent the binary of each
digit in Hexadecimal.
1 5 5
Use 4 bits to represent each digit. Use 1010 for positive and 1011 for negative integers.g;-
+ 3 5 8
An integer is a whole number, negative or positive. It is easy to convert a positive integer from
decimal to binary. The larger the number we wish to represent the more bits required.
Using 4 bits, one bit is used for the sign of the number : 0 for positive, 1 for negative. The
remaining 3 bits are used to store the binary equivalent of the number (without the sign).
e.g. +5 is represented
0 101
Since the maximum value that can be stored with 3 bits is 7, the range of integers which can be
represented is -7 to +7.
Done By: Gideon Ramcharan
TWO’S AND ONE’S COMPLEMENT REPRESENTATION
Please note Two’s Complement is used for negative numbers not positive numbers.
E.g. You are asked to find the two’s Complement of +4 and -5 using 4 bits.
For +4, You first find the binary of 4 and add 0 to make up number of bits required i.e. 0100
For -4, You first find of the binary of 4, then add 0s to make up number of bits required, then
find the One’s Complement of the number, then Two’s Complement.
● Two’s Complement.
The two’s complement of a binary number is obtained by adding 1 to its one’s complement. E.g.
The 4-bit one’s complement of 0110 is 1001. Therefore, the 4-bit two’s complement of 0110 is
1001
+ 1
1010
Done By: Gideon Ramcharan
FLOATING POINT REPRESENTATION
2. Sign for Exponent i.e 1 for negative and 0 for negative (the exponent values are 00 for 0; 01
for 1; 10 for 2 and 11 for 3.
3. Mantissa value
Please note a positive sign for the exponent means to move the decimal of the mantissa to the
right according to the value of the exponent and a negative sign for the exponent means to move
the decimal point to the left according to the value of the exponent, placing a 0 to indicate no. of
times move to the left.
Number represented by 0 101 1100 is 0.1100 x 2-1 = 0.011002 = (0.25 + 0.125)10 = 0.37510
0 101 0110
0 110 1100
Character Codes
- are a set of binary patterns used to represent the character set. E.g.
● ASCII (American Standard Code for Information Interchange) it is the commonest code. It
is 7-bit code and it handles up to 128 characters i.e. 27.
● EBCDIC (Extended Binary Coded Decimal Interchange Code). It is an 8-bit code which
therefore permits 256 characters i.e. 28.