We are on a mission to address the digital
skills gap for 10 Million+ young professionals,
train and empower them to forge a career
path into future tech
Programming Fundamentals
08 NOV, 2022
Contents
• Computational Thinking
• Introduction to SDLC Phases
• Algorithm
• Flow Chart
• Pseudo-code
3 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Computational Thinking
Please download pictures in
suitable size here and insert them
by clicking the symbol above.
4 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Computational Thinking
Introduction
• Computational thinking is the process of approaching a problem in a systematic manner. It allows us to
take a problem, understand what the problem is and develop possible solutions.
• It requires,
• understanding the capabilities of computers,
• formulating problems to be addressed by a computer, and
• designing algorithms that a computer can execute.
5 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Computational Thinking
Key Techniques
Break down a complex Identify general
problem or system into principles and filter out
smaller tasks unnecessary information
Four key techniques
(cornerstones) to
computational thinking
Identify for similarities, Identify and organize the
differences and patterns steps needed to solve the
within the problems problem
6 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Computational Thinking
Key Techniques
• Each cornerstone is as important as the others.
• They are like legs on a table - if one leg is missing, the table will probably collapse.
• Correctly applying all four techniques will help when programming a computer.
7 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Computational Thinking
Key Techniques: Decomposition
• Breaking the problem down into smaller parts means that each smaller problem can be examined in
more detail.
Look at the picture carefully.
“A crime has been committed; a diamond
has been stolen.”
How could this complex problem of the
committed crime be solved by breaking
down into simpler problems that can be
examined individually, in detail?
8 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Computational Thinking
Key Techniques: Decomposition
• Solving a crime can be a very complex problem as there are many things to be consider.
For example, a police officer would need to
know the answer to a series of smaller
problems:
• What crime was committed?
• When was the crime committed?
• Where was the crime committed?
• What evidence was there?
• Is there any witness?
• Is there any recent similar crimes The complex problem of the committed crime has now
been broken down into simpler problems that can be
been reported? examined individually, in detail.
9 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Computational Thinking
Key Techniques: Decomposition
• Once we have decomposed a complex problem, it helps to examine the small problems for similarities
or patterns. These patterns can help us to solve complex problems more efficiently.
Imagine that we want to draw a series of cats.
• All cats share common characteristics.
• Among other things they all have eyes, tails and fur.
• They also like to eat fish and make meowing sounds.
By knowing all this we can make a good attempt at drawing a
cat, simply by including these common characteristics.
10 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Computational Thinking
Key Techniques: Pattern Recognition
• Once we know how to describe one cat we can describe others, simply by following this pattern.
• The only things that are different are the specifics Note:
In computational thinking, these
• One cat may have green eyes, a long tail and black fur
characteristics are known as
• Another cat may have yellow eyes, a short tail and striped fur patterns.
11 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Computational Thinking
Key Techniques: Abstraction
• Once the patterns are recognized in the problems, abstraction can be used to gather the general
characteristics and to filter out of the details that are not needed in order to solve the problem.
• In pattern recognition we looked at the problem of
having to draw a series of cats.
• General characteristics that are common to all cats,
Examples: eyes, a tail, fur, a liking for fish and the
ability to make meowing sounds.
• In addition, each cat has specific characteristics,
such as black fur, a long tail, green eyes, a love
of salmon, and a loud meow.
• These details are known as specifics.
12 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Computational Thinking
Key Techniques: Abstraction
• In order to draw a basic cat,
• we do need to know that it has a tail, fur and eyes.
- These characteristics are relevant.
• We don't need to know what sound a cat makes
or that it likes fish.
- These characteristics are irrelevant and can be
filtered out. From the general characteristics,
• We do need to know that a cat has a tail, fur and which includes(tail, fur, eyes) we can build a
eyes, but we don't need to know what size and basic idea of a cat, i.e.
color these are. • what a cat basically looks like.
- These specifics can be filtered out. • Once we know what a cat looks like
- we can describe how to draw a basic cat.
13 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Computational Thinking
Why Abstraction is important?
• Abstraction allows us to create a general idea of what the problem is and how to solve it. The process
instructs us to remove all specific detail, and any patterns that will not help us solve our problem.
• This helps us to form our idea of the problem. This idea is known as a ‘model’.
• With the cat example, if we didn’t abstract, we might think that all cats have long tails and short fur.
• Having abstracted, we know that although cats have tails and fur, not all tails are long and not all fur is
short.
• Abstraction has helped to form a clearer model of a cat.
14 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Computational Thinking
Key Techniques: Algorithm
• An algorithm is a plan, a set of step-by-step instructions to solve a problem.
• It is important to plan out the solution to a problem to make sure that it will be correct.
• Using computational thinking, break down the problem into smaller parts then plan out how they fit back
together in a suitable order to solve the problem.
• This order can be represented as an algorithm.
15 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Computational Thinking
Quiz
1) Which of the following statement is correct?
a) CT is not based on algorithmic thinking
b) CT helps in developing possible solutions
c) CT helps in developing sequence of instructions
d) CT is not based on ordered steps
Answer : Option b)
16 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Computational Thinking
Quiz
2) Which of the following is true about abstraction?
a) To examine the small problems for similarities
or patterns
b) To describe the characteristics of the problem
c) To filter out of the details that are not needed in
order to solve the problem
d) To develop sequence of instructions
17 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Answer : Option c)
Computational Thinking
Quiz
3) Which of the following is an example of thinking
computationally?
a) Planning out your route when going to meet a friend
b) When going to meet a friend, wandering around until you
find them
c) When going to meet a friend, asking a parent to plan your
route for you
Answer : Option a)
18 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Computational Thinking
Quiz
4) Which of the following is NOT a computational thinking
technique?
a) Decomposition
b) Pattern recognition
c) Coding
d) Abstraction
Answer : Option c)
19 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Software Development
Life Cycle(SDLC) Phases
Please download pictures in
suitable size here and insert them
by clicking the symbol above.
20 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
SDLC Phases
Activity
A customer requirement
• “I want to build a house.”
Please list down the steps you
will do to build the house.
21 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
SDLC Phases
Customer requirement Analysis
• Ask questions and understand the product completely in both customer and developer stand points.
• The following important decisions need to be finalized:
- Exact need of customers
- Quality of materials to be use
- Product approximate delivery time
- budget of product, etc.,
22 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
SDLC Phases
Design or Plan of the house
• The blueprint of the house will be designed by the
engineer.
• Make sure you have the right architecture and design
in place, and you adhere it.
23 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
SDLC Phases
Building the house
• Requirement is clear
• Architecture and Design are in place
• Build the house as required
Let’s build it…
24 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
SDLC Phases
Building the house
Roll Players
There are several roll players involved to build the house:
• Civil Engineer
• Mason
• Electrician
• Carpenter
• Etc.,
25 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
SDLC Phases
Building the house
You should never release
a product after just
creating it.
26 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
SDLC Phases
Testing
• All roll players check the correctness of their product
27 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
SDLC Phases
Testing
Ensure that components
work well individually and
together
28 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
SDLC Phases
Delivery
• As the house is built (i.e., build step is complete) and the people
who built different parts of the house say it is ready, it can be
handed over to the customer.
Correct?
29 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
SDLC Phases
Delivery
Result?
– Customer may be happy or Unhappy
Unhappy customer complains about the quality of the
house
• Unable to open a window
• Water leak in walls
• Loose or broken floor tiles
• Etc.,
30 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
SDLC Phases
Delivery
• All roll players together, we make a great and high-
quality product !
31 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
11/9/2022
©SmartCliff 2021 Confidential
SDLC Phases
Software Development Life Cycle (SDLC)
• System / Program / Software Development Life Cycle (SDLC) is a systematic way of developing quality
software.
• It provides an organized plan for breaking down the task of program development into manageable
chunks, each of which must be successfully completed before moving on to the next phase.
• It provides a well-structured flow of phases that help an organization to quickly produce high-quality
software which is well-tested and ready for production use.
32 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
SDLC Phases
Software Development Life Cycle (SDLC)
Defining
the
Problem
Planning
and
Deployment System
and Analysis
Maintenance
SDLC System
Design
Documen
tation
Coding
Testing
33 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
SDLC Phases
SDLC- Defining the Problem
• The first step in the process of program development is the thorough understanding and identification of
the problem for which is the program or software is to be developed.
• In this step the problem has to be defined formally.
• All the factors like Input/output, processing requirement, memory requirements, error handling,
interfacing with other programs have to be taken into consideration in this stage.
34 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
SDLC Phases
SDLC- Planning and System Analysis
• This phase includes requirement analysis, planning and feasibility study.
• Requirement Analysis is the most important and necessary stage in SDLC.
• Planning for the quality assurance requirements and identifications of the risks
associated with the projects is also done at this stage.
• Feasibility study is the one of the key task of this phase.
• It is a graphical description of site showing the size, configuration, natural
features and available utilities to service a particular proposed development.
35 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
SDLC Phases
SDLC- Defining the Problem
• The next stage is the system design.
• System design starts by focusing on the main goal that the program is
trying to achieve and then breaking the program into manageable
components, each of which contributes to this goal.
• This phase is very important for System development. That means we
write the solution in step-by-step statements.
36 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
SDLC Phases
SDLC- System Design
• The three fundamental system design techniques:
Algorithm:
It is a finite set of instructions that accomplishes a particular task.
Flow Chart :
It is a pictorial representation of an algorithm.
Pseudo Code:
It is a plain language description of an algorithm.
37 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
SDLC Phases
SDLC- Coding
• Once the design process is complete
- the actual computer program is written,
- i.e. the instructions are written in a computer language.
• Coding is generally a very small part of the entire program development process and a less time-
consuming activity.
• In this process all the syntax errors like errors related to spelling, missing commas, undefined labels etc.
are eliminated.
38 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
SDLC Phases
SDLC- Coding
• For effective coding some of the guidelines which are applied:
• Use of meaningful names and labels of variables,
• Simple and clear expressions,
• Modularity with emphasis on making modules generalized,
• Making use of comments and indenting the code properly,
• Avoiding jumps in the program to transfer control.
39 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
SDLC Phases
SDLC- Testing
• Testing tells the developer about the program.
• The validation of the program, testing ensures that the program performs the required tasks correctly.
• It is a process of running the program to find the incorrectness and logical errors containing within the
program.
• We also test that whether it is providing the desired output or not.
40 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
SDLC Phases
SDLC- Documentation
• Documentation is a very essential step in the program development.
• Documentation help the users and the people who maintain the software.
• This ensures that future modification if required can be done easily.
• Also, it is required during redesigning and maintenance.
41 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
SDLC Phases
SDLC- Deployment and Maintenance
• In the final phase, the program is deployed (installed) at the user’s site.
• Here also, the program is kept under watch till the user gives a green signal
to it.
• Even after the software is completed, it needs to be maintained and evaluated
regularly.
• In software maintenance, the programming team fixes program errors and
updates the software.
42 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
SDLC Phases
Quiz
1) Which of the following statement is the first step of software
development?
a) Planning and Analysis
b) Developer collects need from user
c) Identify the cost of process
d) Developer identify risk of process
Answer : Option b)
43 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
SDLC Phases
Quiz
2) Which of the following techniques focus on designing
SDLC?
a) Algorithm
b) Flow Chart
c) Pseudo-code
d) All the above
Answer : Option d)
44 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
SDLC Phases
Quiz
3) Which of the following is used to develop system in SDLC?
a) Designing
b) Documenting
c) Coding
d) All the above
Answer : Option c)
45 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
SDLC Phases
Quiz
4) Which of the following is used to give the software at the
user site?
a) Maintenance
b) Deployment
c) Documentation
d) All the above
Answer : Option b)
46 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Algorithm
Please download pictures in
suitable size here and insert them
by clicking the symbol above.
47 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Algorithm
Algorithm
• A program must be systematically and properly designed before coding begins.
• This design process results in the construction of an ALGORITHM.
48 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Algorithm
Algorithm
• There is no general definition of algorithm accepted.
• But we can say that algorithm is:
• A step‐by‐step problem‐solving procedure.
• A sequence of instruction that tell how to solve a particular problem.
• A set of instruction for solving a problem, especially on a computer.
• A computable set of steps to achieve a desired result.
• However, most agree that algorithm has something to do with defining generalized processes
to get “output” from the “input”.
49 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Algorithm
Algorithm
• Therefore, we can conclude that:
• Algorithm a step‐by‐step problem-solving process in which a solution is arrived in a finite amount of
time.
OR
• An algorithm is a finite list of sequential steps specifying actions that if performed result in solution of a
specific problem.
50 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Algorithm
From Algorithm to Program
Both algorithm and program are sets of instructions on how to do a task
• Algorithm:
- talking to humans, easy to understand in plain (English) language
• Program:
- talking to computer (compiler) can be regarded as a “formal expression” of an algorithm
Algorithm Program
a sequence of instructions a set of instructions which
describing how to do a task are commands to computers
(or process) to perform specific
operations on data
51 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Algorithm
Algorithm - Example
• Find Shortest Distance Between Points On Google Maps
Algorithm
Step 1: Open Google Maps on your computer.
Step 2: Zoom into your starting point and right
click on it.
Step 3: Select Measure distance from the right-
click options.
Step 4: Click on the second location you want to
measure the distance too.
Step 5: If you want to measure multiple points,
click again on those locations. Drag a point or
path to adjust it or click on a point to remove it.
52 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Algorithm
Algorithm Building blocks
• An algorithm is made up of three basic building blocks:
1. Sequencing ( Action): An Action is one or more instructions that the computer performs in sequential
order (from first to last).
Example: Compute 17 plus 31.
2. Selection (Decision): A Decision is making a choice among several actions.
Example: If DAY is SUNDAY, print "HOLIDAY", otherwise print "WORKING DAY“
3. Iteration (Repetition or Loop): A Loop is one or more instructions that the computer performs repeatedly.
Example: Print "HELLO WORLD!" 77 times.
53 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Algorithm
Algorithm Building blocks
Logic of the Problem
Algorithm = Logic + Control
Sequence Selection Looping
54 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Algorithm
Algorithm Building blocks: Sequencing ( Action)
• This describes a sequence of actions that a program carries out one after another, unconditionally.
• Execute a list of statements in order.
Example: Morning Workout
Step 1: Wakeup Step 2: Go to Gym Step 3: Do Workout Step 4: Return Home
55 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Algorithm
Algorithm Building blocks: Sequencing ( Action)
Example 1: Greet a user with the Welcome Message “Welcome<<username>>”
Algorithm
Step 1 : Start
Assume,
username=XYZ
Step 2 : Input username
Welcome XYZ
Step 3 : Print Welcome username
Step 4 : Stop
56 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Algorithm
Algorithm Building blocks: Sequencing ( Action)
Example 2: Find the area of the rectangle
Algorithm
Area of Rectangle = l x w
Step 1 : Start
Here
Step 2 : Input the length of the rectangle l length
w width
Step 3 : Input the width of the rectangle
Step 4 : Find the area of the rectangle as
Area=length*width
Step 5 : Print the area of the rectangle
Step 6 : Stop
57 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Algorithm
Algorithm Building blocks: Sequencing ( Action)
Example 3: Get kilometer from the user and convert it to meter
Algorithm
Step 1 : Start
Meter = km * 1000
Step 2 : Input kilo meter
Here
Step 3 : Convert kilo meter to meter as Km Kilo meter
Meter=kilo meter*1000
Step 4 : Print meter
Step 5 : Stop
58 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Algorithm
Algorithm Building blocks: Selection (Decision)
• Algorithms can use selection to determine a different set of steps to execute based on a Boolean
expression.
• If the conditional test is true, one part of the algorithm will be executed, otherwise it will execute the
other part of the algorithm
Example: To decide Sunday play option Step 4 : Play
Yes Cricket
No
Step 4 : Play Video
Step 1 :Morning Step 2 :Call Friends Step 3 : if Friends Game
Wakeup available?
59 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Algorithm
Algorithm Building blocks: Selection (Decision)
Example 1: Find the smallest of given two numbers
Algorithm
Step 1 : Start
Step 2 : Read values of two numbers, A and B
Step 3 : Check whether A is less than B, if the condition is true then goto step 3.1 else goto step 3.2
Step 3.1:print A is the smallest number
I/O
Step 3.2: print B is the smallest number A=20 B=40
Step 4 : Stop
Print A is smallest number
60 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Algorithm
Algorithm Building blocks: Selection (Decision)
Example 2: Check whether the given number is three-digit number or not.
Assume,
Algorithm A=150
Step 1 : Start If A>99 and A<1000 (True)
The number is a three digit
Step 2 : Read the number, A number
Step 3 : Check whether the given number is greater than 99 and less than 1000, if yes then goto step 3.1
otherwise goto step 3.2
Step 3.1: Print the message “The number is a three digit number”, goto step 4
Step 3.2: Print the message “The number is not a three digit number”
Step 4 : Stop
61 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Algorithm
Algorithm Building blocks: Selection (Decision)
Example 3: Check whether the given year is Leap Year or not. year=2100
Algorithm It is not a leap year
Step 1 : Start
Step 2 : Read the value of the year
Step 3: Check whether the given year is divisible by 4 and not divisible by 100, if yes goto 3.1 otherwise
goto 3.2
Step 3.1: print the message “It is Leap year”, goto step 4
Step 3.2: Check whether the given year is divisible by 400, if yes goto 3.2.1
otherwise goto 3.2.2
Step 3.2.1: print the message “It is Leap year”
Step 3.2.2: print the message “It is not Leap year”
Step 4 : Stop
62 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Algorithm
Algorithm Building blocks: Iteration (Repetition or Loop)
• Algorithms often use repetition to execute steps for a certain number of times or until a certain condition
is met.
• Example: Our daily routine as a student
Step 2: Brush your teeth. Step 3: Take a shower.
Step 1: Wake-up Step 4: Dress-up.
Step 7: Repeat the
process as a daily Step 6: Drive to the work/ Step 5: Get into the car/
routine ride to the college. take your bike.
63 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Algorithm
Algorithm Building blocks: Iteration (Repetition or Loop)
Example 1: Print “Hello World” 5 times O/P
Hello World
Algorithm Hello World
Hello World
Step 1 : Start Hello World
Hello World
Step 2 : Initialize the value of i as 1
Step 3 : Check the condition i less than or equal to 5, if the condition is true goto step 3.1 else goto step 4
Step 3.1: Print “Hello World” and increment the value of i by 1
Step 3.2: Repeat the Step 3 until the condition is true
Step 4 : Stop
64 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Algorithm
Algorithm Building blocks: Iteration (Repetition or Loop)
Example 2: Print first N natural numbers Assume N = 5,
Algorithm O/P
1
Step 1 : Start 2
3
Step 2 : Initialize the value of i as 1 4
5
Step 3: Read the value of a number, N
Step 4 : Check the condition i less than or equal to N, if the condition is true goto step 4.1 else goto step 5
Step 4.1: Print i and increment the value of i by 1
Step 4.2: Repeat the Step 4 until the condition is true
Step 5 : Stop
65 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Algorithm
Algorithm Building blocks: Iteration (Repetition or Loop)
Example 3: Print Sum of first N natural numbers
Assume N = 5,
Algorithm (1+2+3+4+5)
Step 1 : Start O/P
Step 2 : Initialize the value of i as 1 and sum as 0 15
Step 3: Read the value of a number, N
Step 4 : Check the condition i less than or equal to N, if the condition is true goto step 4.1 else
goto step 5
Step 4.1: calculate sum=sum+i
Step 4.2: Increment the value of i by 1 and repeat the Step 4 until the condition is true
Step 5 : print sum
Step 6 : Stop
66 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Algorithm
Algorithm Representation
• Almost every program involves the steps of input, processing, and output.
• Therefore, graphical representation are needed to separate these three steps.
• An algorithm can be written or described or represent using several tools:
Flow chart
• Use standardized symbol to show the steps the computer needs to take to accomplish the program’s
objective.
• Because flowcharts are cumbersome to revise, they have fallen out of favor by professional programmers.
Pseudo code
• Use English‐like phrases to describe the processing process. It is not standardized since every
programmer has his or her own way of planning the algorithm.
67 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Algorithm
Algorithm Representation
Why Algorithm is Important?
• Describe the steps needed to perform a computation
• Important for writing efficient code
- code that execute faster & which uses less memory
68 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Algorithm
Quiz
1) Algorithm should be?
a) Precise
b) Unambiguous
c) Clear
d) All of these
Answer : Option d)
69 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Algorithm
Quiz
2) Which of the following statement is correct?
a) Sequence is random execution of a process
b) Sequence is a step-by-step execution of a
process
c) Sequence statements executes in ordered
manner
d) Both b) and c)
Answer : Option d)
70 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Algorithm
Quiz
3) An algorithm is the sequence of instructions or a set of
rules to get something done.
a) True
d) False
Answer : Option a)
71 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Algorithm
Quiz
4)_____ and ____ statements are used to change the sequence
of execution of instructions.
a) Selection
b) Iteration
c) Function
d) Both a) and b)
Answer : Option d)
72 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Flowchart
Please download pictures in
suitable size here and insert them
by clicking the symbol above.
73 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Flowchart
Flowchart
• The flowchart is a pictorial representation of an algorithm i.e., the sequential steps in an algorithm can
be represented as a flowchart using the standard symbols.
• It describes all the processes and logical order in which the processes are carried out to solve a given
problem.
• Since it is a visual representation, it helps the programmer in understanding the logic of the program.
• In a flowchart, various symbols are used to indicate the specific operations.
74 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Flowchart
Flow Chart Symbols
Symbol Name Function
Process Indicates any of internal operation inside
the processor or memory
Input/output Used for any input/output operation
Decision Used to ask a question that can be
answered in a binary format (Yes/No,
True/False)
Connector Allows the flowchart to be drawn without
intersecting lines or without reverse flow
Predefined Process Used to invoke a subroutine or an
interrupt program
Terminal Indicates the starting or ending of the
program
Flow lines Shows direction of flow
75 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Flowchart
Flowchart
Basic guidelines for preparing Flowchart
• In drawing a proper flowchart, all necessary requirements should be listed in logical order.
• The flowchart should be clear, neat and easy to follow.
• Ensure that the flowchart has a logical start and finish.
• The usual direction of the flow of a procedure or system is from left to right or top to bottom.
• Only one flow line should come out from a process symbol.
76 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Flowchart
Flowchart
Basic guidelines for preparing Flowchart
• Only one flow line should enter a decision symbol, but two or three flow lines, one for each possible
answer, should leave the decision symbol.
• Only one flow line is used in conjunction with terminal symbol.
77 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Flowchart
Flowchart
Raptor
• Raptor is a visual programming development environment based on flowcharts.
• It’s works like a flowchart interpreter.
• A flowchart is a collection of connected graphic symbols, where each symbol represents a specific
type of instruction to be executed.
• The connections between symbols determine the order in which instructions are executed.
78 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Flowchart
Flowchart
Raptor
For Download: https://raptor.martincarlisle.com/
Basic Manual: Introduction to Programming with RAPTOR
79 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Flowchart
Flowchart: Example #1
Find the area of a triangle with 3 sides
Start
“Enter first side”
GET a
“Enter second
side” GET b Assume, a=5 b=6 c=7
“Enter third side” O/P:
GET c area=14.6969
s (a+b+c)/2
area (s*(s-a)*(s-b)* (s-
c))**0.5
End
80 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Flowchart
Flowchart: Example #2
Find the greatest among three numbers
Start
“Enter first Assume,
number” GET a
A=20 B=10 C=5
“Enter second A>B and A>C (True)
number” GET b
O/P:
“Enter third A is the Greatest number
number” GET c
no
A>B and
yes A>C
PUT “A is
Greatest B>C
yes no
number”
PUT “B is PUT “C is
Greatest Greatest
number” number”
End
81 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Flowchart
Flowchart: Example #3
Print the odd numbers from 1 to N
Start
Assume,
“Enter the value of N=5
N” GET N
O/P:
i 1 1 3 5
Loop
yes
i >N +
1
no
PUT i
i i +2
End
82 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Flowchart
Flowchart
Advantages
• It is a pictorial representation of a program, so it is easier for programmers to understand the logic of
the program.
• It is program independent so applicable for all programming languages.
• The workflow of the program can be tested successfully with the help of flowcharts.
• Facilitates troubleshooting
83 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Flowchart
Flowchart
Disadvantages
• It cannot replace all types of logics used on the computer program
• It is not suitable and complex for big problems
• If you need to modify or alternate the process, then it will be very hard to do in the flowchart. Because
either you will have to erase the end of the flowchart or start from the beginning.
84 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Flowchart
Quiz
1) Which one of the following is a graphical or symbolic
representation of a process?
a) Algorithm
b) Flow chart
c) Pseudo code
d) Program
Answer : Option b)
85 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Flowchart
Quiz
2) In a flow chart, which symbol is represented using a
rectangle?
a) Terminal
b) Decision
c) Process
d) Input/Output
Answer : Option c)
86 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Flowchart
Quiz
3) A flowchart needs to represent the a situation where for
each mark a student is award 'Pass' or 'Fail'...the system will
consider the mark and if it's 50 or over award 'Pass', else it
awards 'Fail'. This is an example of which of the algorithm
constructs?
a) Decision
b) Loop
c) Sequence
d) All the above
Answer : Option a)
87 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Flowchart
Quiz
4) In a flowchart how are symbols connected?
a) Symbols do not get connected together in a
flowchart
b) With lines and an arrow to show the direction of
flow
c) With dashed lines and numbers
d) With solid lines to link events
Answer : Option b)
88 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Flowchart
Quiz
5) What shape represents the start and end of a flowchart?
a) Rectangle
b) Oval
c) Diamond
d) Square
Answer : Option b)
89 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Pseudocode
Please download pictures in
suitable size here and insert them
by clicking the symbol above.
90 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Pseudocode
Pseudocode
• Pseudo-code is a detailed and easily understandable description of algorithms.
• It does not use any programming concepts, rather uses natural language.
• Pseudocode often uses structural conventions of a normal programming language but is intended
for human reading rather than machine reading.
• it is an efficient and environment-independent description of the key principles of an algorithm.
91 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Pseudocode
Pseudocode Keywords
Purpose Keyword Example
Input OBTAIN, GET, READ READ a, b
GET radius
Output DISPLAY, SHOW, PRINT PRINT sum
DISPLAY result
Compute COMPUTE, CALCULATE, DETERMINE COMPUTE a*(b/2)+6
Initialize SET, INIT SET sum=0
(=, ←) INIT A←20
Add one INCREMENT, BUMP INCREMENT i
92 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Pseudocode
Pseudocode Keywords
Purpose Keyword Example
Selection / IF-THEN-ELSE is a decision(selection) in which a IF a>b THEN
Conditional choice is made between two alternative courses of PRINT a is big
Statement action. ELSE
Syntax: PRINT b is big
IF condition THEN ENDIF
True alternative
ELSE
False alternative
ENDIF
Iteration / FOR loop repeats a statement or statement block FOR i ← 1 to n - 1
Loops several times. PRINT i
Syntax: ENDFOR
FOR iteration bounds
sequence
ENDFOR
93 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Pseudocode
Pseudocode Keywords
Purpose Keyword Example
Iteration / WHILE: Presentation of a set of instructions to be WHILE i<5
Loops performed repeatedly, as long as a condition is PRINT i
true. It specifies a loop with a test condition at the INCREMENT i
top ENDWHILE
Syntax:
WHILE condition
sequence
ENDWHILE
REPEAT: This loop is similar to the WHILE loop Number←5
except that the test is performed at the bottom REPEAT
of the loop instead of at the top PRINT Number
Syntax: Number=Number-1
REPEAT UNTIL Number==1
Sequence
UNTIL condition
94 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Pseudocode
Pseudocode: Example #1
Swapping of two numbers without additional variable.
Assume,
a=20 b=40
Pseudocode:
a= a+b (20+40=60)
READ a, b b=a-b (60-40=20)
a= a-b (60-20=40)
COMPUTE a=a+b After Swapping
a=40 b=20
COMPUTE b=a-b
COMPUTE a=a-b
PRINT a,b
95 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Pseudocode
Pseudocode: Example #2
Find the greatest of given two numbers.
Pseudocode :
Assume,
A=20 B=40
READ A, B
If A>B (False)
IF A>B THEN
B is greatest number
PRINT “A is the greatest number”
ELSE
PRINT “B is the greatest number”
ENDIF
96 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Pseudocode
Pseudocode: Example #3
Find the average of first n natural numbers
Pseudocode:
Assume,
READ num num=5
SET avg=0, sum=0, i=1 1+2+3+4+5
REPEAT sum=15 average=3
COMPUTE sum=sum+i
INCREMENT i=i+1
UNTIL i<=num
COMPUTE avg=sum/i
PRINT sum, avg
97 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Pseudocode
Pseudocode
Advantages
• It can be quickly and easily converted into an actual programming language as it is like a
programming language
• It is easy to understand, even for non-programmers
• It does not matter if there are errors in the syntax – but still obvious what is intended
• Changes to the design can be incorporated quite easily
98 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Pseudocode
Pseudocode
Disadvantage
• There is no standardized style or format, so one pseudo-code may be different from another
• Its not visual
• Its correctness cannot be verified by the computer
• For a beginner, it is more difficult to follow the logic or write pseudo-code as compared to flowchart.
99 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Pseudocode
Quiz
1) What is pseudocode?
a) Simplified programming language, that is not a
specific language
b) Complicated programming language
c) Simple programming language, which is linked to a
specific language
d) None of the above
Answer : Option a)
100 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Pseudocode
Quiz
2) The statement that tells the computer to get a
value from an input device and store it in a
memory location.
a) read
b) write
c) READ
d) WRITE
Answer : Option c)
101 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Pseudocode
Quiz
3) A statement used to close the IF block.
a) ELSE
b) ELSEIF
c) END
d) ENDIF
Answer : Option d)
102 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Pseudocode
Quiz
4) What will be the output of the following pseudocode?
Integer i
Set i = 3
do Answer : Option d)
print i + 3
i=i–1
while(i not equals 0)
end while
a) 666
b) 656
c) 555
103 Programming Fundamentals | © SmartCliff | Internal | Version 1.0 d) 654
THANK YOU