SlideShare a Scribd company logo
CHAPTER 2
PROGRAMMING
LANGUAGES
PROG0101
FUNDAMENTALS OF
PROGRAMMING
Chapter 1
Overview of Computers and Logic
PROG0101
FUNDAMENTALS OF PROGRAMMING
PROG0101
FUNDAMENTALS OF PROGRAMMING
CHAPTER
PROGRAMMING LANGUAGES
2
Computer Program
 A program is a set of instructions following the rules
of the chosen language.
 Without programs, computers are useless.
 A program is like a recipe.
 It contains a list of ingredients (called variables) and
a list of directions (called statements) that tell the
computer what to do with the variables.
3
Programming Language
 A vocabulary and set of grammatical rules (syntax)
for instructing a computer to perform specific tasks.
 Programming languages can be used to create
computer programs.
 The term programming language usually refers to
high-level languages, such as BASIC, C, C++,
COBOL, FORTRAN, Ada, and Pascal.
4
Programming Language
 As human languages are too difficult for a
computer to understand in an unambiguous way,
commands are usually written in one or other
languages specially designed for the purpose.
5
Programming Language
 You eventually need to convert your program into
machine language so that the computer can
understand it.
 There are two ways to do this:
 Compile the program
 Interpret the program
6
Programming Language
 Compile is to transform a program written in a
high-level programming language from source code
into object code.
 This can be done by using a tool called compiler.
 A compiler reads the whole source code and
translates it into a complete machine code program
to perform the required tasks which is output as a
new file.
7
Programming Language
 Interpreter is a program that executes instructions
written in a high-level language.
 An interpreter reads the source code one instruction
or line at a time, converts this line into machine code
and executes it.
8
Programming Language
 Computer programming is the process of writing,
testing, debugging/troubleshooting, and maintaining
the source code of computer programs.
 This source code is written in a programming
language like C++, JAVA, Perl etc.
9
Programming Language
Common Features of All Program
All programs could be structured in the following four
ways:
 Sequences of instructions
 Branches
 Loops
 Modules
10
Programming Language
Common Features of All Program
Sequences of Instructions
The program flows from one
step to the next in strict sequence.
11
Programming Language
Common Features of All Program
Branches
The program reaches a decision
point and if the result of the test is
true then the program performs
the instructions in Path 1, and if
false it performs the actions in
Path 2
12
Programming Language
Common Features of All Program
Loops
The program steps are repeated
continuously until some test condition
is reached, at which point control then
flows past the loop into the next piece of
program logic
13
Programming Language
Common Features of All Program
Modules
The program performs an identical sequence of actions
several times. For convenience these common actions
are placed in a module, which is a kind of mini-program
which can be executed from within the main program.
14
Programming Language
Common Features of All Program
Modules
15
Programming Language
Common Features of All Program
Along with these structures programs also need a few
more features to make them useful:
 Data (we take a closer look at data in the Raw Materials
topic)
 Operations (add, subtract, compare etc)
 Input/Output capability (e.g. to display results)
16
Computer Programmer
 A programmer is someone who writes computer
program.
 Computer programmers write, test, and maintain
programs or software that tell the computer what to
do.
17
What Skills are Required to Become a Programmer?
 Programming - Writing computer programs for
various purposes.
 Writing - Communicating effectively with others in
writing as indicated by the needs of the audience.
 Reading Comprehension - Understanding
written sentences and paragraphs in work-related
documents.
 Critical Thinking - Using logic and analysis to
identify the strengths and weaknesses of different
approaches.
18
What Skills are Required to Become a Programmer?
 Computers and Electronics - Knowledge of
electric circuit boards, processors, chips, and
computer hardware and software, including
applications and programming.
 Mathematics - Knowledge of numbers, their
operations, and interrelationships including
arithmetic, algebra, geometry, calculus, statistics,
and their applications.
 Oral Expression - The ability to communicate
information and ideas in speaking so others will
understand.
19
What Skills are Required to Become a Programmer?
 Oral Comprehension - The ability to listen to and
understand information and ideas presented through
spoken words and sentences.
 Written Expression - The ability to communicate
information and ideas in writing so others will
understand.
 Written Comprehension - The ability to read and
understand information and ideas presented in
writing.
20
What Skills are Required to Become a Programmer?
 Deductive Reasoning - The ability to apply
general rules to specific problems to come up with
logical answers. It involves deciding if an answer
makes sense.
 Information Organization - Finding ways to
structure or classify multiple pieces of information.
21
Generations of Programming Language
 The first generation languages, or 1GL, are low-
level languages that are machine language.
 The second generation languages, or 2GL, are
also low-level languages that generally consist of
assembly languages.
 The third generation languages, or 3GL, are
high-level languages such as C.
22
Generations of Programming Language
 The fourth generation languages, or 4GL, are
languages that consist of statements similar to
statements in a human language. Fourth generation
languages are commonly used in database
programming and scripts.
 The fifth generation languages, or 5GL, are
