Programming for Problem solving
Notes (Unit-1)
What do you mean by the term “Programming for Problem Solving”?
• Solving problems is the core of computer science. Programmers must first understand
how a human solves a problem, then understand how to translate this "algorithm" into
something a computer can do, and finally how to "write" the specific syntax (required by
a computer) to get the job done. It is sometimes the case that a machine will solve a problem
in a completely different way than a human.
• Especially when it comes to programming, problem-solving is the must. If you do not
develop sound problem-solving skills, you will end up messing around with a given problem,
and you would not be able to obtain a solution for ages.
• Computer Programmers are problem solvers. In order to solve a problem on a computer
you must: Know how to represent the information (data) describing the problem & determine
the steps to transform the information from one representation into another.
1
Programming for Problem Solving
, Pre-requisite keywords
• Program- A program can be defined as a collection of instructions written to perform
any user`s defined task incomputer.
• Data- Any raw facts
• Information- Collection of data that has some meaning (Meaningful Data)
• Hardware- Computer hardware is a collective term used to describe any of the physical
components of an analog ordigital computer.
• Software- Software commands the hardware what to do & how to do it. Together, the
hardware & software form thecomputer system. This software is further classified as system
software & application software.
• System Software- System software is a set of programs, responsible for running the computer,
controlling various operations of computer systems and management of computer resources.
They act as an interface between the hardwareof the computer & the application software. E.g.:
Operating System.
• Application software- Application Software is a set of programs designed to solve a particular
problem for users. It allows the enduser to do something besides simply running the hardware.
E.g.: Web Browser, Gaming Software, etc.
Introduction to computers
Right from its inception, to the present day, all computer system (irrespective of their shape &
size) performs the following 5 basic operations. It converts the raw input data into information, which
is useful tothe users.
• Input: It is the process of entering data & instructions to the computer system.
• Storing: The data & instructions are stored for either initial or additional processing, as &
when required.
• Processing: It requires performing arithmetic or logical operation on the saved data to convert
itinto useful information.
• Output: It is the process of producing the output data to the end user.
• Controlling: The above operations have to be directed in a particular sequence to be completed.
Explanation of working of digital computer using Block diagram
2
Programming for Problem Solving
, Input Unit
We need to first enter the data & instruction in the computer system, before any computation
begins. This task is accomplished by the input devices. (The data accepted is in a human readable
form. The inputdevice converts it into a computer readable form).
Input device: The input device is the means through which data and instructions enter in a computer.
1. Camera - The camera transmits a picture from one computer to another, or can be used to record a
shortvideo.
2. Compact Disc (CD) - CDs store information. The CD can then be put into another computer, and
theinformation can be opened and added or used on the second computer. Note: A CD-R or CD-RW
can alsobe used as an OUTPUT device.
3. Keyboard - The keyboard is a way to input letters or numbers into different applications or programs.
Akeyboard also has special keys that help operate the computer.
4. Mouse - The mouse is used to open and close files, navigate web sites, and click on a lot of
commands (to tell the computer what to do) when using different applications.
5. Microphone - A microphone is used to record sound. The sound is then saved as a sound file on the
computer.
3
Programming for Problem Solving
, 6. Scanner - A scanner is used to copy pictures or other things and save them as files on the computer.
7. Joystick - A joystick is used to move the cursor from place to place, and to click on various items
in programs. A joystick is used mostly for computer games.
8. Bar Code Scanner - A bar code scanner scans a little label that has a bar code on it. The information
isthen saved on the computer. Bar code scanners are used in libraries a lot.
Storing/Storage Unit
The data & instruction that are entered have to be stored in the computer. Similarly, the end results &
the intermediate results also have to be stored somewhere before being passed to the output unit. The
storage unit provides solution to all these issues. The storage unit is designed to save the initial data, the
intermediateresult & the final result. They are of two types: Primary storage & Secondary storage.
Primary Storage:
The primary storage, also called as the main memory, holds the data when the computer is currently
on.As soon as the system is switched off or restarted, the information held in primary storage disappears
(i.e. itis volatile in nature). Moreover, the primary storage normally has a limited storage capacity,
because it is very expensive as it is made up of semiconductor devices. RAM is a primary storage.
Secondary Storage:
The secondary storage, also called as the auxiliary storage, handles the storage limitation & the
volatile nature of the primary memory. It can retain information even when the system is off. It is
basically used forholding the program instructions & data on which the computer is not working on
currently, but needs to process them later. for example-
a. Magnetic Disk
The Magnetic Disk is Flat, circular platter with metallic coating that is rotated beneath read/write
heads. Itis a Random access device; read/write head can be moved to any location on the platter.
b. floppy Disk
These are small removable disks that are plastic coated with magnetic recording material. Floppy
disks are typically 3.5″ in size (diameter) and can hold 1.44 MB of data. This portable storage device
is a rewritable media and can be reused a number of times. Floppy disks are commonly used to move
files between different computers. The main disadvantage of floppy disks is that they can be damaged
easily and,therefore, are not very reliable.
c.Hard disk
A hard disk consists of one or more rigid metal plates coated with a metal oxide material that allows
4
Programming for Problem Solving
Notes (Unit-1)
What do you mean by the term “Programming for Problem Solving”?
• Solving problems is the core of computer science. Programmers must first understand
how a human solves a problem, then understand how to translate this "algorithm" into
something a computer can do, and finally how to "write" the specific syntax (required by
a computer) to get the job done. It is sometimes the case that a machine will solve a problem
in a completely different way than a human.
• Especially when it comes to programming, problem-solving is the must. If you do not
develop sound problem-solving skills, you will end up messing around with a given problem,
and you would not be able to obtain a solution for ages.
• Computer Programmers are problem solvers. In order to solve a problem on a computer
you must: Know how to represent the information (data) describing the problem & determine
the steps to transform the information from one representation into another.
1
Programming for Problem Solving
, Pre-requisite keywords
• Program- A program can be defined as a collection of instructions written to perform
any user`s defined task incomputer.
• Data- Any raw facts
• Information- Collection of data that has some meaning (Meaningful Data)
• Hardware- Computer hardware is a collective term used to describe any of the physical
components of an analog ordigital computer.
• Software- Software commands the hardware what to do & how to do it. Together, the
hardware & software form thecomputer system. This software is further classified as system
software & application software.
• System Software- System software is a set of programs, responsible for running the computer,
controlling various operations of computer systems and management of computer resources.
They act as an interface between the hardwareof the computer & the application software. E.g.:
Operating System.
• Application software- Application Software is a set of programs designed to solve a particular
problem for users. It allows the enduser to do something besides simply running the hardware.
E.g.: Web Browser, Gaming Software, etc.
Introduction to computers
Right from its inception, to the present day, all computer system (irrespective of their shape &
size) performs the following 5 basic operations. It converts the raw input data into information, which
is useful tothe users.
• Input: It is the process of entering data & instructions to the computer system.
• Storing: The data & instructions are stored for either initial or additional processing, as &
when required.
• Processing: It requires performing arithmetic or logical operation on the saved data to convert
itinto useful information.
• Output: It is the process of producing the output data to the end user.
• Controlling: The above operations have to be directed in a particular sequence to be completed.
Explanation of working of digital computer using Block diagram
2
Programming for Problem Solving
, Input Unit
We need to first enter the data & instruction in the computer system, before any computation
begins. This task is accomplished by the input devices. (The data accepted is in a human readable
form. The inputdevice converts it into a computer readable form).
Input device: The input device is the means through which data and instructions enter in a computer.
1. Camera - The camera transmits a picture from one computer to another, or can be used to record a
shortvideo.
2. Compact Disc (CD) - CDs store information. The CD can then be put into another computer, and
theinformation can be opened and added or used on the second computer. Note: A CD-R or CD-RW
can alsobe used as an OUTPUT device.
3. Keyboard - The keyboard is a way to input letters or numbers into different applications or programs.
Akeyboard also has special keys that help operate the computer.
4. Mouse - The mouse is used to open and close files, navigate web sites, and click on a lot of
commands (to tell the computer what to do) when using different applications.
5. Microphone - A microphone is used to record sound. The sound is then saved as a sound file on the
computer.
3
Programming for Problem Solving
, 6. Scanner - A scanner is used to copy pictures or other things and save them as files on the computer.
7. Joystick - A joystick is used to move the cursor from place to place, and to click on various items
in programs. A joystick is used mostly for computer games.
8. Bar Code Scanner - A bar code scanner scans a little label that has a bar code on it. The information
isthen saved on the computer. Bar code scanners are used in libraries a lot.
Storing/Storage Unit
The data & instruction that are entered have to be stored in the computer. Similarly, the end results &
the intermediate results also have to be stored somewhere before being passed to the output unit. The
storage unit provides solution to all these issues. The storage unit is designed to save the initial data, the
intermediateresult & the final result. They are of two types: Primary storage & Secondary storage.
Primary Storage:
The primary storage, also called as the main memory, holds the data when the computer is currently
on.As soon as the system is switched off or restarted, the information held in primary storage disappears
(i.e. itis volatile in nature). Moreover, the primary storage normally has a limited storage capacity,
because it is very expensive as it is made up of semiconductor devices. RAM is a primary storage.
Secondary Storage:
The secondary storage, also called as the auxiliary storage, handles the storage limitation & the
volatile nature of the primary memory. It can retain information even when the system is off. It is
basically used forholding the program instructions & data on which the computer is not working on
currently, but needs to process them later. for example-
a. Magnetic Disk
The Magnetic Disk is Flat, circular platter with metallic coating that is rotated beneath read/write
heads. Itis a Random access device; read/write head can be moved to any location on the platter.
b. floppy Disk
These are small removable disks that are plastic coated with magnetic recording material. Floppy
disks are typically 3.5″ in size (diameter) and can hold 1.44 MB of data. This portable storage device
is a rewritable media and can be reused a number of times. Floppy disks are commonly used to move
files between different computers. The main disadvantage of floppy disks is that they can be damaged
easily and,therefore, are not very reliable.
c.Hard disk
A hard disk consists of one or more rigid metal plates coated with a metal oxide material that allows
4
Programming for Problem Solving