Understanding the nature of
Computer programs
Integrated Program in Data Management and Visual Insight
Mainak Dev
Concept of flow chart
Symbol Purpose Description Symbol Purpose Description
Indicates the ow of Used for decision
Flow line logic by connecting Decision making between two or
symbols. more alternatives.
Represents the start
Terminal(Stop/ On-page Used to join di erent
and the end of a
Start) owchart. Connector owline
Used to connect the
Used for input and O -page
Input/Output. owchart portion on a
output operation. Connector di erent page.
Used for arithmetic Represents a group of
Prede ned
Processing operations and data- statements performing
manipulations.
Process/Function one processing task.
fl
fl
fl
ff
ff
fi
ff
fl
Some examples:
• Add two numbers
entered by the user.
• Find the largest among
three di erent numbers
entered by the user.
ff
Pseudocode
What is it?
• step-by-step description of an algorithm.
• doesn’t use any programming language.
• Simple English
How to write pseudocode?
• Organize the sequence of tasks and write the pseudocode accordingly.
• At rst, establishes the main goal or the aim
fi
Pseudocode example
Ex 1:
Start
if rainyDay=“true”
print “it is a rainy day”
else rainyDay?
No Print sunny
day
print “it is a sunny day”
Yes
Print rainy
Example template: day
if "1"
print response Stop
"I am case 1”
if "2"
print response
"I am case 2"
Sum of two numbers with pseudocode
Declare Integer a, b, sum
Output "Sum of Two Numbers"
Input a
Input b
Assign sum = a+b
Output sum
Calculate Profit and Loss with pseudocode and flowchart
Read income, cost
if income greater than equal to cost
Calculate pro t = Income - cost
print pro t
else
Calculate loss = cost - income
print loss
fi
fi
Even or odd number using pseudocode and flowchart
Start
Read number A
If A is divisible by 2 read number
print even
else
Number No
Print Odd
divisible by 2
print odd
Yes
Print even
Stop
• Example owchart with
multiple cases
fl
Flow chart & Pseudocode for average of 2 numbers
1. Read num1 & num2
2. Calculate average equals (num1 plus num2)/2
3. Print average
Interpreted vs Compiled language
Sl
COMPILED LANGUAGE INTERPRETED LANGUAGE
No
executes instructions directly and freely, without
programming language which implements compilers
1 previously compiling a program into machine-language
and not interpreters.
instructions.
After compilation the code is expressed in the instructions are not directly executed by the target
2
instructions of the target machine. machine.
at least two steps to get from source code to
3 only one step to get from source code to execution.
execution.
Program can’t be modi ed while the program is interpreted programs can be modi ed while the program
4
running is running.
5 compilation errors prevent the code from compiling. debugging occurs at run-time.
6 executed directly by the computer’s CPU. not compiled, it is interpreted.
7 delivers better performance. relatively slower performance.
8 Ex – C, C++, COBOL, etc. Ex – JavaScript, Python.
fi
fi
Compiled
VS
Interpreted
Types of programming language
• Procedural: follows a sequence of statements or commands in order to achieve a
desired output. Ex: C, Pascal, BASIC
• Functional: focus on the output of mathematical functions and evaluations. Ex: Scala,
Erlang
• Object-oriented: group of objects composed of data and program elements, known
as attributes and methods. Ex: C++, Java, PHP
• Scripting: used to group of objects composed of data and program elements, known
as attributes and methods. Ex: NodeJS, Javascript
• Logic: expresses a series of facts and rules to instruct the computer on how to make
decisions. Ex: Prolog, Absys
Another way to classify programming languages
• Front-end: HTML, CSS, Javascript, React, Angular
• Back-end: C, C++, Python, Java
Structured programming language
• programming approach in which the program is made as a single structure. It means that the code will execute the instruction
by instruction one after the other. It doesn’t support the possibility of jumping from one instruction to some other with the help
of any statement.
• Example: C, C++, Java, C#
• Advantages:
• Easy to read
• User friendly
• Easy to maintain
• Easy to debug
• Machine independent
• Disadvantages:
• Takes time to convert to machine code
• Converted machine code is not the same as assembly language
• Development takes longer