programming languages that contain visual tools to
help develop a program. A good example of a fifth
generation language is Visual Basic.
23
Types of Programming Language
 There are three types of programming language:
 Machine language (Low-level language)
 Assembly language (Low-level language)
 High-level language
 Low-level languages are closer to the language used
by a computer, while high-level languages are closer
to human languages.
24
Types of Programming Language
Machine Language
 Machine language is a collection of binary digits or
bits that the computer reads and interprets.
 Machine languages are the only languages
understood by computers.
 While easily understood by computers, machine
languages are almost impossible for humans to use
because they consist entirely of numbers.
25
Types of Programming Language
Machine Language
Machine Language
169 1 160 0 153 0 128 153 0 129 153 130 153 0 131
200 208 241 96
High level language
5 FOR I=1 TO 1000: PRINT "A";: NEXT I
26
Types of Programming Language
Machine Language
Example:
 Let us say that an electric toothbrush has a processor
and main memory.
 The processor can rotate the bristles left and right,
and can check the on/off switch.
 The machine instructions are one byte long, and
correspond to the following machine operations:
27
Types of Programming Language
Machine Language
Machine Instruction Machine Operation
0000 0000 Stop
0000 0001 Rotate bristles left
0000 0010 Rotate bristles right
0000 0100 Go back to start of program
0000 1000 Skip next instruction if switch is off
28
Types of Programming Language
Assembly Language
 A program written in assembly language consists of a
series of instructions mnemonics that correspond to
a stream of executable instructions, when translated
by an assembler, that can be loaded into memory
and executed.
 Assembly languages use keywords and symbols,
much like English, to form a programming language
but at the same time introduce a new problem.
29
Types of Programming Language
Assembly Language
 The problem is that the computer doesn't
understand the assembly code, so we need a way to
convert it to machine code, which the computer does
understand.
 Assembly language programs are translated into
machine language by a program called an
assembler.
30
Types of Programming Language
Assembly Language
 Example:
 Machine language :
10110000 01100001
 Assembly language :
mov a1, #061h
 Meaning:
Move the hexadecimal value 61 (97 decimal) into
the processor register named "a1".
31
Types of Programming Language
High Level Language
 High-level languages allow us to write computer code
using instructions resembling everyday spoken language
(for example: print, if, while) which are then
translated into machine language to be executed.
 Programs written in a high-level language need to be
translated into machine language before they can be
executed.
 Some programming languages use a compiler to
perform this translation and others use an interpreter.
32
Types of Programming Language
High-Level Language
 Examples of High-level Language:
• ADA
• C
• C++
• JAVA
• BASIC
• COBOL
• PASCAL
• PHYTON
33
Choosing a Programming Language
Before you decide on what language to use, you should
consider the following:
 your server platform
 the server software you run
 your budget
 previous experience in programming
 the database you have chosen for your backend
34
The Programming Process
The Programming Process
Step 1: Defining the problem.
Step 2: Planning the solution.
Step 3: Code the program.
Step 4: Test the program.
Step 5: Document everything.
35
The Programming Process
Step 1: Defining the problem
 The task of defining the problem consists of identifying
what it is you know (input-given data), and what it is you
want to obtain (output-the result).
 Eventually, you produce a written agreement that, among
other things, specifies the kind of input, processing, and
output required.
36
The Programming Process
Step 1: Defining the problem
Example:
 What must the program do?
 What outputs are required and in what form?
 What inputs are available and in what form?
37
The Programming Process
Step 2: Planning the solution
 Two common ways of planning the solution to a problem
are to draw a flowchart and to write pseudocode, or
possibly both.
 A flowchart is a pictorial representation of a step-by-step
solution to a problem.
 It consists of arrows representing the direction the program
takes and boxes and other symbols representing actions.
 It is a map of what your program is going to do and how it
is going to do it.
38
The Programming Process
Step 2: Planning the solution
 Pseudocode is an English-like nonstandard language that
lets you state your solution with more precision than you
can in plain English but with less precision than is required
when using a formal programming language.
 Pseudocode permits you to focus on the program logic
without having to be concerned just yet about the precise
syntax of a particular programming language.
39
The Programming Process
Step 3: Code the program
 You will translate the logic from the flowchart or
pseudocode-or some other tool-to a programming
language.
 Program Coding means expressing the algorithm developed
for solving a problem, in a programming language.
40
The Programming Process
Step 4: Test the program
 Almost all programs may contain a few errors, or bugs.
 Testing is necessary to find out if the program produces a
correct result.
 Usually it is performed with sample data
 Debugging is the process of locating and removing errors
41
The Programming Process
Step 4: Test the program
Types of Error
Syntax Errors: Violation of syntactic rules in a
Programming Language generates syntax errors.
Effect? Interpreter or Compiler finds it in Syntax Check
Phase.
42
The Programming Process
Step 4: Test the program
Types of Error
Semantic Errors: Doing logical mistakes causes
semantic errors in Source code.
Effect? Interpreters and Compilers can not notice them,
but on execution, they causes unexpected results.
43
The Programming Process
Step 4: Test the program
Types of Error
Run-time Errors: Occur on program execution. Mostly
caused by invalid data entry or tries to use not existing
resources.
Effect? It occurs on run time and may crash the
program execution
44
The Programming Process
Step 5: Document everything
 Documentation is a written detailed description of the
