Unit-1 Study Material PDF
Unit-1 Study Material PDF
UNIT-1
INTRODUCTION TO PROGRAMMING:-
Before we understand what programming is, you must know what a computer is. A computer is a device that
can accept human instruction processes it and responds to it or a computer is a computational device which is
used to process the data under the control of a computer program. Program is a sequence of instruction along
withdata.
Most of us have heard that CPU is called the brain of our computer because it accepts data, provides
temporary memory space to it until it is stored (saved) on the hard disk, performs logical operations on it and
hence processes (here also means converts) data into information. We all know that a computer consists of
hardware and software. Software is a set of programs that performs multiple tasks together. An operating
system is also software (system software) that helps humans to interact with the computer system.
WHAT IS PROGRAMMING:-
A program is a set of instructions given to a computer to perform a specific operation. or computer is a
computational device which is used to process the data under the control of a computer program. While
executing the program, raw data is processed into a desired output format. These computer programs are
written in programming languages which are high level languages.
Characteristics of Computer
To understand why computers are such an important part of our lives, let us look at some of its characteristics −
Speed − typically, a computer can carry out 3-4 million instructions per second.
Accuracy − Computers exhibit a very high degree of accuracy. Errors that may occur are usually due to
inaccurate data, wrong instructions or bug in chips – all human errors.
Reliability − Computers can carry out same type of work repeatedly without throwing up errors due to tiredness
or boredom, which are very common among humans.
Versatility − Computers can carry out a wide range of work from data entry and ticket booking to complex
mathematical calculations and continuous astronomical observations. If you can input the necessary data with
correct instructions, computer will do the processing.
Storage Capacity − Computers can store a very large amount of data at a fraction of cost of traditional storage
of files. Also, data is safe from normal wear and tear associated with paper.
For example, a word-processing software enables the user to create, edit and save documents. A web
browser enables the user to view and share web pages and multimedia files. There are two categories of
software −
System Software
Application Software
Utility Software
Machines understand only binary language i.e. 0 (absence of electric signal) and 1 (presence of electric
signal) while humans speak in English, French, German, Tamil, Hindi and many other languages. English is
the pre-dominant language of interacting with computers. Software is required to convert all human
instructions into machine understandable instructions. And this is exactly what system software does.
Operating System
Language Processor
Device Drivers
Operating System
System software that is responsible for functioning of all hardware parts and their interoperability to carry out
tasks successfully is called operating system (OS). OS is the first software to be loaded into computer
memory when the computer is switched on and this is called booting. OS manages a computer’s basic
functions like storing data in memory, retrieving files from storage devices, scheduling tasks based on priority,
etc.
Language Processor
As discussed earlier, an important function of system software is to convert all user instructions into machine
understandable language. When we talk of human machine interactions, languages are of three types −
Machine-level language –
This language is nothing but a string of 0s and 1s that the machines can understand. It is completely
machine dependent.
Assembly-level language –
This language introduces a layer of abstraction by defining mnemonics. Mnemonics are English like
words or symbols used to denote a long string of 0s and 1s. For example, the word “READ” can be
defined to mean that computer has to retrieve data from the memory. The complete instruction will
also tell the memory address. Assembly level language is machine dependent.
This language uses English like statements and is completely independent of machines. Programs
written using high level languages are easy to create, read and understand.
Program written in high level programming languages like Java, C++, etc. is called source code. Set of
instructions in machine readable form is called object code or machine code. System software that
converts source code to object code is called language processor. There are three types of language
interpreters−
Interpreter − Converts high level programs into machine level program line by line.
Compiler − Converts high level programs into machine level programs at one go rather than line by
line.
Device Drivers
System software that controls and monitors functioning of a specific device on computer is called device
driver. Each device like printer, scanner, microphone, speaker, etc. that needs to be attached externally to
the system has a specific driver associated with it. When you attach a new device, you need to install its
driver so that the OS knows how it needs to be managed.
Application Software
Software that performs a single task and nothing else is called application software. Application software is
very specialized in their function and approach to solving a problem. So spreadsheet software can only do
operations with numbers and nothing else. A hospital management software will manage hospital activities
and nothing else. Here is some commonly used application software −
Word processing
Spreadsheet
Presentation
Database management
Multimedia tools
Utility Software
Application software that assist system software in doing their work is called utility software. Thus utility
software is actually a cross between system software and application software. Examples of utility software
include −
Antivirus software
Disk management tools
File management tools
AMIT AWASTHI SIR
(Assistant Professor)
PROGRAMMING FOR PROBLEM SOLVING
Compression tools
Backup tools
It can be understood by taking an example of cooking a new recipe. To cook a new recipe, one reads the
instructions and steps and executes them one by one, in the given sequence. The result thus obtained is the
new dish cooked perfectly. Similarly, algorithms help to do a task in programming to get the expected output.
3. Take the three numbers, to be added, as inputs in variables num1, num2, and num3
respectively.
4. Declare an integer variable sum to store the resultant sum of the 3 numbers.
5. Add the 3 numbers and store the result in the variable sum.
7. END
Flow-Chart Symbols
The following table illustrates the symbols along with their names (used in a flow-chart) –
Pseudo code is a STEP-BY-STEP writing outline of your code that you can gradually transcribe in to a
programming language.
Pseudo code is a term which is often used in programming and algorithm based fields. It is a methodology
that allows the programmer to represent the implementation of an algorithm
Source code is the fundamental component of a computer program that is created by a programmer. It can
be read and easily understood by a human being. When a programmer types a sequence of C programming
language statements into Windows Notepad, for example, and saves the sequence as a text file, the text file is
said to contain the source code.