0% found this document useful (0 votes)
13 views

Computer Programming

Ordinary level computer science note

Uploaded by

Konjoh Nchinda
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Computer Programming

Ordinary level computer science note

Uploaded by

Konjoh Nchinda
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/ 21

1

ORDINARY LEVEL COMPUTER SCIENCE


COMPUTER PROGRAMMING
Introduction
A computer can perform both simple and complex tasks with very high speed and accuracy. However, a
computer cannot perform any task – simple or complex, of its own. They need to be instructed about “how” the
task is to be performed. The set of instructions that instruct the computer about the way a task is to be performed
is called a program. Programming is the activity of writing computer programs. It involves taking an algorithm
and encoding it into a notation, a programming language, so that it can be executed by a computer. The
instructions of a program
are made up of statements written in some languages specially designed for this purpose. These languages are
called programming languages. Computer programming deals with the basic of a computer program; how it
works, how it is designed, how it is fixed.
• Programming is the act of developing computer software (computer program). A computer
program consists of one or more sets of actions to be performed to accomplish a particular task.
Computer programs are written to instruct the computer to carry out specific task or to solve
particular problems. Computer programs are written in languages called programming languages.
The programming process will generally require that you;

I. Specify task
ii. Write the algorithm for the solution to the problem
iii. Write computer program (code) corresponding to the algorithm

iv. Test and debug the code


v. Maintain the program

PROGRAMMING TOOLS
The two main ways in which you give instructions or commands to the computer is by using an interpreter and
the other a compiler.
✓ Compiler is a special program which translates program written in high level languages into
machine language. The original program is called source program and its translation is
called object source. With compilers you write your code in a file(s) using an editor. You then
run the compiler and see if it accepts your program. Compiled languages include; Pascal, C++, C,
Fortran.
✓ Interpreter: It converts one instruction into a machine code and then executes it before going
to the next instruction while a compiler converts the entire program from a high-level language

COMPILED BY KONJOH ABRAHAM NCHINDA. TEL: 678236011


2
ORDINARY LEVEL COMPUTER SCIENCE
into machine code.
With the interpreter, the language comes as an environment where you type in commands
at a prompt and the environment executes them for you. If anything goes wrong, the interpreter
has a debugger to help you track down the problem.
A Text Editor
A text editor is a piece of computer software for creating and editing plain text. In a plain text, one byte of data
represents a character of text.
Source Code Editor
It is a text editor program designed specifically for editing source code of computer programs.
Database Management System DBMS
It is a set of computer program that control the creation, maintenance and the use of database with computer as a
platform of an organization and its end users.
Debugger
A software bug is simply an error or flaw, mistakes, failure or fault in a computer program system that produces
an incorrect or unexpected result or causes it to behave in unintended ways.
Debugging simply refers to the process of removing bugs or faults or mistakes from a program.
INTEGRATED DEVELOPMENT ENVIRONMENT IDE
Also called Integrated Design Development is a software application that provides comprehensive facilities to
the computer programmers for software development. An IDE normally consist of a source code editor, a
compiler and an interpreter, automation tools, a debugger.
Phases in writing a program
When writing a program, most programmers follow a software development process. A typical software
development process consists of 5 stages;
• Understanding the problem (specify task)
• Design a solution (write an algorithm for a solution to the problem)
• Write a program (code the algorithm)
• Test the program
• Maintaining the program
I. Understanding the problem:
First, the problem is analyzed in order to form a precise specification and the program objective
defined. The specification should include the input that is required and the output that must be
produced.
II. Design a solution:
Here, the algorithm is devised or produced and the programmer ensures that the problem is

COMPILED BY KONJOH ABRAHAM NCHINDA. TEL: 678236011


3
ORDINARY LEVEL COMPUTER SCIENCE
been solved correctly (verification) and that the correct problem is been solved (validation).
Some questions could be asked at this stage:
▪ What should the user interface be?
▪ How should time to complete the program?
▪ How should the program be organized?
▪ Who will the target user be?
III. Writing a program:
After a solution has been developed the next step is to write a program code. This process
involves implementing an algorithm using some programming language. A text editor is
generally used to create what is called the source code file. The source code is then
compiled.
Compile and run: Here the source code is been converted into executable code.
Executable code is code in the machine language of that computer. This result in an
executable file that is a runnable program.
IV. Testing the program:
The most basic testing can be done by running the program and manually checking the
results. Three types of testing normally take place during this step;
- Unit testing
- White box testing
- Black box testing
Unit testing is normally performed by programmers as code is written. With unit
testing, specific code units are tested in isolation.
White box testing refers to testing done by a person who has no knowledge of the program
code.
Black box testing refers to someone who has no idea of how the code is written.
V. Maintaining the program:
After code has been thoroughly tested, the fifth and the final step are maintaining the
programming.
The programmer maintains it by modifying the code to increase performance, add new
features adapt the program to a new environment, fix problems [flaws, bugs and security
vulnerabilities].
Documentation
The first part of every program should always contain detailed documentation describing
key aspects of the program. It should include program overall purpose, the name of the