programming cycle and specific facts about the program.
 Typical program documentation materials include the
origin and nature of the problem, a brief narrative
description of the program, logic tools such as flowcharts
and pseudocode, data-record descriptions, program
listings, and testing results.
 Comments in the program itself are also considered an
essential part of documentation.

More Related Content

What's hot

Introduction to Software Engineering & Information Technology
Introduction to Software Engineering & Information TechnologyIntroduction to Software Engineering & Information Technology
Introduction to Software Engineering & Information Technology
Gaditek
 
Programming Fundamentals lecture 2
Programming Fundamentals lecture 2Programming Fundamentals lecture 2
Programming Fundamentals lecture 2
REHAN IJAZ
 
Fundamentals of Programming Chapter 3
Fundamentals of Programming Chapter 3Fundamentals of Programming Chapter 3
Fundamentals of Programming Chapter 3
Mohd Harris Ahmad Jaal
 
Computer Programming
Computer Programming Computer Programming
Computer Programming
Newreborn Incarnation
 
Algorithms and flowcharts ppt (seminar presentation)..
 Algorithms and flowcharts  ppt (seminar presentation).. Algorithms and flowcharts  ppt (seminar presentation)..
Algorithms and flowcharts ppt (seminar presentation)..
Nagendra N
 
Programming Paradigm & Languages
Programming Paradigm & LanguagesProgramming Paradigm & Languages
Programming Paradigm & Languages
Gaditek
 
Basic programming concepts
Basic programming conceptsBasic programming concepts
Basic programming conceptssalmankhan570
 
Chapter #1 overview of programming and problem solving
Chapter #1 overview of programming and problem solvingChapter #1 overview of programming and problem solving
Chapter #1 overview of programming and problem solving
Abdul Shah
 
GRADE 6 ALGORITHM.pptx
GRADE 6 ALGORITHM.pptxGRADE 6 ALGORITHM.pptx
GRADE 6 ALGORITHM.pptx
AllanGuevarra1
 
Algorithm and flowchart
Algorithm and flowchartAlgorithm and flowchart
Algorithm and flowchart
Rabin BK
 
Intro to assembly language
Intro to assembly languageIntro to assembly language
Intro to assembly language
United International University
 
BASIC Programming Language
BASIC Programming LanguageBASIC Programming Language
BASIC Programming Language
Jeff Valerio
 
Complete C++ programming Language Course
Complete C++ programming Language CourseComplete C++ programming Language Course
Complete C++ programming Language Course
Vivek chan
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programming
Manoj Tyagi
 
Programming
ProgrammingProgramming
Programming
Leo Simon Anfone
 
Types of Programming Languages
Types of Programming LanguagesTypes of Programming Languages
Types of Programming Languages
Juhi Bhoyar
 
Introduction to computer programming
Introduction to computer programmingIntroduction to computer programming
Introduction to computer programmingNSU-Biliran Campus
 
SPL 2 | Algorithms, Pseudo-code, and Flowchart
SPL 2 | Algorithms, Pseudo-code, and FlowchartSPL 2 | Algorithms, Pseudo-code, and Flowchart
SPL 2 | Algorithms, Pseudo-code, and Flowchart
Mohammad Imam Hossain
 

What's hot (20)

Introduction to Software Engineering & Information Technology
Introduction to Software Engineering & Information TechnologyIntroduction to Software Engineering & Information Technology
Introduction to Software Engineering & Information Technology
 
Programming Fundamentals lecture 2
Programming Fundamentals lecture 2Programming Fundamentals lecture 2
Programming Fundamentals lecture 2
 
Fundamentals of Programming Chapter 3
Fundamentals of Programming Chapter 3Fundamentals of Programming Chapter 3
Fundamentals of Programming Chapter 3
 
Computer Programming
Computer Programming Computer Programming
Computer Programming
 
Algorithms and flowcharts ppt (seminar presentation)..
 Algorithms and flowcharts  ppt (seminar presentation).. Algorithms and flowcharts  ppt (seminar presentation)..
Algorithms and flowcharts ppt (seminar presentation)..
 
Algorithm and flowchart
Algorithm and flowchartAlgorithm and flowchart
Algorithm and flowchart
 
Computer
ComputerComputer
Computer
 
Programming Paradigm & Languages
Programming Paradigm & LanguagesProgramming Paradigm & Languages
Programming Paradigm & Languages
 
Basic programming concepts
Basic programming conceptsBasic programming concepts
Basic programming concepts
 
Chapter #1 overview of programming and problem solving
Chapter #1 overview of programming and problem solvingChapter #1 overview of programming and problem solving
Chapter #1 overview of programming and problem solving
 
GRADE 6 ALGORITHM.pptx
GRADE 6 ALGORITHM.pptxGRADE 6 ALGORITHM.pptx
GRADE 6 ALGORITHM.pptx
 
