0% found this document useful (0 votes)
16 views111 pages

Types and Functions of Software

Cs

Uploaded by

nawabharis2022
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)
16 views111 pages

Types and Functions of Software

Cs

Uploaded by

nawabharis2022
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

SOFTWARE

CHAPTER 4
4.1 TYPES OF SOFTWARE

 System software
 System Software is a type of software that is used to communicate with
computer hardware. System Software includes operating system and device
drivers, etc
 Application software
 An application program is a computer program designed to carry out a specific
task , used by end-users. Word processors, media players, and accounting software
are examples.
GENERAL FEATURES OF SYSTEM SOFTWARE

 Controls and manages the operation of hardware


 Platform for running other software
 Allows hardware and software to run without problems
 Provides a human computer interface (HCI)
 Controls the allocation and usage of hardware resources.
GENERAL FEATURES OF APPLICATION SOFTWARE

 Performs various applications (apps) on a computer


 allows a user to perform specific tasks using the computer’s
resources
 it may be a single program (for example, NotePad) or a suite of
programs (for example, Microsoft Office)
 User can execute the software as and when they require.
FUCTIONS OF WORD PROCESSOR:

 creating, editing, saving and manipulating text


 copy and paste functions
 spell checkers and thesaurus
 import photos/images into a structured page format
 translation into a foreign language.
FUCTIONS OF SPREADSHEET

Spreadsheet software is used to organise and manipulate numerical data.


Numbers are organised on a grid of lettered columns and numbered rows.
Some of the functions of spreadsheets include:
 use of formulas to carry out calculations
 ability to produce graphs
 ability to do modelling and “what if” calculations.
FUNCTIONS OF DATABASE
Database software is used to
organise, manipulate and analyse
Database
data.
Some of the functions include:
Tables
 ability to carry out queries on
database data and produce a Rows Columns
report
 add, delete and modify data in a Records Fields
table.
CONTROL AND MEASURING
SOFTWARE

Control and measuring software is designed to allow a computer or


microprocessor to interface with sensors so that it is possible to:
 measure physical quantities in the real world (such as temperatures)
 to control applications (such as a chemical process) by comparing sensor
data with stored data and sending out signals to alter process
parameters
(e. g. open a valve to add acid andchange the pH).
APPS

 Software that runs on mobile phones or tablets.


 They are normally downloaded from an “App Store” examples of apps
include:
 video and music streaming
 GPS (global positioning systems – help you find your way to a chosen
location)
 camera facility (taking photos and storing/manipulating the images taken).
PHOTO EDITING SOFTWARE
Photo editing software allows a user to manipulate digital photographs
stored on a computer; for example,
 Change brightness, change contrast, alter colour saturation or remove
“red eye”.
 They also allow for very complex manipulation of photos (e.g. change
the features of a face, combine photos, alter the images to give
interesting effects and so on).
 They allow a photographer to remove unwanted items and generally
“touch up” a photo to make it as perfect as possible.
VIDEO EDITING SOFTWARE

 Video editing software manipulate videos to produce a new video.


 Add titles and alter/add sound to the original video.
 Rearrange , add and/or remove sections of video clips and/or audio clips
 Apply colour correction, filters and other video enhancements
 Create transitions between clips in the video footage
GRAPHICS MANIPULATION SOFTWARE

 Graphics manipulation software allows bitmap and vector images to be changed.


 Bitmap images are made up of pixels which contain information about image
brightness and colour. Bitmap graphics editors can change the pixels to produce a
different image.
 Vector graphic editors operate in a different way and don’t use pixels – instead
they manipulate lines, curves and text to alter the stored image as required.
 Both types of editing software might be chosen depending on the format of the
original image.
SYSTEM SOFTWARE

These are programs that allow the hardware to run properly and allow the user to
communicate with the computer. Examples of typical system software are:
 Compilers
 Linkers
 Device Drivers
 Operating Systems
 Utilities
COMPILERS

A compiler is a computer program that translates a program written in a high-level


language (HLL) into machine code so that it can be directly used by a computer to
perform a required task.
 The original program is called the source code and the code after compilation is
called the object code.
 A compiled code can be used again and again to perform the same task without re-
