SlideShare une entreprise Scribd logo
1  sur  48
Télécharger pour lire hors ligne
GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year
PROGRAMMING FOR PROBLEM SOLVING 1FY3-
06
Fundamentals of Computer
By
SANTOSH KUMAR
ASST. PROF
CSE/IT, GIT Jaipur
Contents
Syllabus
Marks distribution
Objective of course
Book
GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year
Computer
Data Processing
GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year
GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year
Objective of the Course:
The course is designed to understand the concept of programming language, to know
about memory unit and understanding various binary codes and to enhance the
programming skills of the students by giving practical assignments to be done in labs.
Books Recommended for Reading and Reference:
1. Ritchie & Kernighan, The C Programming language, 2nd Ed., PHI.
2. Yashwant Kanetkar, Let us C, 7edition. BPB Publication, 2009.
3. Dey & Ghosh, Computer Fundamentals and programming in C, Oxford.
4. Balaguruswamy, Programming in ANSI C, 5th Ed., TMH.
5. Rajaraman, Fundamentals of Computers, 5th Ed. PHI, 2011.
6. P. K. Sinha & P. Sinha, Computer fundamentals
Learning Outcomes:
After the completion of the course, the students will
•To bridge the gap between the knowhow of Fundamental of Computer Programming and
its actual application and implementation in the field of computer science & engineering.
GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year
•To make students able to understand the concepts of Programming and its mechanism
so that he/she is able to define the solution of different problems via algorithms
Computer
•The word computer comes from the word “compute” , which means, “to
calculate”
•Thereby, a computer is an electronic device that can perform arithmetic
operations at high speed
•A computer is also called a data processor because it can store, process, and
retrieve data whenever desired
Data Processing
•The activity of processing data using a computer is called data processing
GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year
•Data is raw material used as input and information is processed data obtained
as output of data processing.
The Five Basic Operations of a Computer System
•Inputting. The process of entering data and instructions into the computer
system
GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year
•Storing. Saving data and instructions to make them readily available for initial
or additional processing whenever required
•Processing. Performing arithmetic operations (add, subtract, multiply,
divide, etc.) or logical operations (comparisons like equal to, less than,
greater than, etc.) on data to convert them into useful information
•Outputting. The process of producing useful information or results for the user
such as a printed report or visual display
•Controlling. Directing the manner and sequence in which all of the above
operations are performed
The Five Basic Operations of a Computer System
•Inputting. The process of entering data and instructions into the computer
system
GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year
•Storing. Saving data and instructions to make them readily available for initial
or additional processing whenever required
•Processing. Performing arithmetic operations (add, subtract, multiply,
divide, etc.) or logical operations (comparisons like equal to, less than,
greater than, etc.) on data to convert them into useful information
•Outputting. The process of producing useful information or results for the user
such as a printed report or visual display
•Controlling. Directing the manner and sequence in which all of the above
operations are performed
GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year
Basic Organization of a Computer System
GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year
Input Unit
An input unit of a computer system performs the following functions:
1. It accepts (or reads) instructions and data from outside world
2. It converts these instructions and data in computer acceptable form
3. It supplies the converted instructions and data to the computer system for
further processing
GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year
Output Unit
An output unit of a computer system performs the following functions:
1. It accepts the results produced by the computer, which are in coded form
and hence, cannot be easily understood by us
2. It converts these coded results to human acceptable (readable) form
3. It supplies the converted results to outside world
GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year
Storage Unit
The storage unit of a computer system holds (or stores) the following :
1. Data and instructions required for processing (received from input devices)
2. Intermediate results of processing
3. Final results of processing, before they are released to an output device
Two Types of Storage
Primary storage
•Used to hold running program instructions
•Used to hold data, intermediate results, and results of ongoing processing of
job(s)
•Fast in operation
•Small Capacity
GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year
•Expensive
•Volatile (looses data on power dissipation)
Two Types of Storage
Secondary storage
•Used to hold stored program instructions
•Used to hold data and information of stored jobs
•Slower than primary storage
•Large Capacity
•Lot cheaper that primary storage
•Retains data even without power
Arithmetic Logic Unit (ALU)
Arithmetic Logic Unit of a computer system is the place where the actual
executions of instructions takes place during processing operation
GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year
Control Unit (CU)
Control Unit of a computer system manages and coordinates the operations of
all other components of the computer system
Central Processing Unit (CPU)
•It is the brain of a computer system
•It is responsible for controlling the operations of all other units of a computer
system
GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year
A computer is a system as it comprises of integrated components (input
unit, output unit, storage unit, and CPU) that work together to perform
the steps called for in the executing program
Main Memory
•Every computer has a temporary storage built into the computer
hardware
•It stores instructions and data of a program mainly when the program
is being executed by the CPU.
•This temporary storage is known as main memory, primary storage, or
simply memory.
•Physically, it consists of some chips either on the motherboard or on a
small circuit board attached to the motherboard of a computer.
GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year
•It has random access property.
•It is volatile.
Random Access Memory (RAM)
•Primary storage of a computer is often
referred to as RAM because of its
random access capability
•RAM chips are volatile memory
•A computer’s motherboard is designed in a manner that the
memory capacity can be enhanced by adding more memory
chips
GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year
•The additional RAM chips, which plug into special sockets on the
motherboard, are known as single-in-line memory modules
(SIMMs)
Read Only Memory (ROM)
•ROM a non-volatile memory chip
•Data stored in a ROM can only be read and
used – they cannot be changed
•ROMs are mainly used to store programs and
data, which do not change and are frequently
used. For example, system boot program
GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year
Types of ROMs
Type Usage
Manufacturer-programmed ROM Data is burnt by the manufacturer of the
electronic equipment in which it is used.
User-programmed ROM
or
Programmable ROM (PROM)
The user can load and store “read-only”
programs and data in it
Erasable PROM (EPROM) The user can erase information stored in it and
the chip can be reprogrammed to store new
information
Ultra Violet EPROM (UVEPROM) A type of EPROM chip in which the stored
information is erased by exposing the chip for
some time to ultra-violet light
GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year
Electrically EPROM (EEPROM)
or
Flash memory
A type of EPROM chip in which the stored
information is erased by using high voltage
electric pulses
Cache Memory
•It is commonly used for minimizing the memory processor speed
mismatch.
•It is an extremely fast, small memory between CPU and main
memory whose access time is closer to the processing speed of
the CPU.
•It is used to temporarily store very active data and instructions
during processing.
GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year
Cache is pronounced as “cash”
Limitations of Primary Storage
•Limited capacity because the cost per bit of storage is high
•Volatile - data stored in it is lost when the electric power is
turned off or interrupted
GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year
Secondary Storage
•Used in a computer system to overcome the limitations of
primary storage
•Has virtually unlimited capacity because the cost per bit of
storage is very low
•Has an operating speed far slower than that of the primary
storage
•Used to store large volumes of data on a permanent basis
•Also known as auxiliary memory
GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year
Classification of Commonly Used Secondary Storage
Devices
GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year
GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year
Floppy Disk
• The most common secondary storage device
• 3.5” disk – 1.44MB
GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year
Hard Disk Drive or Hard Disk
• Made of rigid materials unlike floppy disks
• Holds a greater amount of data
GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year
Optical Discs
• A standard part of modern desktop machines, especially used
for multimedia purposes and preferred in loading
applications.
GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year
GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year
Kinds
• Blue Ray Disk – 40G
• Digital Versatile Disk
– DVD-R – write once, 3.95G
– DVD RW – rewritable, 3G
– Single Layer and Double Layer
• Compact Disk
– CD-R – write once, 650MB
– CD-RW – rewritable, 700MB Optical Drives
GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year
• CD-ROM read CDs
• CD-Writer read/write CDs
• DVD-Combo read/write CDs, read DVD
• DVD Writer read/write CDs
read/write DVDs
Other Secondary Storage
• Solid-State Storage
GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year
– No moving parts
– Flash memory cards
– USB flash drives
GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year
Storage Evaluation Criteria
Property Desirable
Primary
storage
Secondary
storage
Storage
capacity
Large storage capacity Small Large
Access Time Fast access time Fast Slow
Cost per bit of
storage Lower cost per bit High Low
Volatility Non-volatile Volatile Non-volatile
GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year
Access Random access
Random
access
Pseudorandom
access or
sequential
access
ACCESSMETHODS
•When we design a file, the important issue is how we will retrieve
information (a specific record) from the file.
•Sometimes we need to process records one after another, whereas
sometimes we need to access a specific record quickly without retrieving
the preceding records.
GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year
•The access method determines how records can be retrieved:
sequentially, randomly and direct.
ACCESSMETHODS
Sequential access
If we need to access a file sequentially—that is, one record after another, from
beginning to end —we use a sequential file structure.
Random access
If we need to access a specific record without having to retrieve all records before
it, we use a file structure that allows random access. Direct access direct access
is the ability to obtain data from a storage device by going directly to where it is
GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year
physically located on the device rather than by having to sequentially look for the
data at one physical location after another.
COMPUTER LANGUAGES
•To communicate with the computers, we need some languages. These
are computer languages.
•There are mainly three different languages with the help of which we
can develop computer programs.
•And they are –
1. Machine Level language
GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year
2. Assembly Level Language and
3. High Level Language
Machine Level Language
•Computer can understand only the language of Digital Electronics. Digital
Electronics deals with presence and absence of voltages. Within the
computer there are two logics can play their role.
•These logics are –
1. Positive Logic – Here presence of voltage will be denoted by 1 and
absence of voltage will be denoted by 0
GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year
2. Negative Logic – Here presence of voltage will be denoted by 0
and absence of voltage will be denoted by 1
Assembly Level Language
•After machine level language, the next level of development in the evolution of
computer languages was the Assembly Language.
•Machine level language uses only the binary language. But on the other hand,
assembly language uses mnemonics or symbolic instructions in place of a
sequence of 0s and 1s.
•Example : - we can consider that, to add register A and B in a particular computer,
assembly language uses the mnemonic ‘ADD B’ in place of 10001111. In assembly
language, we use symbolic names to denote addresses and data.
GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year
•Thus writing a program in assembly language has advantages over writing the
same in a machine language.
High Level Language
•High level language is the next development in the evolution of computer
languages.
•Examples of some high-level languages are given below –
•C/C++
•JAVA
•Pascal (named after the French scientist Blaise Pascal)
•High-level languages are like English-like language, with less words also known
as keywords and fewer ambiguities.
GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year
•Each high level language will have its own syntax and keywords. The meaning of
the word syntax is grammar.
GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year
Algorithm & Flowchart
ALGORITHM:
•An algorithm is a sequence of steps to solve a particular problem or algorithm is
an ordered set of unambiguous steps that produces a result and terminates in a
finite time
•Algorithm has the following characteristics
1. Input: An algorithm may or may not require input
2. Output: Each algorithm is expected to produce at least one result
3. Definiteness: Each instruction must be clear and unambiguous.
GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year
Algorithm & Flowchart
4. Finiteness: If the instructions of an algorithm are executed, the
algorithm should terminate after finite number of steps
Advantages of algorithm:
•It is a step-wise representation of a solution to a given problem, which makes it
easy to understand.
• An algorithm uses a definite procedure.
• It is not dependent on any programming language, so it is easy to understand
for anyone even without programming knowledge.
•Every step in an algorithm has its own logical sequence so it is easy to debug.
GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year
Algorithm & Flowchart
Flowchart:
•Flowchart is diagrammatic /Graphical representation of sequence of steps to
solve a problem.
•Flowchart uses different symbols to design a solution to a problem. It is another
commonly used programming tool.
•By looking at a Flowchart one can understand the operations and sequence of
operations performed in a system.
•Flowchart is often considered as a blueprint of a design used for solving a specific
problem.
GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year
Algorithm & Flowchart
Advantages of Flowchart :
•Flowchart is an excellent way of communicating the logic of a program.
•Easy and efficient to analyze problem using flowchart.
• During program development cycle, the flowchart plays the role of a blueprint,
which makes program development process easier.
• After successful development of a program, it needs continuous timely
maintenance during the course of its operation. The flowchart makes program
or system maintenance easier.
• It is easy to convert the flowchart into any programming language code.
GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year
Algorithm & Flowchart
To draw a flowchart following standard symbols are use
GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year
Algorithm & Flowchart
GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year
Algorithm & Flowchart
GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year
Algorithm & Flowchart
GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year
Algorithm & Flowchart
GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year
Algorithm & Flowchart