Algorithm and flowchart
Algorithm and flowchartAlgorithm and flowchart
Algorithm and flowchart
 
Intro to assembly language
Intro to assembly languageIntro to assembly language
Intro to assembly language
 
BASIC Programming Language
BASIC Programming LanguageBASIC Programming Language
BASIC Programming Language
 
Complete C++ programming Language Course
Complete C++ programming Language CourseComplete C++ programming Language Course
Complete C++ programming Language Course
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programming
 
Programming
ProgrammingProgramming
Programming
 
Types of Programming Languages
Types of Programming LanguagesTypes of Programming Languages
Types of Programming Languages
 
Introduction to computer programming
Introduction to computer programmingIntroduction to computer programming
Introduction to computer programming
 
SPL 2 | Algorithms, Pseudo-code, and Flowchart
SPL 2 | Algorithms, Pseudo-code, and FlowchartSPL 2 | Algorithms, Pseudo-code, and Flowchart
SPL 2 | Algorithms, Pseudo-code, and Flowchart
 

Similar to Fundamentals of Programming Chapter 2

PROG0101_CH02.pptx
PROG0101_CH02.pptxPROG0101_CH02.pptx
PROG0101_CH02.pptx
AnjaliPandey439257
 
Computer programming
Computer programmingComputer programming
Computer programmingSuneel Dogra
 
CH 01.pptx
CH 01.pptxCH 01.pptx
CH 01.pptx
Obsa2
 
Computer program, computer languages, computer software
Computer program, computer languages, computer softwareComputer program, computer languages, computer software
Computer program, computer languages, computer software
Sweta Kumari Barnwal
 
Computer Software and It's Development
Computer Software and It's DevelopmentComputer Software and It's Development
Computer Software and It's Development
Rabin BK
 
Program Logic and Design
Program Logic and DesignProgram Logic and Design
Program Logic and Design
Froilan Cantillo
 
Lecture_1_Introduction_to_Programming.pptx
Lecture_1_Introduction_to_Programming.pptxLecture_1_Introduction_to_Programming.pptx
Lecture_1_Introduction_to_Programming.pptx
Chewe Lulembo
 
Computer programming
Computer programmingComputer programming
Computer programming
Mohamed Asarudeen
 
Introduction to Computer
Introduction to ComputerIntroduction to Computer
Introduction to Computer
zaheeriqbal41
 
Programming_Fundamentals_Chapter_1_INTRO.pdf
Programming_Fundamentals_Chapter_1_INTRO.pdfProgramming_Fundamentals_Chapter_1_INTRO.pdf
Programming_Fundamentals_Chapter_1_INTRO.pdf
BernardVelasco1
 
Chapter 2.pptx
Chapter 2.pptxChapter 2.pptx
Chapter 2.pptx
TamiratDejene1
 
1.Overview of Programming.pptx
1.Overview of Programming.pptx1.Overview of Programming.pptx
1.Overview of Programming.pptx
Vishwas459764
 
Abstraction level taxonomy of programming language frameworks
Abstraction level taxonomy of programming language frameworksAbstraction level taxonomy of programming language frameworks
Abstraction level taxonomy of programming language frameworks
ijpla
 
SYSTEM DEVELOPMENT
SYSTEM DEVELOPMENTSYSTEM DEVELOPMENT
SYSTEM DEVELOPMENT
shahzadebaujiti
 
POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIA
Aiman Hud
 
Programming languages.pptx
Programming languages.pptxProgramming languages.pptx
Programming languages.pptx
Christ Association
 
Introduction to Computers Lecture # 12
Introduction to Computers Lecture # 12Introduction to Computers Lecture # 12
Introduction to Computers Lecture # 12
Sehrish Rafiq
 
Ppt 1
Ppt 1Ppt 1
Introduction_to_Programming.pptx
Introduction_to_Programming.pptxIntroduction_to_Programming.pptx
Introduction_to_Programming.pptx
PmarkNorcio
 
Algorithm and flowchart(1)
Algorithm and flowchart(1)Algorithm and flowchart(1)
Algorithm and flowchart(1)Suneel Dogra
 

Similar to Fundamentals of Programming Chapter 2 (20)

PROG0101_CH02.pptx
PROG0101_CH02.pptxPROG0101_CH02.pptx
PROG0101_CH02.pptx
 
Computer programming
Computer programmingComputer programming
Computer programming
 
CH 01.pptx
CH 01.pptxCH 01.pptx
CH 01.pptx
 
Computer program, computer languages, computer software
Computer program, computer languages, computer softwareComputer program, computer languages, computer software
Computer program, computer languages, computer software
 
Computer Software and It's Development
Computer Software and It's DevelopmentComputer Software and It's Development
Computer Software and It's Development
 
Program Logic and Design
Program Logic and DesignProgram Logic and Design
Program Logic and Design
 
Lecture_1_Introduction_to_Programming.pptx
Lecture_1_Introduction_to_Programming.pptxLecture_1_Introduction_to_Programming.pptx
Lecture_1_Introduction_to_Programming.pptx
 
Computer programming
Computer programmingComputer programming
Computer programming
 