compilation.
 Examples of high-level languages include: Java, Python,Visual Basic, Fortran, C++ and
Algol.
LINKERS

 A linker is a computer program that takes one or more object file produced by a
compiler and combines them into a single program which can be run on a computer.
 For example, many programming languages allow programmers to write different
pieces of code, called modules, separately.
 This simplifies the programming task since it allows the program to be broken up
into small, more manageable sub-tasks.
 A linker puts all the modules together to form the final program.
DEVICE DRIVERS

 A Device Driver enables one or more hardware devices to communicate with


the computer's operating system.
 Without drivers, a hardware device (for example, a computer printer) would be
unable to work with the computer.
 All hardware devices connected to a computer have associated drivers.
 As soon as a device is plugged into the USB port of a computer, the operating system
looks for the appropriate driver. An error message will be produced if it can’t be
found.
 Examples of drivers include: printers, memory sticks, mouse, CD drivers, and so
on.
OPERATING SYSTEMS

OPERATING SYSTEMS (O/S) is a software that is running in the background of


a computer system.
 It manages many of the basic functions. For example, operating systems allow:
 input/output operations
 users to communicate with the computer (e.g. Windows)
 error handling to take place
 The loading and running of programs to occur
 managing of security (e.g. user accounts, log on passwords).
UTILITY PROGRAMS (UTILITIES)

The Utility Software is system software that helps to maintain the proper and
smooth functioning of a Computer System. It assists the Operating System to
manage, organize, maintain, and optimize the functioning of the computer
system.

Utility programs (utilities) – part of an operating system which carries out


certain functions such as virus checking, defragmentation and screensaver.
UTILITY PROGRAM : EXAMPLES

 Virus checkers
 Defragmentation software
 Disk contents analysis and repair
 File compression and file management
 Back-up software
 Security
 Screensavers
HOW TO PREVENT FROM VIRUSES?

There are many ways to help prevent viruses:


 Be careful when downloading material from the internet, not opening files or
websites given in emails from unknown senders or by not using non-original
software).
 Use of Virus checkers provides best defence against malware.
 Running anti-virus software in the background, that will constantly check for virus
attacks.
FEATURES OF VIRUS CHECKERS

 Anti-virus software compares a possible virus against a database of known viruses


 They carry out heuristic checking – this is the checking of software for types of
behaviour that could indicate a possible virus; this is useful if software is infected by a
virus not yet on the database
 Any possible files or programs which are infected are put into quarantine which:
– allows the virus to be automatically deleted, or
– allows the user to make the decision about deletion (it is possible that the user
knows that the file or program is not infected by a virus
– this is known as a false positive and is one of the drawbacks of anti-virus
software)
FEATURES OF VIRUS CHECKERS

 Anti -virus software needs to be kept up to date since new


viruses are constantly being discovered
 Full system checks need to be carried out once a week, for
example, since some viruses lie dormant and would only be
picked up by this full system scan.
DEFRAGMENTATION SOFTWARE

A disk defragmenter will rearrange the blocks of data to store files


in contiguous
 As a HDD becomes full, blocks used for files will become scattered all over the disk surface in different sectors
and tracks . This will happen because files will become deleted, partially-deleted, extended and so on over time.
 The consequence of this is slower data access time; the HDD read-write head will now require several
movements just to find and retrieve the data making up the required file.
 It would obviously be advantageous if files could be stored in contiguous sectors considerably reducing HDD
head movements. , this is not a problem when using solid state devices.
BACK-UP SOFTWARE

Operating system back-up utility will:


 Allow a schedule for backing up files to be made
 Only carry out a back-up procedure if there have been any changes made to a file.
For total security there should be three versions of a file:
1. the current (working) version stored on the internal HDD or SSD
2. a locally backed up copy of the file (stored on a portable SSD, for example)
3. a remote back-up version stored well away from the computer (for example, using
cloud storage).
SECURITY SOFTWARE
 Manages access control and user accounts (using user IDs and
passwords)
 Links into other utility software, such as virus checkers and spyware
checkers
 Protects network interfaces (for example, through the use of firewalls)
 Uses encryption and decryption to ensure any intercepted data is