COMPILED BY KONJOH ABRAHAM NCHINDA. TEL: 678236011


4
ORDINARY LEVEL COMPUTER SCIENCE
programmer, the date the program was late updated and any other useful information.
PROGRAM STATEMENT AND EXPRESSION
In any programming language programmers follow well defined rules called syntax to write
programs.
• A Syntax refers to the rules governing how statements can be formed in a programming language.
• A Statement is a line of code that is used to perform specific task e.g. if (x==5){print  x is equal to 5;}.
Variables: Computers are capable of working with data through the use of variables which could
either be numerical or character. A variable is a number that changes or varies.
Declaration statement: It specifies a type for a variable. Three basic C programming
types (data types) are int, float, and char.
✓ Int: It is used for whole numbers without decimal points.
✓ Float: It is used for real numbers with decimal.
✓ Char: It is used for keyboard character or letter values
Conditional statement: It is one which makes the computer compare two or more
variables in some way and the side that the output is either true or false. The comparison is
repeated and code is run until condition becomes false. An IF statement is an example of a
conditional statement.
- A conditional statement is known as conditional expression
BASIC OPERATORS
== means  is equal to
= or = means is not equal to
means less than, = means less than or equal to
 means greater than,= means greater than or equal to
1. ARITHMETIC OPERATORS
The main arithmetic operations in C programming are:

Operators Meaning Example Results


 Multiplication XY Product of x and y
 Division XY Quotient of x and y
 Modulo XY Remainder of x divided by y e.g. 52=1
+ Addition X+Y The sum of x and y
- subtraction X-Y The difference of x and y

COMPILED BY KONJOH ABRAHAM NCHINDA. TEL: 678236011


5
ORDINARY LEVEL COMPUTER SCIENCE
Remark: 5/2 = 2 and5.0/2 = 2.5 because 5.0 is a floating-point number
2. INCREMENT AND DECREMENT OPERATORS 
The operators () are those to increment or decrement a value by 1 respectively.
Example
Increment ++ Decrement - -
Int i=5 j=3, k, l Int i=5 j=3, k, l
k=i++ // k=5 i=6 k=i- - // k=5 i=4
l=++j // l=4 j=4 l=- -j // l=2 j=2

The operators can be prefix or postfix. In the statement, k=i++, the operators ++ is postfix. Therefore, the
value of i is assigned to k before it is incremented. In the statement, l=++j the operator is prefix. In this case, the
value of j is incremented before been assigned to l.
3. LOGICAL OR BOOLEAN OPERATORS
They can be used to compare more than 2things. A Boolean consists of operators such as: AND, OR, NOT,
XOR.
Boolean expressions are expressions that result in the value of either true or false.
❖ An assignment statement is an instruction for assigning a value to a variable.
Fundamental Control Structures
Control structures specify the order in which a computer will execute each line of software code. Control
structures enable the computer to read codes where there are choices and iterations (loops).
1) Sequence / Sequential control structure:
Here, a computer performs each line of software code in the order it appears.
Instruction 01
Instruction 02
Instruction 03
Instruction n
There is a 1st instruction,
Then, a 2nd instruction,
A 3rd instruction
To the last instruction In the sequence

2) Selection control structure:


Here, it makes a decision based on a condition in which some statements are obeyed and some are not.
A typical selection structure is the IF – THEN structure. It takes the form

COMPILED BY KONJOH ABRAHAM NCHINDA. TEL: 678236011