Introduction to Computer
Introduction to ComputerIntroduction to Computer
Introduction to Computer
 
Programming_Fundamentals_Chapter_1_INTRO.pdf
Programming_Fundamentals_Chapter_1_INTRO.pdfProgramming_Fundamentals_Chapter_1_INTRO.pdf
Programming_Fundamentals_Chapter_1_INTRO.pdf
 
Chapter 2.pptx
Chapter 2.pptxChapter 2.pptx
Chapter 2.pptx
 
1.Overview of Programming.pptx
1.Overview of Programming.pptx1.Overview of Programming.pptx
1.Overview of Programming.pptx
 
Abstraction level taxonomy of programming language frameworks
Abstraction level taxonomy of programming language frameworksAbstraction level taxonomy of programming language frameworks
Abstraction level taxonomy of programming language frameworks
 
SYSTEM DEVELOPMENT
SYSTEM DEVELOPMENTSYSTEM DEVELOPMENT
SYSTEM DEVELOPMENT
 
POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIA
 
Programming languages.pptx
Programming languages.pptxProgramming languages.pptx
Programming languages.pptx
 
Introduction to Computers Lecture # 12
Introduction to Computers Lecture # 12Introduction to Computers Lecture # 12
Introduction to Computers Lecture # 12
 
Ppt 1
Ppt 1Ppt 1
Ppt 1
 
Introduction_to_Programming.pptx
Introduction_to_Programming.pptxIntroduction_to_Programming.pptx
Introduction_to_Programming.pptx
 
Algorithm and flowchart(1)
Algorithm and flowchart(1)Algorithm and flowchart(1)
Algorithm and flowchart(1)
 

More from Mohd Harris Ahmad Jaal

Fundamentals of Programming Chapter 7
Fundamentals of Programming Chapter 7Fundamentals of Programming Chapter 7
Fundamentals of Programming Chapter 7
Mohd Harris Ahmad Jaal
 
Fundamentals of Programming Chapter 6
Fundamentals of Programming Chapter 6Fundamentals of Programming Chapter 6
Fundamentals of Programming Chapter 6
Mohd Harris Ahmad Jaal
 
Fundamentals of Programming Chapter 4
Fundamentals of Programming Chapter 4Fundamentals of Programming Chapter 4
Fundamentals of Programming Chapter 4
Mohd Harris Ahmad Jaal
 
Fundamentals of Programming Chapter 1
Fundamentals of Programming Chapter 1Fundamentals of Programming Chapter 1
Fundamentals of Programming Chapter 1
Mohd Harris Ahmad Jaal
 
Fundamentals of Programming Chapter 5
Fundamentals of Programming Chapter 5Fundamentals of Programming Chapter 5
Fundamentals of Programming Chapter 5
Mohd Harris Ahmad Jaal
 
Web Application Development using PHP Chapter 8
Web Application Development using PHP Chapter 8Web Application Development using PHP Chapter 8
Web Application Development using PHP Chapter 8
Mohd Harris Ahmad Jaal
 
Web Application Development using PHP Chapter 7
Web Application Development using PHP Chapter 7Web Application Development using PHP Chapter 7
Web Application Development using PHP Chapter 7
Mohd Harris Ahmad Jaal
 
Web Application Development using PHP Chapter 6
Web Application Development using PHP Chapter 6Web Application Development using PHP Chapter 6
Web Application Development using PHP Chapter 6
Mohd Harris Ahmad Jaal
 
Web Application Development using PHP Chapter 5
Web Application Development using PHP Chapter 5Web Application Development using PHP Chapter 5
Web Application Development using PHP Chapter 5
Mohd Harris Ahmad Jaal
 
Web Application Development using PHP Chapter 4
Web Application Development using PHP Chapter 4Web Application Development using PHP Chapter 4
Web Application Development using PHP Chapter 4
Mohd Harris Ahmad Jaal
 
Web Application Development using PHP Chapter 3
Web Application Development using PHP Chapter 3Web Application Development using PHP Chapter 3
Web Application Development using PHP Chapter 3
Mohd Harris Ahmad Jaal
 
Web Application Development using PHP Chapter 2
Web Application Development using PHP Chapter 2Web Application Development using PHP Chapter 2
Web Application Development using PHP Chapter 2
Mohd Harris Ahmad Jaal
 
Web Application Development using PHP Chapter 1
Web Application Development using PHP Chapter 1Web Application Development using PHP Chapter 1
Web Application Development using PHP Chapter 1
Mohd Harris Ahmad Jaal
 
Fundamentals of Computing Chapter 10
Fundamentals of Computing Chapter 10Fundamentals of Computing Chapter 10
Fundamentals of Computing Chapter 10
Mohd Harris Ahmad Jaal
 
Fundamentals of Computing Chapter 9
Fundamentals of Computing Chapter 9Fundamentals of Computing Chapter 9
Fundamentals of Computing Chapter 9
Mohd Harris Ahmad Jaal
 