meaningless without a decryption key
 Oversees the updating of software (does the update request come from
a legitimate source, for example).
SCREENSAVERS

Screensavers are programs that supply moving and still images on the monitor
screen after a period of inactivity by the computer. They were originally
 Developed to protect older CRT (cathode ray tube) monitors which would suffer
from ‘phosphor burn’ if the same screen image remained for any length of time.
 With modern LCD and OLED screens, this problem no longer exists; there for used
to customized a device
 They are used as part of the computer’s security system. If a computer is unused for
five minutes, screensaver will be loaded and logs out the user and locked it, that is
useful in office environment
SCREENSAVERS

Some screensavers are often used to activate useful background tasks that
can only go on when the computer is in an ‘idle’ state. For example:
 virus scans
 distributed computing applications – these allow apps to use the
computer’s resources only when it is idle (for example, an online gaming
app).
DEVICE DRIVERS
 Device drivers are software that communicate with the operating
system and translate data into a format understood by a hardware
peripheral device.
 Without device drivers, a hardware device would be unable to work
with a computer –
 A message such as ‘device not recognised’ would appear on the screen.
 As soon as a device is plugged into a USB port (for example, a memory
stick, printer or camera), the operating system looks for the appropriate
device driver.
DEVICE DRIVERS

 All USB device drivers contain a collection of information about devices


called descriptors; this allows the USB bus to ask a newly connected
device what it is.
 Descriptors include vendor id (VID), product id (PID) and unique serial
numbers.
 If a device has no serial number associated with it, the operating system
will treat the device as new every time it is plugged into a USB port.
 Serial numbers must be unique
4.1.2 OPERATING SYSTEMS
Operating system is a software that enables computer systems to
function correctly and allow users to communicate with computer
systems
 It needs to be installed on the computer
 An operating system provides both the environment in which
applications can be run and a usable interface between humans and
computer.
 An operating system also disguises the complexity of computer software
and hardware.
4.1.2 OPERATING SYSTEMS

 Common examples of operating systems include: Microsoft Windows,


Apple Mac OS, Google Android and Apple IOS
 Most computers store the operating system on a hard disk drive (HDD)
or solid state drive (SSD) since they tend to be very large programs.
 Mobile phones and tablets store the operating system on a solid state
device since they are too small to accommodate an HDD.
FUNCTIONS OF AN OPERATING SYSTEM

 Human-computer interface(HCI)
 Multi Tasking
 Batch Processing
 Load/run application
 File utilities(such as save, copy, delete)
 Processor Management
 Memory Management
 Real-time Processing 38

 Interrupt Handling
FUNCTIONS OF AN OPERATING SYSTEM

 Device Management
 File Management
 User accounts management
 Security(e.g. log on, passwords, username, etc)
 Control overall system performance
 Job accounting
 Error handling/reporting
 Input/output control
39

 Coordination between other software and users


HUMAN COMPUTER INTERFACE (HCI)
The human computer interface (HCI) is in the form of a Command Line
Interface (CLI) or a Graphical User Interface (GUI).

41
TYPES OF USER INTERFACE

 Hardware and software through which a user provides input to a


computer or receives information from it. Also known as human-
computer interface(HCL).
 There are two types of user interfaces
 Command line interface
 Graphical user interface

42
COMMAND LINE INTERFACE(CLI)
A command line interface allows the user to interact directly with the
computer system by typing in commands into a screen.

43
COMMAND LINE INTERFACE

44
GRAPHICAL USER INTERFACE(GUI)
A GUI is an interface built around visual (graphical) things. It is also called
WIMP
 Windows are regions of the screen used to display information

 Icons are small pictures that are used to represent folders, software, etc.

 Menus are lists of options the user can select from

 A Pointer is an arrow that can be moved around the screen and is used to
select things
 Windows is an example of an operating system with a GUI. 45
GRAPHICAL USER INTERFACE

46
WHO WOULD USE EACH TYPE OF INTERFACE?

CLI: a programmer, analyst or technician; basically somebody who needs