6
ORDINARY LEVEL COMPUTER SCIENCE
If  Boolean expression then  statement 
Example:
Consider the pseudo code to obtain account balance
1. Show current account balance
2. Input amount for withdrawal
3. Calculate new balance (new balance is current balance -withdrawal)
4. If balance  0 then notify manager
❖ The IF – THEN statement can be extended with the addition of the ELSE part of the structure
If  Boolean expression  then statement 1 else  statement 2 
Example:
1. Give price of item, A
2. Give the number of items, S
3. If S  10 then
4. Total = AS-100
5. Else
6. Total AS-300
3) Loops / Iteration control structure:
Loops enable computer to run the same block of code several times thus allowing several iterations of
the same calculation or processing of several values using the same section of code. The simplest way to
form a loop is by using go to statement which transfers control to a given line of program.
i. While loop
The while statement repeats a loop while the statement at the start of it is true, with the loop
been executed continually until the statement becomes false. The syntax is
While condition statement 
ii. Do – while loop
The Do – while statement causes the computer to run a loop once and see if it should run it
again making it useful when a check has to come after an operation has been performed. Syntax
is do  statement  while  condition 
Start
End
Condition
Statement
True
False

COMPILED BY KONJOH ABRAHAM NCHINDA. TEL: 678236011


7
ORDINARY LEVEL COMPUTER SCIENCE
Example: P=1, i=1
While (i =5)
P=Pi
i=i+1
iii. FOR loop
It will simply run the loop a certain number of times using the syntax:
For (Expression 1, Expression 2, Expression3)
Statement 1;
Statement 2;
Statement n;
Start
Condition
Statement
End
True
False
Start
Expression 1
Expression 2
True
Statement 1
Statement 2
Statement n
End
Expression 3
False
iv. Repeat statement
It repeats a block of code as long as condition is false until the statement becomes or holds true.
Example
▪ Repeat until: Statement repeats a portion of a software code as long as a certain
condition does not exist (it is false)
▪ The For-next: The statement repeats a portion of a software code, a precise number of
times. It uses a counter to check the condition.
v. Break and Continue

COMPILED BY KONJOH ABRAHAM NCHINDA. TEL: 678236011


8
ORDINARY LEVEL COMPUTER SCIENCE
The statement break provides an early exit from a for, while and do-while loop. A break causes
inner loop to stop immediately. Continue is a statement used to move to the next iteration of the
loop
vi. Logical Jump (GO TO)
It is possible to jump to any statement within the same function using the GO TO statement.
Exercise: Write an algorithm to print 1-10 using loop control structure
While do Repeat until For next
X=1 X=1 For X=1 to 10 do
While X = 10 Do until 10 Print X
Print X Print X Next
X=X+1 X=X+1
The three algorithms above achieve the same results printing the numbers 1-10 on the screen.
TESTING AND DEBUGGING A PROGRAM
After coding, you test or debug your written code. If modification is needed the source code has been edited
again.
Source of error
We can identify the following sources of errors
a. Understanding the problem
An error here may be obvious. Example; your program does nothing useful at all
b. Algorithm design
Mistakes here result in logic errors. The program will run but will not perform the intended task
c. Coding the algorithm
Errors of spellings, misplaced punctuation occurs here.
Error types
Logic error: It is a mistake in the way an algorithm solves a problem. These are errors
i.
caused by faulty algorithms.

ii.
Syntax error: They are mistakes in a software code’s grammar. They include;
Run time error: There are mistakes that occur when you run the software code. It
iii.
occurs when program directs computer to perform illegal operations.

o Undeclared variables
o Missing semi-colon at the end of the statement
o Comments not closed

COMPILED BY KONJOH ABRAHAM NCHINDA. TEL: 678236011


9
ORDINARY LEVEL COMPUTER SCIENCE
o Misspelling a command, word or forgetting to close a module
o A semi-colon instead of a colon.
Example
❖ Dividing by zero (int X =𝒚⁄𝟎): This may stop program execution and display an error message.
❖ Software not displaying a window correctly is a run time error.
Program Errors and Correction
1. Syntax Errors
Syntax is the set of rules that specify how the symbols of a language can be put together to form meaningful
statements. In other words, syntax defines the structure of legal statements in a language. A syntax error is an
error in a program that occurs due to the non-respect of the syntax rules of the language used. A syntax error will
cause a compiler/interpreter to stop trying to generate machine code and will not create an executable. However,
a compiler will usually not stop at the first error it encounters but will attempt to continue checking the syntax of
a program right to the last line. A misspelled key word, a missing punctuation mark and the incorrect use of an
operator are examples of syntax error.
2. Semantic Errors
Semantics specify the meaning of a well-formed program. A semantic error occurs when you write a program
that works, but does not do what you intend it to do. Compilation and interpretation do not detect semantic
errors. Semantic or logic errors are detected from wrong results. Something may be syntactically correct but
semantically incorrect.
3. Run-time Errors
A run-time error is an error that occurs during program execution. For example, a run-time error may occur if
division by 0 is attempted. A run-time error may cause the program to stop execution, or it may be handled by an
error-trapping routine.
4. Debugging
An error in a computer program is known as a bug. Debugging is the process of detecting and removing bugs.
Syntax errors and semantic errors are bugs. A debugger is the software tool used for this purpose.
Programming Paradigms
A programming paradigm is a fundamental style of computer programming, serving as way of building the
structure and elements of computer programs. It describes a programming language’s approach for solving a
problem. Paradigms differ in the concepts and abstractions used to represent the elements of a program and the
steps that compose a computation. High level languages can be classified under four different paradigms:
procedural, functional, object-oriented and declarative paradigms.
1. Procedural Paradigm
In the procedural/imperative paradigm, a program is a collection of statements and procedures that affect data.