Contenu connexe

Similaire à 01 Programming for Problem Solving.pdf

Topic 5 Digital Technique basic computer structure
Topic 5 Digital Technique basic computer structureTopic 5 Digital Technique basic computer structure
Topic 5 Digital Technique basic computer structure
Bai Haqi
 
pre phd class 1.pptx
pre phd class 1.pptxpre phd class 1.pptx
pre phd class 1.pptx
RbiGradeB
 

Similaire à 01 Programming for Problem Solving.pdf (20)

Computer architecture pptx
Computer architecture pptxComputer architecture pptx
Computer architecture pptx
 
3 MODULE 2.2 -COMPUTER MEMORY.ppt
3 MODULE 2.2  -COMPUTER MEMORY.ppt3 MODULE 2.2  -COMPUTER MEMORY.ppt
3 MODULE 2.2 -COMPUTER MEMORY.ppt
 
CAP170 lec1.pptx
CAP170 lec1.pptxCAP170 lec1.pptx
CAP170 lec1.pptx
 
IT Revision.pptx
IT Revision.pptxIT Revision.pptx
IT Revision.pptx
 
Von Neumann Architecture
Von Neumann ArchitectureVon Neumann Architecture
Von Neumann Architecture
 
Basic Computer Architeccture
Basic Computer ArchitecctureBasic Computer Architeccture
Basic Computer Architeccture
 