to have a direct communication with a computer to develop new
software, locate errors and remove them, initiate memory dumps
(contents of the computer memory at some moment in time), and so on
GUI: the end-user who doesn’t have or doesn’t need to have any great
knowledge of how the computer works; a person who uses the computer
to run software or play games or stores/manipulates photographs, for
example.
MEMORY MANAGEMENT

Memory management carries out the following functions:


 Manages the primary storage (RAM) and allows data to be moved
between RAM and HDD/SSD during the execution of programs
 Keeps track of all the memory locations
 Carries out memory protection to ensure that two competing
applications cannot use the same memory locations at the same time.

48
WHAT HAPPENS IF TWO APPLICATIONS WILL OCCUPY THE
SAME SPACE?

 Data would probably be lost


 Applications could produce incorrect results (based on the wrong data
being in memory locations)
 Potential security issues (if data is placed in the wrong location, it might
make it accessible to other software, which would be a major security
issue)
 Computer could crash.
49
SECURITY MANAGEMENT

It maintains the integrity, confidentiality and availability of data:


 By carrying out operating system updates as and when they become available
 Ensuring that anti virus software (and other security software) is always up to date, preserving the
integrity, security and privacy of data
 By communicating with a firewall to check all traffic to and from the computer
 By preventing the users entering ‘private areas’ on a computer that permits multi-user activity by setting