COMPILED BY KONJOH ABRAHAM NCHINDA. TEL: 678236011


10
ORDINARY LEVEL COMPUTER SCIENCE
Here, a program can be seen as an active agent that manipulates passive objects(variables). These objects are
passive because they cannot initiate an action by themselves, but can only receive actions from active agents.
The focus in procedural programming is to write good functions and procedures.
Examples of imperative languages are Pascal, C, Ada, FORTRAN, and COBOL.
2. Object Oriented Paradigm
In the object-oriented paradigm, a program is a collection of interacting objects. An object is a unit that consists
of data and methods to operate on the object’s data. Unlike in imperative programming, object-oriented
programming deals with active objects instead of passive objects. These objects are active because the actions to
be performed on the objects are included in them. The objects only need to receive the appropriate stimulus from
outside to perform one of their actions. Examples of object-oriented languages are C++, Java, Visual Basic and
Smalltalk.
3. Functional Paradigm
In functional (applicative) programming, a program is a collection of function definitions. Lambda calculus
forms the basis of almost all functional programming languages. Lambda calculus is the use of lambda
expressions to define functions. A lambda expression is a formula that defines a function. For example: 𝑓(𝑥) =𝑥
+2
Some functional languages are Haskell, LISP, ML and Scheme. Example 1: A function to add two numbers in
Haskell The first line 𝑎𝑑𝑑:: (𝑖𝑛𝑡, 𝑖𝑛𝑡) → 𝑖𝑛𝑡 is read, “add has type (int, int)→int.” This means that the function
adds takes a pair of integer values as input and returns an integer. Line 2 is the implementation of the add
function. It means given two integers x and y, add of x and y is x+y.
ESSENTIAL ATTRIBUTES OF GOOD SOFTWARE
➢ Maintainability: Software should be written in such a way so that it can evolve to meet the changing
needs of customers. This is a critical attribute because software change is an inevitable requirement of
a changing business environment.
➢ Dependability: Dependable software should not cause physical or economic damage in the event of
system failure. Malicious users should not be able to access or damage the system.
➢ Efficiency: Software should not make wasteful use of system resources such as memory and processor cycles.
Efficiency therefore includes responsiveness, processing time, memory utilization, etc.
➢ Acceptability: Software must be acceptable to the type of users for which it is designed. This means
that it must be understandable, usable, and compatible with other systems that they use.
➢ Portability: Being able to move software from one machine platform to another. It refers to system
software or application software that can be recompiled for a different platform or to software that is
available for two or more different platforms.

COMPILED BY KONJOH ABRAHAM NCHINDA. TEL: 678236011


11
ORDINARY LEVEL COMPUTER SCIENCE
WEB AND INTERNET
Web: multimedia information system used on the internet (web is a part of internet, just
like email, instant messaging, internet telephony ...) based on the connections between different
documents using key words (hypertext technology).
Website: A set of web pages linked each another by hyperlinks (links between different
documents using key words) that could be accessed from one or more addresses specific
to it.
Web page: electronic document which might contain sound, text and possibly
moving images, and hyperlinks to other pages.
Internet: international network for communication between computers
The terms Internet and World Wide Web are often used without much
distinction. However, the two are not the same. The Internet is a global system of
interconnected computer networks. In contrast, the World Wide Web is one of the services
transferred over these networks. It is a collection of text documents and other resources, linked
by hyperlinks and URLs, usually accessed by web browsers, from web servers.
Viewing a web page on the World Wide Web normally begins either by typing the URL of
the page into a web browser, or by following a hyperlink to that page or resource. The web
browser then initiates a series of background communication messages to fetch and display the
requested page
Web Browser is a computer program to connect to a certain extent to the
Internet, and view web pages
1. Web Browsers
Web Browser or browser is a computer program to connect to a certain extent to the Internet, and
view web pages. There is a lot of web browsers, and some are available for several OS
2. Web Design with HTML
HTML stands for Hypertext Markup Language. It is the authoring language that describes how a
Web page should be displayed by a Web browser. Hypertext means that it provides ways of
representing information with links or connections to other information. These links are called
hypertext links. Markup means that it provides ways to indicate underlining, italics, paragraph
breaks, section headings, and so on, in text.
2.1 HTML Documents
An HTML document is simply a text file that is saved with the extension .html or .htm. It can be
created by a simple text editor like Microsoft Notepad, Notepad++ as well as a sophisticated web
authoring tool like FrontPage or Dreamweaver.

