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

Module 1

The document provides an overview of computers, detailing their components such as the CPU, memory, input/output devices, and the distinction between hardware and software. It explains programming languages, including low-level and high-level languages, and the roles of compilers and interpreters in translating code. Additionally, it introduces structured programming approaches and the use of flowcharts and algorithms in programming.

Uploaded by

raiyaanparvez99
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Module 1

The document provides an overview of computers, detailing their components such as the CPU, memory, input/output devices, and the distinction between hardware and software. It explains programming languages, including low-level and high-level languages, and the roles of compilers and interpreters in translating code. Additionally, it introduces structured programming approaches and the use of flowcharts and algorithms in programming.

Uploaded by

raiyaanparvez99
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 34

B.

Tech (CS)
Module -I

By
Vikash Kr. Singh
Asst. Prof(CSE)
What is Computer?
The literal meaning of computer is a device that can calculate. However,
modern computers can do a lot more than calculate.
Computer is an electronic device that receives input, stores or processes the
input as per user instructions and provides output in desired format.
Computer is an electronic device i.e. used to work with information or
compute. It is derived from the Latin word "computare" which means to
calculate.
❑ The basic parts without which a computer cannot work
are as follows:
Processor: It executes instructions from software and hardware.
Memory: It is the primary memory for data transfer between the CPU and
storage.
Motherboard: It is the part that connects all other parts or components of a
computer.
Storage Device: It permanently stores the data, e.g., hard drive.
Input Device: It allows you to communicate with the computer or to input
data, e.g., a keyboard.
Output Device: It enables you to see the output, e.g., monitor.
Block Diagram of Computer
❑ Input-Unit:
❖ Computers need to receive data and instruction in order to solve any problem.
❖ Therefore we need to input the data and instructions into the computers.
❖ The input unit consists of one or more input devices.
❖ Keyboard is the one of the most commonly used input device.
❖ Other commonly used input devices are the mouse, floppy disk drive, magnetic
tape, etc.
❑ Arithmetic Logical Unit (ALU):
❖ All calculations are performed in the Arithmetic Logic Unit (ALU) of the
computer.
❖ It also does comparison and takes decision.
❖ The ALU can perform basic operations such as addition, subtraction,
multiplication, division, etc and does logic operations like >, <, =, ‘etc.
❖ Whenever calculations are required, the control unit transfers the data
from storage unit to ALU once the computations are done, the results are
transferred to the storage unit by the control unit and then it is send to
the output unit for displaying results.
❑ Control Unit:
❖ It controls all other units in the computer.
❖ The control unit instructs the input unit, where to store the data after
receiving it from the user.
❖ It controls the flow of data and instructions from the storage unit to
ALU.
❖ It also controls the flow of results from the ALU to the storage unit.
❖ The control unit is generally referred as the central nervous system of
the computer that control and synchronizes its working.
❑ Central Processing Unit (CPU)
❖ The control unit and ALU are together known as CPU. CPU is the brain
of computer system. It performs following tasks:
It performs all operations.
It takes all decisions.
It controls all the units of computer.
❑ Memory or Storage Unit
❖ This unit holds the data and instructions. It also stores the intermediate
results before these are sent to the output devices. It also stores the data
for later use.
The storage unit of a computer system can be divided into two categories:
❖ Primary Storage: This memory is used to store the data which is
being currently executed. It is used for temporary storage of data. The
data is lost, when the computer is switched off. RAM is used as primary
storage memory.
❖ Secondary Storage: The secondary memory is slower and cheaper
than primary memory. It is used for permanent storage of data.
Commonly used secondary memory devices are hard disk, CD etc.
❑ Output Unit
❖ It connects the internal system of a computer to the external environment.
❖ It provides the results of any computation, or instructions to the outside
world. Some output devices are printers, monitor etc.
Hardware
❖ Hardware is best described as a device, such as a hard drive, that is physically
connected to the computer or something that can be physically touched.
❖ A CD-ROM, computer display monitor, printer, and video card are all examples of
computer hardware.
❖ Without any hardware, a computer would not function, and software would have
nothing to run on.
❖ Hardware and software interact with one another: software tells hardware which
tasks it needs to perform.
Software
❖ Software is a set of programs, which is designed to perform a
well-defined function. A program is a sequence of instructions written
to solve a particular problem.
❖ It is a set of programs that enables the hardware to perform a specific
task.
❖ All the programs that run the computer are software.
There are two types of software −
❑ System Software
❑ Application Software
1) System Software
❖ System software is the main software that runs the computer.
❖ When you turn on the computer it activates the hardware and controls
and coordinates their functioning.
❖ The application programs are also controlled by system software.
❖ Some examples of system software are Operating System, Compilers,
Interpreter, Assemblers, etc.
2) Application Software
❖ Applications software is a set of programs designed to perform a specific
task.
❖ It does not control or coordinate the working of computer.
❖ A computer can run without application software.
❖ Application software can be easily installed or uninstalled as required.
❖ Microsoft Office Suite, Adobe Photoshop and any other software like
payroll software or income tax software are application software.
So far as programming language concern these are of two types.
1) Low level language 2) High level language
❑ Low level language:
Low level languages are machine level and assembly level language.
In machine level language computer only understand digital numbers i.e. in the
form of 0 and 1.
So, instruction given to the computer is in the form binary digit, which is
difficult to implement instruction in binary code.
This type of program is not portable, difficult to maintain and also error prone.
The assembly language is on other hand modified version of machine level
language.
Where instructions are given in English like word as ADD, SUM, MOV etc. It is
easy to write and understand but not understand by the machine. So the
translator used here is assembler to translate into machine level.
❑ High level language:
❖ These languages are machine independent, means it is portable.
❖ The language in this category is Pascal, Cobol, Fortran etc.
❖ High level languages are not understood by the machine. So it need to translate by
the translator into machine level.
❖ A translator is software which is used to translate high level language as well as low
level language in to machine level language.
❖ Three types of translator are there:
Compiler
Interpreter
Assembler
Compiler and interpreter are used to convert the high level language into
machine level language.
The program written in high level language is known as source program and
the corresponding machine level language program is called as object program.
Both compiler and interpreter perform the same task but there working is
different.
Compiler read the program at-a-time and searches the error and lists them.
If the program is error free then it is converted into object program.
When program size is large then compiler is preferred.
Whereas interpreter read only one line of the source code and convert it to
object code.
If it check error, statement by statement and hence of take more time.
Compiler & Interpreter
❖ We generally write a computer program using a high-level language.
❖ A high-level language is one which is understandable by us humans. It
contains words and phrases from the English language.
❖ But a computer does not understand high-level language. It only
understands program written in 0’s and 1’s in binary, called the machine
code.
❖ A program written in high-level language is called a source code. We need
to convert the source code into machine code and this is accomplished by
compilers and interpreters.
❖ Hence, a compiler or an interpreter is a program that converts program
written in high-level language into machine code understood by the
computer.
The difference between an interpreter and a compiler is given below:

Interpreter Compiler
Scans the entire program and translates it as a
Translates program one statement at a time.
whole into machine code.
It takes less amount of time to analyze the It takes large amount of time to analyze the
source code but the overall execution time is source code but the overall execution time is
slower. comparatively faster.
Generates intermediate object code which
No intermediate object code is generated,
further requires linking, hence requires more
hence are memory efficient.
memory.
Continues translating the program until the It generates the error message only after
first error is met, in which case it stops. scanning the whole program. Hence
Hence debugging is easy. debugging is comparatively hard.
Programming language like Python, Ruby use Programming language like C, C++ use
interpreters. compilers.
Structured Programming Approach
❖ Structured Programming Approach, as the word suggests, can be defined as a
programming approach in which the program is made as a single structure.
❖ It means that the code will execute the instruction by instruction one after the other.
❖ It doesn’t support the possibility of jumping from one instruction to some other with
the help of any statement like GOTO, etc.
❖ Therefore, the instructions in this approach will be executed in a serial and structured
manner. The languages that support Structured programming approach are:
❑ C
❑ C++
❑ Java
❑ C#
On the contrary, in the Assembly languages like Microprocessor 8085,
etc, the statements do not get executed in a structured manner.
It allows jump statements like GOTO. So the program flow might be
random.
Flowchart in Programming
A flowchart is a diagrammatic representation of an algorithm.
A flowchart can be helpful for both writing programs and explaining the
program to others.
Flowchart is a graphical representation of an algorithm.
Programmers often use it as a program-planning tool to solve a problem.
It makes use of symbols which are connected among them to indicate the
flow of information and processing.
The process of drawing a flowchart for an algorithm is known as
“flowcharting”.
Symbol Symbol Name Purpose
Used at the beginning and end of the algorithm to show
Start/Stop
start and end of the program.

Input/ Output
Indicates processes like mathematical operations.

Processing Used for denoting program inputs and outputs.

Stands for decision statements in a program, where answer


Decision
is usually Yes or No.

Arrow Shows relationships between different shapes.

Connects two or more parts of a flowchart, which are on


On-page Connector
the same page.

Connects two parts of a flowchart which are spread over


Off-page Connector
different pages.
Draw a flow chart to add 10 and 20
Add two numbers entered by the user
Find the largest among three different numbers entered by the
user.
Flowchart to check Odd or Flowchart to calculate the average of two numbers
Even number
Concept of Algorithm
The term algorithm refers to the logic of a program.
It is a step-by-step description of how to arrive at a solution to a given
problem.
It is defined as a sequence of instructions that when executed in the
specified sequence, the desired results are obtained.
Design an algorithm to add two numbers and display the result
Thank
you!!!

You might also like