up user accounts; this helps to ensure the privacy of data
 By maintaining access rights for all users
 By offering the ability for the recovery of data (and system restore) when it has been lost or corrupted
 By helping to prevent illegal intrusion into the computer system (also ensuring the privacy of data 50
MANAGEMENT OF HARDWARE AND PERIPHERALS

Hardware management involves management of all input and output


peripheral devices. In Hardware management operating system:
 Communicates with all input and output devices using device drivers
 Uses a device driver to take data from a file and translates it into a
format that the input/output device can understand
 Ensures each hardware resource has a priority so that they can be used
and released as required
 Manages input/output devices by controlling queues and buffers
51
EXAMPLE : PRINTER MANAGEMENT

– first of all, the printer driver is located and loaded into memory
– then the data is sent to a printer buffer ready for printing
– if the printer is busy then the data is sent to a printer queue then to the
printer buffer
– it will send various control commands to the printer throughout the
printing process
– it receives and handles error messages and interrupts from the printer.
52
FILE MANAGEMENT: TASKS
 File naming conventions which can be used i.e. [Link] (where the
extension can be .bat, .htm, .dbf, .txt, .xls, etc.)
 create, open, close, delete, rename, copy, and move files
 Maintenance of directory structures
 Ensuring access control mechanisms are maintained (for example, access
rights to files, password protection, or making files available for editing or
locking them)
 Ensuring memory allocation for a file by reading it from the HDD/SSD
and loading it into memory. 53
MULTITASKING

 Multitasking allows computers to carry out more than one task (i.e. a process) at a
time.
 Processes will share the hardware resources under the control of the operating
system software.
 Operating system needs to constantly monitor the status of each of the processes
under its control

54
HOW MULTITASKING IS DONE?

 Resources are allocated to a process for a specific time limit


 The process can be interrupted while it is running
 The process is given a priority so it can have resources according to its
priority.

Using multitasking management, main memory, HDD/SSD and virtual


memory are better managed making the most effective use of CPU time.
55
MANAGEMENT OF USER ACCOUNTS

The operating system manages user accounts. This allows each user to:
 Customise their screen layout and other settings
 Use separate folders and files and to manage these themselves.
 The administrator can create accounts, delete user accounts and restrict
user account activity.
56
HOW HARDWARE, FIRMWARE AND OPERATING SYSTEM ARE
REQUIRED TO RUN AN APPLICATION?
 When a computer starts up, part of the operating system needs to be loaded into RAM – this is
known as booting up the computer (or a bootstrap loader).
 The start-up of the computer’s motherboard is handled by the basic input/output system
(BIOS/firmware). The BIOS tells the computer where the storage device that holds the operating
system can be found; it then loads the part of the operating system that is needed and executes it.
 Firmware is a program that provides low level control for devices.
 BIOS is stored on an EEPROM, the BIOS settings are stored on a CMOS chip (Complementary Metal
Oxide Semi-conductor).
 The application software will be under the control of the operating system and will need to access system
software such as the device drivers while it is running. Different parts of the operating system may need to be
loaded in and out of RAM as the software runs.
BUFFER : EXAMPLE
Buffers are used when downloading a movie from the internet
to compensate for the difference between download speeds and
the data requirements of the receiving device. The data
transmission rate of the movie file from the web server to the
buffer must be greater than the rate at which data is transmitted
from buffer to media player.

58
BUFFER :EXAMPLE

 A printer driver creates a printer buffer in memory to hold for printer


when printer is busy.
 The printer driver transfers output data to the buffer.
 It then waits until the printer attended to a error

59
INTERRUPT

 An interrupt is a signal sent from a device or from software to the


microprocessor. This will cause the microprocessor to temporarily stop
what it is doing so that it can service the interrupt.

60
INTERRUPTS EXAMPLES

61
INTERRUPT HANDLING PROGRAMS

• A program that organises


Interrupt
interrupts into an order
Handler based upon priorities

Interrupt • A program that retrieves


Service an interrupt and performs
Routine(ISR) the required action 62
WHAT HAPPENS WHEN AN INTERRUPT OCCUR?

63
WHAT HAPPENS WHEN AN INTERRUPT OCCUR?
EXAMPLE

Downloading a file from the internet and listening to some


music at the same time from a library.
Interrupts allow these two functions to co-exist and the user has the
impression that both functions are being carried out simultaneously. In
reality, data is being passed in and out of memory very rapidly allowing
both functions to be serviced. This can all be achieved by using a buffer.
Without buffers, the movie would frequently ‘freeze’.
64
ROLE OF BUFFER AND INTERRUPTS IN PRINTING

 The time taken to print out a document is longer than the time for the
microprocessor to send data to the printer.
 Without buffers and interrupts, the microprocessor would remain idle
waiting for a document to be printed.
 This would be a waste of microprocessor time; the buffers and
interrupts allow the microprocessor to carry on with other tasks while
the document is being printed.
 It maximizes processing power and speed.
65
How Buffers And Interrupts Are
Used When A Document Is Sent To A Printer. ?

66
4.2 TYPES OF PROGRAMMING LANGUAGE,
TRANSLATORS AND INTEGRATED DEVELOPMENT
ENVIRONMENTS (IDES)

67
NEED FOR PROGRAMMING LANGUAGE

 Languages are used to establish communication between people


 Programming languages are used to communicate with computers.
 Computers only ‘understand’ machine code.
 A program needs to be translated into machine code before it can be ‘understood’
by a computer.
 Programs are our way of telling a computer what to do, how to do it and when to do
it. This enables a single computer to perform many different types of task.
 A computer can be used to stream videos, write reports, provide weather forecasts
and many, many other jobs.
68
PROGRAM

 A computer program is a sequence of instructions, that a programmer


must write, to make a computer perform a certain task.
 Programming language is a language in which a program can be
written.

69
Type of Programming Languages
Programming languages

Machine language
Low- Level
Languages Assembly
Language
High Level
BASIC, C++, Java
languages

70
LOW-LEVEL LANGUAGES

 Low-level languages relate to the specific architecture and hardware of


particular type of computer.
 Low level language can refer to machine code, the binary instructions
that a computer can understand .
 They are more difficult for the programmer to understand.

71
MACHINE LANGUAGE

 Machine language is made up of series 1s and 0s and directly understood by the


machine.
 All other languages must be translated into machine code before the instructions can
be carried out unless the program is already written in machine code.
 Machine code if often shown in hexadecimal since it is hard to understand binary.
Program snippet to add two numbers
Hexadecimal Binary

1 12 0001 00010010
4 13 0100 00010011 72

0 1A 0000 00011010
ASSEMBLY LANGUAGE

 An assembly language uses simple instructions such as ADD. SUB and


LDA.
 It is used in preference to machine code, since it is easier for the
programmer to use and to debug(debugging means removing mistakes).
 Program written in assembly language are translated by a software
called assembler.

73
ASSEMBLY LANGUAGE
 Assembly language assigns mnemonic codes to sets of machine code to
make them more understandable.
 Some examples of mnemonics are:
 ADD — this would be an instruction to use addition in a calculation
 SUB — this would be an instruction to use subtraction in a calculation
 INP — this would be an instruction that would require a user to give
an input
 OUT — this would be an instructions that would output data
74
WHY PROGRAMMERS USE ASSEMBLY LANGUAGE

 To make use of special hardware


 To make use of special machine-dependent instructions
 To write code that doesn't take up much space in memory.
 To write code that performs a task very quickly.

75
ASSEMBLY LANGUAGE: EXAMPLE
 The following snippet of program to add two numbers together is written
in assembly language.
LDA First
ADD Second
STO SUM
LDA Load value of variable in accumulator
ADD  Add the value of another variable to the value stored in accumulator
STO  Replace the value of the variable by the value stored in the
accumulator 76
ADVANTAGES OF LOW-LEVEL LANGUAGES

 Can address memory addresses directly


 No need for compilers/interpreters
 shorter code/code requires less storage/RAM
 Can (be written to) run faster
 Low level languages are machine oriented therefore the skillful programmer
has complete freedom of choice of instructions and direct control over the
processor’s communication with its input, output and storage devices.
77
DISADVANTAGES OF LOW-LEVEL LANGUAGESS

 Their machine oriented nature makes them hard for programmer to learn
 The processor specific nature of the instruction set means that programs
are not transferable or portable between families of processors.

78
HIGH-LEVEL LANGUAGES

 A high-level language is developed with the programmer in mind rather than the
computer.
 High-level language instructions are similar to English, which means that
programming is made easier. Instructions in BASIC, a high level language, include
such commands as PRINT, GOTO and READ which are easy for us to understand
and remember.
 Examples of high-level languages are: C++, Delphi, Java, Pascal, Python, Visual
Basic, etc
Program to add two
numbers in a high-level
language
79

Sum:= FirstNumer + SecondNumer


ADVANTAGES OF HIGH LEVEL LANGUAGES
 Program written in high level language are easier to read and
understand as the language used is closer to human language.
 Write in a shorter time
 Debug at the development stage
 Easier to maintain once in use
 Many high level languages are portable and can be used on different
computers
 no need to understand workings of a computer
80

 much easier to test


DISADVANTAGES OF HIGH-LEVEL LANGUAGES

 The program written in high level language are less efficient as they
take more execution time.
 The compiler also consumes some memory as it is required for the
translation process

81
COMPARISON OF HIGH-LEVEL AND LOW-LEVEL LANGUAGES

High-level language Low-level language


 Program statements are problem  Program instructions are machine
oriented. oriented.
 One statement translates to many  One assembly language instruction
machine code instruction. translates to one machine code
instruction.
 Programs are portable between
different types of computers.  Programs are not portable between
different types of computers.
 Programs must be translated to
 Machine language needs no
run on a processor
82

translation.
COMPARISON OF HIGH-LEVEL AND LOW-LEVEL LANGUAGES

High-level language Low-level language


 Translation to machine  Translation from assembly
language is relatively complex. language to machine language is
relatively simple.
 Programs are relatively easy to  Programs are relatively hard to read
read and write. and write.
 Programs are relatively easy to  Programs are relatively hard to test,
test, debug and maintain debug and maintain

83
4.2.3 TRANSLATORS
A translator is a utility software that is used to translate a program into binary
before a computer can use it. There are several types of translator program in use;
each one performs a different task.
Computer programs can exist in several forms.
 Programs are written by humans in a form that people who are trained as computer
programmers can understand.
 In order to be used by a computer, programs need to be translated into the binary
instructions, machine code, that the computer understands.
 Humans find it very difficult to read binary, but computers can only perform
operations written in binary. 84
TYPES OF TRANSLATORS

Translation programs are used to convert the program commands into


machine code. There are three types of translation programs:
o Compilers
o Interpreters
o Assemblers

85
COMPILERS

 A compiler is a software that converts the whole of a


program written in a high level language into machine
code in one go. So that it can be directly used by a
computer to perform a required task.
 Once a program is compiled the machine code can be
used again and again to perform the same task without
translation
86

Source: Information system for you, Stephen Doyle


[Link]
INTERPRETERS

 An interpreter is a computer program that


reads a statement from a program written in
high-level language, performs the action
specified and then does the same with the next
statement

87

Source: Information system for you, Stephen Doyle


[Link]
ASSEMBLERS

 Assemblers translate assembly language


instructions into machine code. This
translation is easy because one
instruction in assembly language usually
corresponds to one machine code
instruction

88

Source: Information system for you, Stephen Doyle


[Link]
RELATIONSHIP BETWEEN ASSEMBLERS, COMPILERS AND
INTERPRETERS

High level High level


Assembly
Language Language
language code
code code

Assembler Compiler Interpreter

Machine
89

code
COMPARISON OF TRANSLATION PROGRAMS
Compiler Assembler
Translates high-level program into machine Translates a low-level language program into machine
code. code.
An executable file of machine code is An executable file of machine code is produced.
produced.
One high-level language statement can be One low-level language statement is usually translated
translated into several machine code into one machine code instruction.
instructions.

Compiled programs are used without the Assembled programs can be used without assembler.
compiler,
A compiled program is usually distributed for An assembled program is usually distributed for 90

general use. general use.


DIFFERENCES BETWEEN COMPILER AND INTERPRETER
 Compiler produces object code / interpreter doesn’t produce object code
 Compiler translates whole program in one go / interpreter translates
and executes line at a time
 Compiler produces list of all errors / interpreter produces error
message each time an error encountered
 Compiler produces “stand alone code” / interpreter doesn’t produce
“stand alone code”
 Compilation process is slow but resultant code runs very quickly /
interpreted code runs slowly 91
ADVANTAGES AND DISADVANTAGES OF COMPILERS AND
INTERPRETERS
TYPES OF ERRORS
Syntax Errors Logic Errors
 A syntax error is where a program
statement doesn't obey the rules of
 A logic error where a program statement
programming language.
doesn't do what the programmer wanted it
 A program cannot be translated if it to do.
contains syntax errors. Instead a list of
 Logic errors are found when a program is
errors is produced. Program has to be
being run.
corrected and recompiled.
 Logic errors can be traced using test data
 When a program is being interpreted.
with expected results
Interpreter execute one statement at a time,
incase of syntax error, the interpreter
identifies the location of error. The error is 93

corrected by the programmer and


4.2.5 INTEGRATED DEVELOPMENT ENVIRONMENT (IDE)

 An Integrated Development Environment (IDE) is used by programmers


to aid the writing and development of programs.
 There are many different IDEs available; some just support one
programming language, others can be used for several different
programming languages.
 You may be using PyCharm (for Python), Visual Studio (for Visual Basic)
or BlueJ (for Java) as your IDE.
FEATURES OF AN IDE

 Code editors
 A translator
 A runtime environment with a debugger
 Error diagnostics
 Auto-completion
 Auto-correction
 An auto-documenter and prettyprinting.
CODE EDITOR
 A code editor allows a program to be written and edited without the need to use a
separate text editor.
 This speeds up the program development process, as editing can be done without
changing to a different piece of software each time the program needs correcting or
adding to.
TRANSLATOR

 Most IDEs usually provide a translator, this can be a compiler and/or an interpreter,
to enable the program to be executed.
 The interpreter is often used for developing the program and the compiler to
produce the final version of the program to be used.
A RUNTIME ENVIRONMENT WITH A DEBUGGER
 A debugger is a program that runs the program under development and allows the programmer to
step through the program a line at a time (single stepping) or to set a breakpoint to stop the
execution of the program at a certain point in the source code.
 A report window then shows the contents of the variables and expressions evaluated at that point in
the program.
 This allows the programmer to see if there are any logic errors in the program and check that the
program works as intended.
ERROR DIAGNOSTICS AND AUTO-CORRECTION

 Dynamic error checking finds possible errors as the program code is being typed,
alerts the programmer at the time and provides a suggested correction.
 Many errors can therefore be found and corrected during program writing and
editing before the program is run.
AUTO-COMPLETION

Code editors can offer context-sensitive prompts with text completion for variable
names and reserved words.
AUTO-DOCUMENTER AND PRETTYPRINTING

 IDEs can provide an auto-documenter to explain the function and purpose of


programming code.
 Most code editors colour code the words in the program and lay out the program in
a meaningful way – this is called prettyprinting.
3 a Describe the purpose of an operating system.
Ans –software that provides an environment in which applications can
run and also provides an interface between computer and human
operator
b What is meant by virtual memory?
Ans : Virtual memory is a section of volatile memory created
temporarily on the storage drive. It is created when a computer is
running many processes at once and RAM is running low. The
operating system makes part of the storage drive available to use as
RAM.
c What is meant by disk thrashing and why does it occur?
Ans : disk thrashing describes when a hard drive is being overworked
by moving information between the system memory and virtual
memory excessively. Thrashing occurs when the system does not
3 d What is meant by multitasking?
Ans : a function that allows a computer to process more than one task/process
at a time
e Describe what an interrupt is.
Ans : a signal sent from a device or software to a microprocessor requesting its
attention; the microprocessor suspends all operations until the interrupt
has been serviced
4 a Explain the differences between a Graphical User Interface
(GUI) and a Command Line Interface (CLI).
Ans : 1-A CLI requires a user to type in instructions whereas a GUI allows the
user to interact with a computer using a pointing device
2- The user has to therefore learn a number of commands just to carry out basic
operations whereas in GUI user has to Simply select any of the icons from the
screen
3- In CLI it is possible to alter computer configuration settings whereas in GUI
the user is limited to the icons provided on the screen
4b Give one advantage and one disadvantage of using a GUI interface.
Ans:
Any one advantage of GUI from:
– only need to click on one simple picture
– so much easier for the novice
– several instructions are replaced by one icon
– no need to understand how computer systems work
Any one disadvantage of GUI from:
– wasteful of computer memory
– if user wants to communicate with computer system directly, GUI is effectively
c Give one advantage and one disadvantage of using a CLI
: ADVANTAGE OF CLI
– direct communication with computer system/– not restricted to a number of pre-determined
options/– simple interface using keyboard only/– faster response
DISADVANTAGE OF CLI :
– need to learn a number of/long/complex commands
– need to type in the commands (possibility of errors)
– slow having to type in commands every time
7 Describe the differences between a compiler and an assembler. [4]

Compiler Assembler
Translates high-level program Translates a low-level language
into machine code. program into machine code.

One high-level language One low-level language


statement can be translated into statement is usually translated
several machine code into one machine code
instructions. instruction.
8 (b) Describe the following features of An Integrated Development Environment
– Auto-completion
Code editors can offer context-sensitive prompts with text completion for variable names and reserved
words.
– Auto-correction
alerts the programmer at the time of typing and provides a suggested correction.
– Prettyprinting
displaying source code using different colours and formatting, which make the code easier to read
and understand
a Explain what is meant by the term IDE. [2]
Ans : A suite of programs used to write and test a computer program written in a high-level
language
c Identify two other features that should be included in an IDE. Give a reason why each feature is
necessary. [4]
Ans : Code Editor
Reason : This speeds up the program development process, as editing can be done without changing to a
different piece of software each time the program needs correcting or adding to.
Translator
Reason : Most IDEs usually provide a translator, this can be a compiler and/or an interpreter, to enable the
program to be executed.
9 Pedro has written a program in a high-level language to do some calculations for a friend. His friend
needs to use the program immediately on his laptop. Pedro does not know what software is
available on the laptop. Also, his friend’s internet connection is very slow. Explain which type of translator
Pedro should use for his program.
Give reasons why this is the best choice in this case. [6]
Ans: Pedro should use a Compiler
Reasons
• compiler produces object code that is portable and can run on any machine
• No need to download any translator as internet connection is slow
• a compiled program can be stored ready for use
• a compiled program can be executed without the compiler
• a compiled program takes up less space in memory when it is executed
• a compiled program is executed in a shorter time
Q (a)Give one type of program that should be written in assembly language.
(b) Give one reason why assembly language is used.
Ans : device driver
(b) Since device driver is system software that directly computer hardware and assembly language
make use of special hardware and special machine-dependent instructions
Activity 4.2 Pg. 173

110
Activity 4.2 Pg. 173

111

You might also like