COMPILED BY KONJOH ABRAHAM NCHINDA. TEL: 678236011


12
ORDINARY LEVEL COMPUTER SCIENCE
HTML documents are made up of markup tags (or simply tags). A tag is a code enclosed within
angle brackets that indicates how something is to be interpreted by a web browser. Some examples
of tags are <html>, <br> and <em>. Most tags come in pairs: an open tag and a closing tag which is
written with a slash after the first < (e.g. </html>). A closing tag tells the browser where to stop
applying the effect of a given tag.
An HTML document is contained within the <HTML> and </HTML> tags and comprises of two
sections: head and body.
✓ The Head contains the page title and meta-tags within the <HEAD></HEAD> tags. Any
JavaScript code that is used, as well as Cascading Style Sheet information is also contained
within the Head. This section will not be displayed on the web page.
✓ The Body holds the actual content of the page (text, graphics, lists, etc.) contained within the
<BODY></BODY> tags.
The <HTML>, <HEAD>, <TITLE>, and <BODY> tags are referred to as document tags while the tags
that are used within the body part of the document are known as markup tags.
A basic HTML document would look something like this:
<HTML>
<HEAD>
<TITLE>Page title here</TITLE>
</HEAD>
<BODY>
Page content here.
</BODY>
</HTML>
o <HTML> marks the beginning of an HTML document
o <HEAD> begins the heading section of the document
o <TITLE> ... </TITLE> gives a title that will appear on the browser’s menu bar. This section
must appear between the <HEAD> ... </HEAD> tags and should be straight text, no tags.
o </HEAD> defines the end of the heading
o <BODY> … </BODY> defines the body of the document (text contained within the <BODY>
… </BODY> tags appear in the main browser window). It can be used with the attribute
BGCOLOR.
o </HTML> defines the end of the document
Remark Once an HTML document has been saved, it can now be opened as a web page using a
web browser.

COMPILED BY KONJOH ABRAHAM NCHINDA. TEL: 678236011


13
ORDINARY LEVEL COMPUTER SCIENCE
To edit the page, go back to the text document. Make the changes and save the document. In the
web page, click “reload” or “refresh” to apply the changes.
2.2 Text Tags
Text tags are used to format text within the document. Some tags are used with attributes. An
attribute is a special code that can enhance or modify a tag. They are generally located in the
starting tag after the tag name. The basic syntax for html tags and attributes is:
<tag attribute=“value”> … </tag>
Tags Description
<b> … </b> or <strong> …
Bolds the text between the opening and closing tags
</strong>
<i>...</i> or <em>...</em> Puts text in italics
<u> … </u> Underlines text
<font> … </font>
Sets the appearance of the text in your page. Can be used
<font size=?
with "size", "color" and "face" attributes.
color=#0000FF> … </font>
<blink> … </blink> Causes text to blink
Centers text or any item or group of items place between
<center> … </center>
its open and closing tags
<marquee> … </marquee> Causes text to navigate
<p> … </p> Sets a paragraph apart from other text and adds a line
<p align=“center”> … </p> break after. </p> is optional
Used to insert comments. Comments are not displayed
<!--...-->
by the browser. They are footnotes for you.
<br> Used to insert a line break. It does not have a closing tag.

Example 1:
<html>
<head>
<title>My First Web Page</title>
</head>
<body>
<strong>This text is bold</strong><br>
<b>This text is bold too</b><br>
<em>This text is in italics</em><br>
<i>This text is in italics too</i><br>
<u>This text is underlined</u><br>
<b><i>This text is bold and in italics</i></b><br>
<strong><em><u>This text is bold, underlined and in italics</u></em></strong>
</body>

COMPILED BY KONJOH ABRAHAM NCHINDA. TEL: 678236011


