Chapter 1 Introduction To Computer And Programming
Chapter 1 Introduction To Computer And Programming
Prepared By:
Subject : PPS
Asst. Prof. Rupali Patel
Code : 3110003 (CSE Department, ACET)
Block Diagram of Computer
Mainly computer system consists of three parts, that are central
processing unit (CPU), Input Devices, and Output Devices. The Central
Processing Unit (CPU) is divided into two parts again: arithmetic logic
unit (ALU) and the control unit (CU).
The data is entered through input devices such as the keyboard, mouse,
etc. This set of instruction is processed by the CPU after getting the input
by the user, and then the computer system produces the output. The
computer can show the output with the help of output devices to the user,
such as monitor, printer, etc.
Block Diagram of Computer
Central Processing Unit (CPU)
The computer system is nothing without the Central processing Unit so, it is also
known as the brain or heat of computer. The CPU is an electronic hardware
device which can perform different types of operations such as arithmetic and
logical operation.
Control Unit
The control unit (CU) controls all the activities or operations which are
performed inside the computer system. It receives instructions or information
directly from the main memory of the computer.
Software products evolve by adding new features to existing Hardware design is based on architectural decisions to make
programs to support hardware. it work over a range of environmental conditions and time.
It will vary as per computer and its built-in functions and It is mostly constructed for all types of computer systems.
programming language.
It is designed and developed by experienced programmers in high- The hardware can understand only low-level language or
level language. machine language.
It is represented in any high-level language such as BASIC, COBOL, The hardware works only on binary codes 1’s and 0’s.
C, C++, JAVA, etc.
The software is categorized as operating system, utilities, language The hardware consists of input devices, output devices,
processor, application software, etc. memory, etc.
Difference between Compiler & Interpreter
Interpreter Compiler
Translates program one statement at a time Scans the entire program and translates it as a whole
into machine code.
It takes less amount of time to analyze the source code but It takes a large amount of time to analyze the source
the overall execution time is slower. code but the overall execution time is comparatively
faster.
No intermediate object code is generated, hence are Generates intermediate object code which further
memory efficient. requires linking, hence requires more memory..
Continues translating the program until the first error is met, It generates the error message only after scanning
in which case it stops. Hence debugging is easy. the whole program. Hence debugging is
comparatively hard.
Programming languages like Python, Ruby use interpreters. Programming languages like C, C++, Java use
compilers.
Languages
What is Machine Language?
A computer’s native language is called Machine Language. Machine language is
the most primitive or basic programming language that starts or takes
instructions in the form of raw binary code. Ex.:1101101010011010
Then the algorithm is written with the help of above parameters such that it
solves the problem.
Algorithm
EXAMPLE : Write an algorithm to add two numbers entered by the user
Step 1: Start
Step 2: Declare variables num1, num2 and sum.
Step 3: Read values num1 and num2.
Step 4: Add num1 and num2 and assign the result to sum.
sum←num1+num2
Step 5: Display sum
Step 6: Stop
Flow Charts
A flowchart is a blueprint that pictorially represents the algorithm and its steps.
The steps of a flowchart do not have a specific size and shape rather it is
designed in different shapes and sizes .
Flow Charts
EXAMPLE : Add two numbers entered by the user.