Fundamentals of Computing Chapter 8
Fundamentals of Computing Chapter 8Fundamentals of Computing Chapter 8
Fundamentals of Computing Chapter 8
Mohd Harris Ahmad Jaal
 
Fundamentals of Computing Chapter 7
Fundamentals of Computing Chapter 7Fundamentals of Computing Chapter 7
Fundamentals of Computing Chapter 7
Mohd Harris Ahmad Jaal
 
Fundamentals of Computing Chapter 6
Fundamentals of Computing Chapter 6Fundamentals of Computing Chapter 6
Fundamentals of Computing Chapter 6
Mohd Harris Ahmad Jaal
 
Fundamentals of Computing Chapter 5
Fundamentals of Computing Chapter 5Fundamentals of Computing Chapter 5
Fundamentals of Computing Chapter 5
Mohd Harris Ahmad Jaal
 
Fundamentals of Computing Chapter 4
Fundamentals of Computing Chapter 4Fundamentals of Computing Chapter 4
Fundamentals of Computing Chapter 4
Mohd Harris Ahmad Jaal
 

More from Mohd Harris Ahmad Jaal (20)

Fundamentals of Programming Chapter 7
Fundamentals of Programming Chapter 7Fundamentals of Programming Chapter 7
Fundamentals of Programming Chapter 7
 
Fundamentals of Programming Chapter 6
Fundamentals of Programming Chapter 6Fundamentals of Programming Chapter 6
Fundamentals of Programming Chapter 6
 
Fundamentals of Programming Chapter 4
Fundamentals of Programming Chapter 4Fundamentals of Programming Chapter 4
Fundamentals of Programming Chapter 4
 
Fundamentals of Programming Chapter 1
Fundamentals of Programming Chapter 1Fundamentals of Programming Chapter 1
Fundamentals of Programming Chapter 1
 
Fundamentals of Programming Chapter 5
Fundamentals of Programming Chapter 5Fundamentals of Programming Chapter 5
Fundamentals of Programming Chapter 5
 
Web Application Development using PHP Chapter 8
Web Application Development using PHP Chapter 8Web Application Development using PHP Chapter 8
Web Application Development using PHP Chapter 8
 
Web Application Development using PHP Chapter 7
Web Application Development using PHP Chapter 7Web Application Development using PHP Chapter 7
Web Application Development using PHP Chapter 7
 
Web Application Development using PHP Chapter 6
Web Application Development using PHP Chapter 6Web Application Development using PHP Chapter 6
Web Application Development using PHP Chapter 6
 
Web Application Development using PHP Chapter 5
Web Application Development using PHP Chapter 5Web Application Development using PHP Chapter 5
Web Application Development using PHP Chapter 5
 
Web Application Development using PHP Chapter 4
Web Application Development using PHP Chapter 4Web Application Development using PHP Chapter 4
Web Application Development using PHP Chapter 4
 
Web Application Development using PHP Chapter 3
Web Application Development using PHP Chapter 3Web Application Development using PHP Chapter 3
Web Application Development using PHP Chapter 3
 
Web Application Development using PHP Chapter 2
Web Application Development using PHP Chapter 2Web Application Development using PHP Chapter 2
Web Application Development using PHP Chapter 2
 
Web Application Development using PHP Chapter 1
Web Application Development using PHP Chapter 1Web Application Development using PHP Chapter 1
Web Application Development using PHP Chapter 1
 
Fundamentals of Computing Chapter 10
Fundamentals of Computing Chapter 10Fundamentals of Computing Chapter 10
Fundamentals of Computing Chapter 10
 
Fundamentals of Computing Chapter 9
Fundamentals of Computing Chapter 9Fundamentals of Computing Chapter 9
Fundamentals of Computing Chapter 9
 
Fundamentals of Computing Chapter 8
Fundamentals of Computing Chapter 8Fundamentals of Computing Chapter 8
Fundamentals of Computing Chapter 8
 
Fundamentals of Computing Chapter 7
Fundamentals of Computing Chapter 7Fundamentals of Computing Chapter 7
Fundamentals of Computing Chapter 7
 
Fundamentals of Computing Chapter 6
Fundamentals of Computing Chapter 6Fundamentals of Computing Chapter 6
Fundamentals of Computing Chapter 6
 
Fundamentals of Computing Chapter 5
Fundamentals of Computing Chapter 5Fundamentals of Computing Chapter 5
Fundamentals of Computing Chapter 5
 
Fundamentals of Computing Chapter 4
Fundamentals of Computing Chapter 4Fundamentals of Computing Chapter 4
Fundamentals of Computing Chapter 4
 

Recently uploaded

Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
GeoBlogs
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
Celine George
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
bennyroshan06
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
AzmatAli747758
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 

Recently uploaded (20)

Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 