14
ORDINARY LEVEL COMPUTER SCIENCE
</html>
Example 2:
<html>
<head>
<title>MyPage</title>
</head>
<bodybgcolor=“cyan”>
<font type=“Monotype corsiva” size= “12” color=“blue”
</body>
</html>
Remark! Tags are case insensitive but it is advisable to write them in lower case.
All attribute values must be written within double quotes.
2.2.1 Heading Tags
Heading tags are used to highlight text by making them bigger and bolder than normal text. There
are six levels of headings numbered 1 through 6, where 1 is the biggest and 6 is the smallest
heading. Headings are specified as <h𝑦></h𝑦> where h stands for heading and 𝑦 is the level
number (1 to 6).
Example:
<html>
<head>
<title>Heading</title>
</head>
<body>

COMPILED BY KONJOH ABRAHAM NCHINDA. TEL: 678236011


15
ORDINARY LEVEL COMPUTER SCIENCE
EMBEDDED SYSTEM & CLOUD COMPUTING
A system is an arrangement in which all its unit assemble work together according to a set of rules.
It can also be defined as a way of working, organizing or doing one or many tasks according to a
fixed plan. For example, a watch is a time displaying system. Its components follow a set of rules to
show time. If one of its parts fails, the watch will stop working. So, we can say, in a system, all its
subcomponents depend on each other.
Embedded System
As its name suggests, Embedded means something that is attached to another thing. An embedded
system can be thought of as a computer hardware system having software embedded in it. An
embedded system can be an independent system or it can be a part of a large system. An embedded
system is a microcontroller or microprocessor-based system which is designed to perform a specific
task. For example, a fire alarm is an embedded system; it will sense only smoke.
An embedded system has three components -
• It has hardware.
• It has application software.
• It has Real Time Operating system (RTOS) that supervises the application software and
provide mechanism to let the processor run a process as per scheduling by following a plan
to control the latencies. RTOS defines the way the system works. It sets the rules during the
execution of application program. A small-scale embedded system may not have RTOS.
So we can define an embedded system as a Microcontroller based, software driven, reliable, Realtime control
system.
Characteristics of an Embedded System
• Single-functioned - An embedded system usually performs a specialized operation and
does the same repeatedly. For example: A pager always functions as a pager.
• Tightly constrained - All computing systems have constraints on design metrics, but those
on an embedded system can be especially tight. Design metrics is a measure of an
implementation's features such as its cost, size, power, and performance. It must be of a size
to fit on a single chip, must perform fast enough to process data in real time and consume
minimum power to extend battery life.
• Reactive and Real time - Many embedded systems must continually react to changes in
the system's environment and must compute certain results in real time without any delay.
Consider an example of a car cruise controller; it continually monitors and reacts to speed
and brake sensors. It must compute acceleration or de-accelerations repeatedly within a
limited time; a delayed computation can result in failure to control of the car.

COMPILED BY KONJOH ABRAHAM NCHINDA. TEL: 678236011


16
ORDINARY LEVEL COMPUTER SCIENCE
• Microprocessors based - It must be microprocessor or microcontroller based.
• Memory - It must have a memory, as its software usually embeds in ROM. It does not need
any secondary memories in the computer.
• Connected - It must have connected peripherals to connect input and output devices.
• HW-SW systems - Software is used for more features and flexibility. Hardware is used for
performance and security.
Advantages
• Easily Customizable
• Low power consumption
• Low cost
• Enhanced performance
Disadvantages
• High development effort
• Larger time to market
Basic Structure of an Embedded System
The following illustration shows the basic structure of an embedded system -
• Sensor - It measures the physical quantity and converts it to an electrical signal which can
be read by an observer or by any electronic instrument like an A2D converter. A sensor
stores the measured quantity to the memory.
• A-D Converter - An analog-to-digital converter converts the analog signal sent by the
sensor into a digital signal.
• Processor & ASICs - Processors process the data to measure the output and store it to the
memory.
• D-A Converter - A digital-to-analog converter converts the digital data fed by the processor
to analog data
• Actuator - An actuator compares the output given by the D-A Converter to the actual
(expected) output stored in it and stores the approved output.
Types of Processors
Processors can be of the following categories -
• General Purpose Processor (GPP)
o Microprocessor
o Microcontroller
o Embedded Processor
o Digital Signal Processor

COMPILED BY KONJOH ABRAHAM NCHINDA. TEL: 678236011


