Programming Fundamentals - V1.1 - Final
Programming Fundamentals - V1.1 - Final
08 NOV, 2022
Contents
• Computational Thinking
• Algorithm
• Flow Chart
• Pseudo-code
Introduction
take a problem, understand what the problem is and develop possible solutions.
• It requires,
Key Techniques
Key Techniques
• 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.
• Breaking the problem down into smaller parts means that each smaller problem can be examined in
more detail.
• Solving a crime can be a very complex problem as there are many things to be consider.
• 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.
• Among other things they all have eyes, tails and fur.
• 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.
• 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.
• 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.
• 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
Quiz
Answer : Option b)
Quiz
Quiz
Answer : Option a)
18 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Computational Thinking
Quiz
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.
Activity
A customer requirement
• Ask questions and understand the product completely in both customer and developer stand points.
• Requirement is clear
Roll Players
There are several roll players involved to build the house:
• Civil Engineer
• Mason
• Electrician
• Carpenter
• Etc.,
Testing
Testing
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?
Delivery
Result?
• Etc.,
30 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
SDLC Phases
Delivery
quality product !
• 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
SDLC System
Design
Documen
tation
Coding
Testing
• The first step in the process of program development is the thorough understanding and identification of
• 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.
• Planning for the quality assurance requirements and identifications of the risks
• System design starts by focusing on the main goal that the program is
Algorithm:
Flow Chart :
Pseudo Code:
SDLC- Coding
• 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.
SDLC- Coding
SDLC- Testing
• 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.
SDLC- Documentation
• Documentation help the users and the people who maintain the software.
• 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.
regularly.
Quiz
development?
Answer : Option b)
43 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
SDLC Phases
Quiz
SDLC?
a) Algorithm
b) Flow Chart
c) Pseudo-code
Answer : Option d)
44 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
SDLC Phases
Quiz
a) Designing
b) Documenting
c) Coding
Answer : Option c)
Quiz
user site?
a) Maintenance
b) Deployment
c) Documentation
Answer : Option b)
Algorithm
Algorithm
• However, most agree that algorithm has something to do with defining generalized processes
Algorithm
time.
OR
• An algorithm is a finite list of sequential steps specifying actions that if performed result in solution of a
specific problem.
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
Algorithm - Example
1. Sequencing ( Action): An Action is one or more instructions that the computer performs in sequential
3. Iteration (Repetition or Loop): A Loop is one or more instructions that the computer performs repeatedly.
• This describes a sequence of actions that a program carries out one after another, unconditionally.
Algorithm
Step 1 : Start
Assume,
username=XYZ
Step 2 : Input username
Welcome XYZ
Step 3 : Print Welcome username
Step 4 : Stop
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
Area=length*width
Step 6 : Stop
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 5 : Stop
• 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
No
Step 4 : Play Video
Step 1 :Morning Step 2 :Call Friends Step 3 : if Friends Game
Wakeup available?
Algorithm
Step 1 : Start
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 : 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
Example 3: Check whether the given year is Leap Year or not. year=2100
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
• 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 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 4 : Stop
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
Algorithm Representation
• Almost every program involves the steps of input, processing, and output.
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.
Algorithm Representation
Quiz
a) Precise
b) Unambiguous
c) Clear
d) All of these
Answer : Option d)
69 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Algorithm
Quiz
d) Both b) and c)
Answer : Option d)
70 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Algorithm
Quiz
a) True
d) False
Answer : Option a)
Quiz
a) Selection
b) Iteration
c) Function
d) Both a) and b)
Answer : Option d)
Flowchart
• The flowchart is a pictorial representation of an algorithm i.e., the sequential steps in an algorithm can
• 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.
Flowchart
• In drawing a proper flowchart, all necessary requirements should be listed in logical order.
• 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.
Flowchart
• Only one flow line should enter a decision symbol, but two or three flow lines, one for each possible
Flowchart
Raptor
• A flowchart is a collection of connected graphic symbols, where each symbol represents a specific
• The connections between symbols determine the order in which instructions are executed.
Flowchart
Raptor
For Download: https://raptor.martincarlisle.com/
Flowchart: Example #1
“Enter second
side” GET b Assume, a=5 b=6 c=7
s (a+b+c)/2
End
80 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Flowchart
Flowchart: Example #2
Find the greatest among three numbers
Start
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
Flowchart
Advantages
the program.
• The workflow of the program can be tested successfully with the help of flowcharts.
• Facilitates troubleshooting
Flowchart
Disadvantages
• 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.
Quiz
a) Algorithm
b) Flow chart
c) Pseudo code
d) Program
Answer : Option b)
Quiz
a) Terminal
b) Decision
c) Process
d) Input/Output
Answer : Option c)
Quiz
a) Decision
b) Loop
c) Sequence
Answer : Option a)
Quiz
Answer : Option b)
Quiz
a) Rectangle
b) Oval
c) Diamond
d) Square
Answer : Option b)
Pseudocode
• It does not use any programming concepts, rather uses natural language.
• Pseudocode often uses structural conventions of a normal programming language but is intended
Pseudocode Keywords
Pseudocode Keywords
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
Pseudocode: Example #1
COMPUTE a=a-b
PRINT a,b
Pseudocode: Example #2
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
ENDIF
Pseudocode: Example #3
Pseudocode:
Assume,
READ num num=5
INCREMENT i=i+1
UNTIL i<=num
COMPUTE avg=sum/i
Pseudocode
Advantages
• It can be quickly and easily converted into an actual programming language as it is like a
programming language
• It does not matter if there are errors in the syntax – but still obvious what is intended
Pseudocode
Disadvantage
• There is no standardized style or format, so one pseudo-code may be different from another
• For a beginner, it is more difficult to follow the logic or write pseudo-code as compared to flowchart.
Quiz
1) What is pseudocode?
a) Simplified programming language, that is not a
specific language
Answer : Option a)
Quiz
a) read
b) write
c) READ
d) WRITE
Answer : Option c)
101 Programming Fundamentals | © SmartCliff | Internal | Version 1.0
Pseudocode
Quiz
a) ELSE
b) ELSEIF
c) END
d) ENDIF
Answer : Option d)
Quiz
a) 666
b) 656
c) 555