introduction to operating system
introduction to operating systemintroduction to operating system
introduction to operating system
 
Unit 1.pptx
Unit 1.pptxUnit 1.pptx
Unit 1.pptx
 
MODULE 2.pptx
MODULE 2.pptxMODULE 2.pptx
MODULE 2.pptx
 
ch1.pptx
ch1.pptxch1.pptx
ch1.pptx
 
Unit 1.pptx
Unit 1.pptxUnit 1.pptx
Unit 1.pptx
 
CAB UNIT 1.pptx
CAB  UNIT 1.pptxCAB  UNIT 1.pptx
CAB UNIT 1.pptx
 
Topic 5 Digital Technique basic computer structure
Topic 5 Digital Technique basic computer structureTopic 5 Digital Technique basic computer structure
Topic 5 Digital Technique basic computer structure
 
pre phd class 1.pptx
pre phd class 1.pptxpre phd class 1.pptx
pre phd class 1.pptx
 
BAIT1003 Chapter 2
BAIT1003 Chapter 2BAIT1003 Chapter 2
BAIT1003 Chapter 2
 
Ia syllabus Topic computer Related
Ia syllabus Topic computer RelatedIa syllabus Topic computer Related
Ia syllabus Topic computer Related
 
Computer basic
Computer basicComputer basic
Computer basic
 