17
ORDINARY LEVEL COMPUTER SCIENCE
o Media Processor
• Application Specific System Processor (ASSP)
• Application Specific Instruction Processors (ASIPs)
• GPP core(s) or ASIP core(s) on either an Application Specific Integrated Circuit (ASIC) or a
Very Large Scale Integration (VLSI) circuit.
Microprocessor
A microprocessor is a single VLSI chip having a CPU. In addition, it may also have other units such
as coaches, floating point processing arithmetic unit, and pipelining units that help in faster
processing of instructions.
Earlier generation microprocessors’ fetch-and-execute cycle was guided by a clock frequency of
order of ~1 MHz. Processors now operate at a clock frequency of 2GHz
Microcontroller
A microcontroller is a single-chip VLSI unit (also called microcomputer) which, although having
limited computational capabilities, possesses enhanced input/output capability and a number of
on-chip functional units.
CPU RAM ROM
I/O Port Timer Serial COM Port

Microcontrollers are particularly used in embedded systems for real-time control applications with
on-chip program memory and devices.
Microprocessor vs Microcontroller
Let us now take a look at the most notable differences between a microprocessor and a
microcontroller.
Microprocessor Microcontroller
Microprocessors are multitasking in nature.
Can
perform multiple tasks at a time. For example,
Single task oriented. For example, a washing
on
machine is designed for washing clothes only.
computer we can play music while writing text
in
text editor.
RAM, ROM, I/O Ports, and Timers can be
RAM, ROM, I/O Ports, and Timers cannot be
added
added externally. These components are to be
externally and can vary in numbers.

COMPILED BY KONJOH ABRAHAM NCHINDA. TEL: 678236011


18
ORDINARY LEVEL COMPUTER SCIENCE
embedded together on a chip and are fixed in
numbers.
Fixed number for memory or I/O makes a
Designers can decide the number of memory or
microcontroller ideal for a limited but specific
I/O ports needed.
task.
External support of external memory and I/O
Microcontrollers are lightweight and cheaper
ports makes a microprocessor-based system
than a microprocessor.
heavier and costlier.
External devices require more space and their A microcontroller-based system consumes less
power consumption is higher. power and takes less space.

CLOUD COMPUTING
Simply put, cloud computing is the delivery of computing services—including servers, storage,
databases, networking, software, analytics, and intelligence—over the Internet (“the cloud”) to offer
faster innovation, flexible resources, and economies of scale. You typically pay only for cloud
services you use, helping you lower your operating costs, run your infrastructure more efficiently,
and scale as your business needs change.
Top benefits of cloud computing
Cloud computing is a big shift from the traditional way businesses think about IT resources. Here
are seven common reasons organizations are turning to cloud computing services:
Cost
Cloud computing eliminates the capital expense of buying hardware and software and setting up
and running on-site datacenters—the racks of servers, the round-the-clock electricity for power
and cooling, and the IT experts for managing the infrastructure. It adds up fast.
Speed
Most cloud computing services are provided self service and on demand, so even vast amounts of
computing resources can be provisioned in minutes, typically with just a few mouse clicks, giving
businesses a lot of flexibility and taking the pressure off capacity planning.
Global scale
The benefits of cloud computing services include the ability to scale elastically. In cloud speak, that
means delivering the right amount of IT resources—for example, more or less computing power,
storage, bandwidth—right when they’re needed, and from the right geographic location.
Productivity
On-site datacenters typically require a lot of “racking and stacking”—hardware setup, software

COMPILED BY KONJOH ABRAHAM NCHINDA. TEL: 678236011


19
ORDINARY LEVEL COMPUTER SCIENCE
patching, and other time-consuming IT management chores. Cloud computing removes the need for
many of these tasks, so IT teams can spend time on achieving more important business goals.
Performance
The biggest cloud computing services run on a worldwide network of secure datacenters, which are
regularly upgraded to the latest generation of fast and efficient computing hardware. This offers
several benefits over a single corporate datacenter, including reduced network latency for
applications and greater economies of scale.
Reliability
Cloud computing makes data backup, disaster recovery, and business continuity easier and less
expensive because data can be mirrored at multiple redundant sites on the cloud provider’s
network.
Security
Many cloud providers offer a broad set of policies, technologies, and controls that strengthen your
security posture overall, helping protect your data, apps, and infrastructure from potential threats.
Types of cloud computing
Not all clouds are the same and not one type of cloud computing is right for everyone. Several
different models, types, and services have evolved to help offer the right solution for your needs.
First, you need to determine the type of cloud deployment, or cloud computing architecture, that
your cloud services will be implemented on. There are three different ways to deploy cloud
services: on a public cloud, private cloud, or hybrid cloud.
Public cloud
Public clouds are owned and operated by a third-party cloud service providers, which deliver their
computing resources, like servers and storage, over the Internet. Microsoft Azure is an example of a
public cloud. With a public cloud, all hardware, software, and other supporting infrastructure is
owned and managed by the cloud provider. You access these services and manage your account
using a web browser.
Private cloud
A private cloud refers to cloud computing resources used exclusively by a single business or
organization. A private cloud can be physically located on the company’s on-site datacenter. Some
companies also pay third-party service providers to host their private cloud. A private cloud is one
in which the services and infrastructure are maintained on a private network.
Hybrid cloud
Hybrid clouds combine public and private clouds, bound together by technology that allows data
and applications to be shared between them. By allowing data and applications to move between