Fundamentals of Programming Chapter 2

  • 1. CHAPTER 2 PROGRAMMING LANGUAGES PROG0101 FUNDAMENTALS OF PROGRAMMING Chapter 1 Overview of Computers and Logic PROG0101 FUNDAMENTALS OF PROGRAMMING PROG0101 FUNDAMENTALS OF PROGRAMMING CHAPTER PROGRAMMING LANGUAGES
  • 2. 2 Computer Program  A program is a set of instructions following the rules of the chosen language.  Without programs, computers are useless.  A program is like a recipe.  It contains a list of ingredients (called variables) and a list of directions (called statements) that tell the computer what to do with the variables.
  • 3. 3 Programming Language  A vocabulary and set of grammatical rules (syntax) for instructing a computer to perform specific tasks.  Programming languages can be used to create computer programs.  The term programming language usually refers to high-level languages, such as BASIC, C, C++, COBOL, FORTRAN, Ada, and Pascal.
  • 4. 4 Programming Language  As human languages are too difficult for a computer to understand in an unambiguous way, commands are usually written in one or other languages specially designed for the purpose.
  • 5. 5 Programming Language  You eventually need to convert your program into machine language so that the computer can understand it.  There are two ways to do this:  Compile the program  Interpret the program
  • 6. 6 Programming Language  Compile is to transform a program written in a high-level programming language from source code into object code.  This can be done by using a tool called compiler.  A compiler reads the whole source code and translates it into a complete machine code program to perform the required tasks which is output as a new file.
  • 7. 7 Programming Language  Interpreter is a program that executes instructions written in a high-level language.  An interpreter reads the source code one instruction or line at a time, converts this line into machine code and executes it.
  • 8. 8 Programming Language  Computer programming is the process of writing, testing, debugging/troubleshooting, and maintaining the source code of computer programs.  This source code is written in a programming language like C++, JAVA, Perl etc.
  • 9. 9 Programming Language Common Features of All Program All programs could be structured in the following four ways:  Sequences of instructions  Branches  Loops  Modules
  • 10. 10 Programming Language Common Features of All Program Sequences of Instructions The program flows from one step to the next in strict sequence.
  • 11. 11 Programming Language Common Features of All Program Branches The program reaches a decision point and if the result of the test is true then the program performs the instructions in Path 1, and if false it performs the actions in Path 2
  • 12. 12 Programming Language Common Features of All Program Loops The program steps are repeated continuously until some test condition is reached, at which point control then flows past the loop into the next piece of program logic
  • 13. 13 Programming Language Common Features of All Program Modules The program performs an identical sequence of actions several times. For convenience these common actions are placed in a module, which is a kind of mini-program which can be executed from within the main program.
  • 14. 14 Programming Language Common Features of All Program Modules
  • 15. 15 Programming Language Common Features of All Program Along with these structures programs also need a few more features to make them useful:  Data (we take a closer look at data in the Raw Materials topic)  Operations (add, subtract, compare etc)  Input/Output capability (e.g. to display results)
  • 16. 16 Computer Programmer  A programmer is someone who writes computer program.  Computer programmers write, test, and maintain programs or software that tell the computer what to do.
  • 17. 17 What Skills are Required to Become a Programmer?  Programming - Writing computer programs for various purposes.  Writing - Communicating effectively with others in writing as indicated by the needs of the audience.  Reading Comprehension - Understanding written sentences and paragraphs in work-related documents.  Critical Thinking - Using logic and analysis to identify the strengths and weaknesses of different approaches.
  • 18. 18 What Skills are Required to Become a Programmer?  Computers and Electronics - Knowledge of electric circuit boards, processors, chips, and computer hardware and software, including applications and programming.  Mathematics - Knowledge of numbers, their operations, and interrelationships including arithmetic, algebra, geometry, calculus, statistics, and their applications.  Oral Expression - The ability to communicate information and ideas in speaking so others will understand.
  • 19. 19 What Skills are Required to Become a Programmer?  Oral Comprehension - The ability to listen to and understand information and ideas presented through spoken words and sentences.  Written Expression - The ability to communicate information and ideas in writing so others will understand.  Written Comprehension - The ability to read and understand information and ideas presented in writing.
  • 20. 20 What Skills are Required to Become a Programmer?  Deductive Reasoning - The ability to apply general rules to specific problems to come up with logical answers. It involves deciding if an answer makes sense.  Information Organization - Finding ways to structure or classify multiple pieces of information.
  • 21. 21 Generations of Programming Language  The first generation languages, or 1GL, are low- level languages that are machine language.  The second generation languages, or 2GL, are also low-level languages that generally consist of assembly languages.  The third generation languages, or 3GL, are high-level languages such as C.
  • 22. 22 Generations of Programming Language  The fourth generation languages, or 4GL, are languages that consist of statements similar to statements in a human language. Fourth generation languages are commonly used in database programming and scripts.  The fifth generation languages, or 5GL, are programming languages that contain visual tools to help develop a program. A good example of a fifth generation language is Visual Basic.
  • 23. 23 Types of Programming Language  There are three types of programming language:  Machine language (Low-level language)  Assembly language (Low-level language)  High-level language  Low-level languages are closer to the language used by a computer, while high-level languages are closer to human languages.
  • 24. 24 Types of Programming Language Machine Language  Machine language is a collection of binary digits or bits that the computer reads and interprets.  Machine languages are the only languages understood by computers.  While easily understood by computers, machine languages are almost impossible for humans to use because they consist entirely of numbers.
  • 25. 25 Types of Programming Language Machine Language Machine Language 169 1 160 0 153 0 128 153 0 129 153 130 153 0 131 200 208 241 96 High level language 5 FOR I=1 TO 1000: PRINT "A";: NEXT I
  • 26. 26 Types of Programming Language Machine Language Example:  Let us say that an electric toothbrush has a processor and main memory.  The processor can rotate the bristles left and right, and can check the on/off switch.  The machine instructions are one byte long, and correspond to the following machine operations:
  • 27. 27 Types of Programming Language Machine Language Machine Instruction Machine Operation 0000 0000 Stop 0000 0001 Rotate bristles left 0000 0010 Rotate bristles right 0000 0100 Go back to start of program 0000 1000 Skip next instruction if switch is off
  • 28. 28 Types of Programming Language Assembly Language  A program written in assembly language consists of a series of instructions mnemonics that correspond to a stream of executable instructions, when translated by an assembler, that can be loaded into memory and executed.  Assembly languages use keywords and symbols, much like English, to form a programming language but at the same time introduce a new problem.
  • 29. 29 Types of Programming Language Assembly Language  The problem is that the computer doesn't understand the assembly code, so we need a way to convert it to machine code, which the computer does understand.  Assembly language programs are translated into machine language by a program called an assembler.
  • 30. 30 Types of Programming Language Assembly Language  Example:  Machine language : 10110000 01100001  Assembly language : mov a1, #061h  Meaning: Move the hexadecimal value 61 (97 decimal) into the processor register named "a1".
  • 31. 31 Types of Programming Language High Level Language  High-level languages allow us to write computer code using instructions resembling everyday spoken language (for example: print, if, while) which are then translated into machine language to be executed.  Programs written in a high-level language need to be translated into machine language before they can be executed.  Some programming languages use a compiler to perform this translation and others use an interpreter.
  • 32. 32 Types of Programming Language High-Level Language  Examples of High-level Language: • ADA • C • C++ • JAVA • BASIC • COBOL • PASCAL • PHYTON
  • 33. 33 Choosing a Programming Language Before you decide on what language to use, you should consider the following:  your server platform  the server software you run  your budget  previous experience in programming  the database you have chosen for your backend
  • 34. 34 The Programming Process The Programming Process Step 1: Defining the problem. Step 2: Planning the solution. Step 3: Code the program. Step 4: Test the program. Step 5: Document everything.
  • 35. 35 The Programming Process Step 1: Defining the problem  The task of defining the problem consists of identifying what it is you know (input-given data), and what it is you want to obtain (output-the result).  Eventually, you produce a written agreement that, among other things, specifies the kind of input, processing, and output required.
  • 36. 36 The Programming Process Step 1: Defining the problem Example:  What must the program do?  What outputs are required and in what form?  What inputs are available and in what form?
  • 37. 37 The Programming Process Step 2: Planning the solution  Two common ways of planning the solution to a problem are to draw a flowchart and to write pseudocode, or possibly both.  A flowchart is a pictorial representation of a step-by-step solution to a problem.  It consists of arrows representing the direction the program takes and boxes and other symbols representing actions.  It is a map of what your program is going to do and how it is going to do it.
  • 38. 38 The Programming Process Step 2: Planning the solution  Pseudocode is an English-like nonstandard language that lets you state your solution with more precision than you can in plain English but with less precision than is required when using a formal programming language.  Pseudocode permits you to focus on the program logic without having to be concerned just yet about the precise syntax of a particular programming language.
  • 39. 39 The Programming Process Step 3: Code the program  You will translate the logic from the flowchart or pseudocode-or some other tool-to a programming language.  Program Coding means expressing the algorithm developed for solving a problem, in a programming language.
  • 40. 40 The Programming Process Step 4: Test the program  Almost all programs may contain a few errors, or bugs.  Testing is necessary to find out if the program produces a correct result.  Usually it is performed with sample data  Debugging is the process of locating and removing errors
  • 41. 41 The Programming Process Step 4: Test the program Types of Error Syntax Errors: Violation of syntactic rules in a Programming Language generates syntax errors. Effect? Interpreter or Compiler finds it in Syntax Check Phase.
  • 42. 42 The Programming Process Step 4: Test the program Types of Error Semantic Errors: Doing logical mistakes causes semantic errors in Source code. Effect? Interpreters and Compilers can not notice them, but on execution, they causes unexpected results.
  • 43. 43 The Programming Process Step 4: Test the program Types of Error Run-time Errors: Occur on program execution. Mostly caused by invalid data entry or tries to use not existing resources. Effect? It occurs on run time and may crash the program execution
  • 44. 44 The Programming Process Step 5: Document everything  Documentation is a written detailed description of the programming cycle and specific facts about the program.  Typical program documentation materials include the origin and nature of the problem, a brief narrative description of the program, logic tools such as flowcharts and pseudocode, data-record descriptions, program listings, and testing results.  Comments in the program itself are also considered an essential part of documentation.