IT-Fundamentals-Presentation BSIT 1.pptx
IT-Fundamentals-Presentation BSIT 1.pptxIT-Fundamentals-Presentation BSIT 1.pptx
IT-Fundamentals-Presentation BSIT 1.pptx
 
Embedded systems introduction
Embedded systems introductionEmbedded systems introduction
Embedded systems introduction
 
Basic of computers
Basic of computersBasic of computers
Basic of computers
 

Dernier

scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
HenryBriggs2
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdf
Kamal Acharya
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
AldoGarca30
 
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Dernier (20)

Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
 
457503602-5-Gas-Well-Testing-and-Analysis-pptx.pptx
457503602-5-Gas-Well-Testing-and-Analysis-pptx.pptx457503602-5-Gas-Well-Testing-and-Analysis-pptx.pptx
457503602-5-Gas-Well-Testing-and-Analysis-pptx.pptx
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdf
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
 
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...
 
Introduction to Data Visualization,Matplotlib.pdf
Introduction to Data Visualization,Matplotlib.pdfIntroduction to Data Visualization,Matplotlib.pdf
Introduction to Data Visualization,Matplotlib.pdf
 
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
 
Learn the concepts of Thermodynamics on Magic Marks
Learn the concepts of Thermodynamics on Magic MarksLearn the concepts of Thermodynamics on Magic Marks
Learn the concepts of Thermodynamics on Magic Marks
 
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptxOrlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
 