COMPILED BY KONJOH ABRAHAM NCHINDA. TEL: 678236011


20
ORDINARY LEVEL COMPUTER SCIENCE
private and public clouds, a hybrid cloud gives your business greater flexibility, more deployment
options, and helps optimize your existing infrastructure, security, and compliance.
Types of cloud services: IaaS, PaaS, serverless, and SaaS
Most cloud computing services fall into four broad categories: infrastructure as a service (IaaS),
platform as a service (PaaS), serverless, and software as a service (SaaS). These are sometimes
called the cloud computing "stack" because they build on top of one another. Knowing what they
are and how they’re different makes it easier to accomplish your business goals.
Infrastructure as a service (IaaS)
The most basic category of cloud computing services. With IaaS, you rent IT infrastructure—servers
and virtual machines (VMs), storage, networks, operating systems—from a cloud provider on a
pay-as-you-go basis.
Platform as a service (PaaS)
Platform as a service refers to cloud computing services that supply an on-demand environment for
developing, testing, delivering, and managing software applications. PaaS is designed to make it
easier for developers to quickly create web or mobile apps, without worrying about setting up or
managing the underlying infrastructure of servers, storage, network, and databases needed for
development.
Serverless computing
Overlapping with PaaS, serverless computing focuses on building app functionality without
spending time continually managing the servers and infrastructure required to do so. The cloud
provider handles the setup, capacity planning, and server management for you. Serverless
architectures are highly scalable and event-driven, only using resources when a specific function or
trigger occurs.
Software as a service (SaaS)
Software as a service is a method for delivering software applications over the Internet, on demand
and typically on a subscription basis. With SaaS, cloud providers host and manage the software
application and underlying infrastructure, and handle any maintenance, like software upgrades and
security patching. Users connect to the application over the Internet, usually with a web browser on
their phone, tablet, or PC.
Uses of cloud computing
You’re probably using cloud computing right now, even if you don’t realize it. If you use an online
service to send email, edit documents, watch movies or TV, listen to music, play games, or store
pictures and other files, it’s likely that cloud computing is making it all possible behind the scenes.
The first cloud computing services are barely a decade old, but already a variety of organizations—

COMPILED BY KONJOH ABRAHAM NCHINDA. TEL: 678236011


21
ORDINARY LEVEL COMPUTER SCIENCE
from tiny startups to global corporations, government agencies to non-profits—are embracing the
technology for all sorts of reasons.
Here are a few examples of what’s possible today with cloud services from a cloud provider:
Create cloud-native applications
Quickly build, deploy, and scale applications—web, mobile, and API. Take advantage of cloud-native
technologies and approaches, such as containers, Kubernetes, microservices architecture, API driven
communication, and DevOps.
Test and build applications
Reduce application development cost and time by using cloud infrastructures that can easily be
scaled up or down.
Store, back up, and recover data
Protect your data more cost-efficiently—and at massive scale—by transferring your data over the
Internet to an offsite cloud storage system that’s accessible from any location and any device.
Analyze data
Unify your data across teams, divisions, and locations in the cloud. Then use cloud services, such as
machine learning and artificial intelligence, to uncover insights for more informed decisions.
Stream audio and video
Connect with your audience anywhere, anytime, on any device with high-definition video and audio
with global distribution.
Embed intelligence
Use intelligent models to help engage customers and provide valuable insights from the data
captured.
Deliver software on demand
Also known as software as a service (SaaS), on-demand software lets you offer the latest software
versions and updates around to customers—anytime they need, anywhere they are.
Microsoft and cloud computing
Microsoft is a leading global provider of cloud computing services for businesses of all sizes. To
learn more about the Microsoft cloud platform, our Kubernetes on Azure offering, our serverless
application platform, and how Microsoft Azure compares to other cloud providers, see What is
Azure? and Azure vs. AWS.

COMPILED BY KONJOH ABRAHAM NCHINDA. TEL: 678236011

You might also like