01 Programming for Problem Solving.pdf

  • 1. GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year PROGRAMMING FOR PROBLEM SOLVING 1FY3- 06 Fundamentals of Computer By SANTOSH KUMAR ASST. PROF CSE/IT, GIT Jaipur Contents Syllabus Marks distribution Objective of course Book
  • 2. GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year Computer Data Processing
  • 3. GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year
  • 4. GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year Objective of the Course: The course is designed to understand the concept of programming language, to know about memory unit and understanding various binary codes and to enhance the programming skills of the students by giving practical assignments to be done in labs. Books Recommended for Reading and Reference: 1. Ritchie & Kernighan, The C Programming language, 2nd Ed., PHI. 2. Yashwant Kanetkar, Let us C, 7edition. BPB Publication, 2009. 3. Dey & Ghosh, Computer Fundamentals and programming in C, Oxford. 4. Balaguruswamy, Programming in ANSI C, 5th Ed., TMH. 5. Rajaraman, Fundamentals of Computers, 5th Ed. PHI, 2011. 6. P. K. Sinha & P. Sinha, Computer fundamentals Learning Outcomes: After the completion of the course, the students will •To bridge the gap between the knowhow of Fundamental of Computer Programming and its actual application and implementation in the field of computer science & engineering.
  • 5. GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year •To make students able to understand the concepts of Programming and its mechanism so that he/she is able to define the solution of different problems via algorithms Computer •The word computer comes from the word “compute” , which means, “to calculate” •Thereby, a computer is an electronic device that can perform arithmetic operations at high speed •A computer is also called a data processor because it can store, process, and retrieve data whenever desired Data Processing •The activity of processing data using a computer is called data processing
  • 6. GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year •Data is raw material used as input and information is processed data obtained as output of data processing. The Five Basic Operations of a Computer System •Inputting. The process of entering data and instructions into the computer system
  • 7. GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year •Storing. Saving data and instructions to make them readily available for initial or additional processing whenever required •Processing. Performing arithmetic operations (add, subtract, multiply, divide, etc.) or logical operations (comparisons like equal to, less than, greater than, etc.) on data to convert them into useful information •Outputting. The process of producing useful information or results for the user such as a printed report or visual display •Controlling. Directing the manner and sequence in which all of the above operations are performed The Five Basic Operations of a Computer System •Inputting. The process of entering data and instructions into the computer system
  • 8. GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year •Storing. Saving data and instructions to make them readily available for initial or additional processing whenever required •Processing. Performing arithmetic operations (add, subtract, multiply, divide, etc.) or logical operations (comparisons like equal to, less than, greater than, etc.) on data to convert them into useful information •Outputting. The process of producing useful information or results for the user such as a printed report or visual display •Controlling. Directing the manner and sequence in which all of the above operations are performed
  • 9. GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year Basic Organization of a Computer System
  • 10. GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year Input Unit An input unit of a computer system performs the following functions: 1. It accepts (or reads) instructions and data from outside world 2. It converts these instructions and data in computer acceptable form 3. It supplies the converted instructions and data to the computer system for further processing
  • 11. GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year Output Unit An output unit of a computer system performs the following functions: 1. It accepts the results produced by the computer, which are in coded form and hence, cannot be easily understood by us 2. It converts these coded results to human acceptable (readable) form 3. It supplies the converted results to outside world
  • 12. GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year Storage Unit The storage unit of a computer system holds (or stores) the following : 1. Data and instructions required for processing (received from input devices) 2. Intermediate results of processing 3. Final results of processing, before they are released to an output device Two Types of Storage Primary storage •Used to hold running program instructions •Used to hold data, intermediate results, and results of ongoing processing of job(s) •Fast in operation •Small Capacity
  • 13. GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year •Expensive •Volatile (looses data on power dissipation) Two Types of Storage Secondary storage •Used to hold stored program instructions •Used to hold data and information of stored jobs •Slower than primary storage •Large Capacity •Lot cheaper that primary storage •Retains data even without power Arithmetic Logic Unit (ALU) Arithmetic Logic Unit of a computer system is the place where the actual executions of instructions takes place during processing operation
  • 14. GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year Control Unit (CU) Control Unit of a computer system manages and coordinates the operations of all other components of the computer system Central Processing Unit (CPU) •It is the brain of a computer system •It is responsible for controlling the operations of all other units of a computer system
  • 15. GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year A computer is a system as it comprises of integrated components (input unit, output unit, storage unit, and CPU) that work together to perform the steps called for in the executing program Main Memory •Every computer has a temporary storage built into the computer hardware •It stores instructions and data of a program mainly when the program is being executed by the CPU. •This temporary storage is known as main memory, primary storage, or simply memory. •Physically, it consists of some chips either on the motherboard or on a small circuit board attached to the motherboard of a computer.
  • 16. GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year •It has random access property. •It is volatile. Random Access Memory (RAM) •Primary storage of a computer is often referred to as RAM because of its random access capability •RAM chips are volatile memory •A computer’s motherboard is designed in a manner that the memory capacity can be enhanced by adding more memory chips
  • 17. GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year •The additional RAM chips, which plug into special sockets on the motherboard, are known as single-in-line memory modules (SIMMs) Read Only Memory (ROM) •ROM a non-volatile memory chip •Data stored in a ROM can only be read and used – they cannot be changed •ROMs are mainly used to store programs and data, which do not change and are frequently used. For example, system boot program
  • 18. GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year Types of ROMs Type Usage Manufacturer-programmed ROM Data is burnt by the manufacturer of the electronic equipment in which it is used. User-programmed ROM or Programmable ROM (PROM) The user can load and store “read-only” programs and data in it Erasable PROM (EPROM) The user can erase information stored in it and the chip can be reprogrammed to store new information Ultra Violet EPROM (UVEPROM) A type of EPROM chip in which the stored information is erased by exposing the chip for some time to ultra-violet light
  • 19. GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year Electrically EPROM (EEPROM) or Flash memory A type of EPROM chip in which the stored information is erased by using high voltage electric pulses Cache Memory •It is commonly used for minimizing the memory processor speed mismatch. •It is an extremely fast, small memory between CPU and main memory whose access time is closer to the processing speed of the CPU. •It is used to temporarily store very active data and instructions during processing.
  • 20. GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year Cache is pronounced as “cash” Limitations of Primary Storage •Limited capacity because the cost per bit of storage is high •Volatile - data stored in it is lost when the electric power is turned off or interrupted
  • 21. GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year Secondary Storage •Used in a computer system to overcome the limitations of primary storage •Has virtually unlimited capacity because the cost per bit of storage is very low •Has an operating speed far slower than that of the primary storage •Used to store large volumes of data on a permanent basis •Also known as auxiliary memory
  • 22. GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year Classification of Commonly Used Secondary Storage Devices
  • 23. GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year
  • 24. GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year Floppy Disk • The most common secondary storage device • 3.5” disk – 1.44MB
  • 25. GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year Hard Disk Drive or Hard Disk • Made of rigid materials unlike floppy disks • Holds a greater amount of data
  • 26. GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year Optical Discs • A standard part of modern desktop machines, especially used for multimedia purposes and preferred in loading applications.
  • 27. GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year
  • 28. GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year Kinds • Blue Ray Disk – 40G • Digital Versatile Disk – DVD-R – write once, 3.95G – DVD RW – rewritable, 3G – Single Layer and Double Layer • Compact Disk – CD-R – write once, 650MB – CD-RW – rewritable, 700MB Optical Drives
  • 29. GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year • CD-ROM read CDs • CD-Writer read/write CDs • DVD-Combo read/write CDs, read DVD • DVD Writer read/write CDs read/write DVDs Other Secondary Storage • Solid-State Storage
  • 30. GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year – No moving parts – Flash memory cards – USB flash drives
  • 31. GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year Storage Evaluation Criteria Property Desirable Primary storage Secondary storage Storage capacity Large storage capacity Small Large Access Time Fast access time Fast Slow Cost per bit of storage Lower cost per bit High Low Volatility Non-volatile Volatile Non-volatile
  • 32. GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year Access Random access Random access Pseudorandom access or sequential access ACCESSMETHODS •When we design a file, the important issue is how we will retrieve information (a specific record) from the file. •Sometimes we need to process records one after another, whereas sometimes we need to access a specific record quickly without retrieving the preceding records.
  • 33. GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year •The access method determines how records can be retrieved: sequentially, randomly and direct. ACCESSMETHODS Sequential access If we need to access a file sequentially—that is, one record after another, from beginning to end —we use a sequential file structure. Random access If we need to access a specific record without having to retrieve all records before it, we use a file structure that allows random access. Direct access direct access is the ability to obtain data from a storage device by going directly to where it is
  • 34. GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year physically located on the device rather than by having to sequentially look for the data at one physical location after another. COMPUTER LANGUAGES •To communicate with the computers, we need some languages. These are computer languages. •There are mainly three different languages with the help of which we can develop computer programs. •And they are – 1. Machine Level language
  • 35. GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year 2. Assembly Level Language and 3. High Level Language Machine Level Language •Computer can understand only the language of Digital Electronics. Digital Electronics deals with presence and absence of voltages. Within the computer there are two logics can play their role. •These logics are – 1. Positive Logic – Here presence of voltage will be denoted by 1 and absence of voltage will be denoted by 0
  • 36. GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year 2. Negative Logic – Here presence of voltage will be denoted by 0 and absence of voltage will be denoted by 1 Assembly Level Language •After machine level language, the next level of development in the evolution of computer languages was the Assembly Language. •Machine level language uses only the binary language. But on the other hand, assembly language uses mnemonics or symbolic instructions in place of a sequence of 0s and 1s. •Example : - we can consider that, to add register A and B in a particular computer, assembly language uses the mnemonic ‘ADD B’ in place of 10001111. In assembly language, we use symbolic names to denote addresses and data.
  • 37. GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year •Thus writing a program in assembly language has advantages over writing the same in a machine language. High Level Language •High level language is the next development in the evolution of computer languages. •Examples of some high-level languages are given below – •C/C++ •JAVA •Pascal (named after the French scientist Blaise Pascal) •High-level languages are like English-like language, with less words also known as keywords and fewer ambiguities.
  • 38. GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year •Each high level language will have its own syntax and keywords. The meaning of the word syntax is grammar.
  • 39. GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year Algorithm & Flowchart ALGORITHM: •An algorithm is a sequence of steps to solve a particular problem or algorithm is an ordered set of unambiguous steps that produces a result and terminates in a finite time •Algorithm has the following characteristics 1. Input: An algorithm may or may not require input 2. Output: Each algorithm is expected to produce at least one result 3. Definiteness: Each instruction must be clear and unambiguous.
  • 40. GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year Algorithm & Flowchart 4. Finiteness: If the instructions of an algorithm are executed, the algorithm should terminate after finite number of steps Advantages of algorithm: •It is a step-wise representation of a solution to a given problem, which makes it easy to understand. • An algorithm uses a definite procedure. • It is not dependent on any programming language, so it is easy to understand for anyone even without programming knowledge. •Every step in an algorithm has its own logical sequence so it is easy to debug.
  • 41. GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year Algorithm & Flowchart Flowchart: •Flowchart is diagrammatic /Graphical representation of sequence of steps to solve a problem. •Flowchart uses different symbols to design a solution to a problem. It is another commonly used programming tool. •By looking at a Flowchart one can understand the operations and sequence of operations performed in a system. •Flowchart is often considered as a blueprint of a design used for solving a specific problem.
  • 42. GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year Algorithm & Flowchart Advantages of Flowchart : •Flowchart is an excellent way of communicating the logic of a program. •Easy and efficient to analyze problem using flowchart. • During program development cycle, the flowchart plays the role of a blueprint, which makes program development process easier. • After successful development of a program, it needs continuous timely maintenance during the course of its operation. The flowchart makes program or system maintenance easier. • It is easy to convert the flowchart into any programming language code.
  • 43. GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year Algorithm & Flowchart To draw a flowchart following standard symbols are use
  • 44. GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year Algorithm & Flowchart
  • 45. GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year Algorithm & Flowchart
  • 46. GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year Algorithm & Flowchart
  • 47. GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year Algorithm & Flowchart
  • 48. GLOBAL INSTITUTE OF TECHNOLGY JAIPUR PROGRAMMING FOR PROBLEM SOLVING Ist Year Algorithm & Flowchart