Programming Fundamentals
Day-01: Introduction
National Institute of Electronics & Information Technology
Ministry of Electronics & Information Technology (MeitY), Government of India
Gorakhpur Center
/GKP.NIELIT
http://www.nielit.gov.in/gorakhpur
@GKP_NIELIT
/NIELITIndia
/school/NIELITIndia
Contents to be covered
/GKP.NIELIT
http://www.nielit.gov.in/gorakhpur
@GKP_NIELIT
/NIELITIndia
/school/NIELITIndia
Programming Fundamentals
/GKP.NIELIT
http://www.nielit.gov.in/gorakhpur
@GKP_NIELIT
/NIELITIndia
/school/NIELITIndia
How to Learn Programming Fundamentals�
/GKP.NIELIT
http://www.nielit.gov.in/gorakhpur
@GKP_NIELIT
/NIELITIndia
/school/NIELITIndia
Program vs Algorithm
/GKP.NIELIT
http://www.nielit.gov.in/gorakhpur
@GKP_NIELIT
/NIELITIndia
/school/NIELITIndia
Summary of the key differences:�
An algorithm is an abstract concept, a logical plan. A program is a concrete, executable
entity.
Algorithms can be described in natural language, pseudocode, or flowcharts. Programs
must be written in a specific programming language (e.g., Python, Java, C++).
Algorithms are not directly executable by a computer. Programs are designed
to be executed by a computer.
Algorithms are independent of hardware and operating systems. Programs
depend on the hardware and operating system they run on.
An algorithm provides the theoretical solution to a problem. A program brings
that solution to life, making it functional on a computer.
/GKP.NIELIT
http://www.nielit.gov.in/gorakhpur
@GKP_NIELIT
/NIELITIndia
/school/NIELITIndia
Implementing Algorithm
/GKP.NIELIT
http://www.nielit.gov.in/gorakhpur
@GKP_NIELIT
/NIELITIndia
/school/NIELITIndia
Steps to Implement an Algorithm
/GKP.NIELIT
http://www.nielit.gov.in/gorakhpur
@GKP_NIELIT
/NIELITIndia
/school/NIELITIndia
Algorithm: Calculate the square of a number�
/GKP.NIELIT
http://www.nielit.gov.in/gorakhpur
@GKP_NIELIT
/NIELITIndia
/school/NIELITIndia
An algorithm for the addition of two numbers
/GKP.NIELIT
http://www.nielit.gov.in/gorakhpur
@GKP_NIELIT
/NIELITIndia
/school/NIELITIndia
Language idependent algorithm representation using flowchart and pseudo-codes
Pseudocode is a high-level, informal description of an algorithm that uses a combination of natural language
and programming-like constructs.
/GKP.NIELIT
http://www.nielit.gov.in/gorakhpur
@GKP_NIELIT
/NIELITIndia
/school/NIELITIndia
Example (Finding the larger of two numbers):
/GKP.NIELIT
http://www.nielit.gov.in/gorakhpur
@GKP_NIELIT
/NIELITIndia
/school/NIELITIndia
Flow Chart
A flowchart is a graphical representation of decisions and their results mapped out in individual shapes that were first developed by Herman Goldstine and John von Neumann in the 1940’s. Flowcharts can provide a step-by-step diagram for mapping out complex situations, such as programming code or troubleshooting problems with a Computer.
/GKP.NIELIT
http://www.nielit.gov.in/gorakhpur
@GKP_NIELIT
/NIELITIndia
/school/NIELITIndia
Flow Chart
/GKP.NIELIT
http://www.nielit.gov.in/gorakhpur
@GKP_NIELIT
/NIELITIndia
/school/NIELITIndia
Flow Chart
Example 1: Draw a flow chart to show the addition of two no.
START
STOP
Accept no1 & no2
Sum=no1+no2
Display the sum
/GKP.NIELIT
http://www.nielit.gov.in/gorakhpur
@GKP_NIELIT
/NIELITIndia
/school/NIELITIndia
Flow Chart
Example 2: Draw a flowchart to find the sum of first 50 natural numbers
/GKP.NIELIT
http://www.nielit.gov.in/gorakhpur
@GKP_NIELIT
/NIELITIndia
/school/NIELITIndia
Flow Chart
Example 3: Draw a flowchart to find the largest of three numbers A,B & C.
/GKP.NIELIT
http://www.nielit.gov.in/gorakhpur
@GKP_NIELIT
/NIELITIndia
/school/NIELITIndia
Flow Chart
Example 4: Draw a flowchart to find the factorial value of given number.
/GKP.NIELIT
http://www.nielit.gov.in/gorakhpur
@GKP_NIELIT
/NIELITIndia
/school/NIELITIndia
Functionality and Implementation
While "implementation" is the process of building that functionality into a working software using specific languages, tools, and processes, such as compilation or interpretation. Functional languages, a specific type of programming language, implement functionality through the use of mathematical functions and compositions, treating functions as first-class citizens rather than using imperative control structures like loops and variables.
/GKP.NIELIT
http://www.nielit.gov.in/gorakhpur
@GKP_NIELIT
/NIELITIndia
/school/NIELITIndia
Functionality�
Describes the actions a program takes and the results it produces.
Refers to the core characteristics of a programming language, such as its support for specific paradigms (e.g., functional, imperative).
In functional programming, functionality is centered on transforming data through the application of functions
/GKP.NIELIT
http://www.nielit.gov.in/gorakhpur
@GKP_NIELIT
/NIELITIndia
/school/NIELITIndia
Implementation�
/GKP.NIELIT
http://www.nielit.gov.in/gorakhpur
@GKP_NIELIT
/NIELITIndia
/school/NIELITIndia
Right Abstraction
/GKP.NIELIT
http://www.nielit.gov.in/gorakhpur
@GKP_NIELIT
/NIELITIndia
/school/NIELITIndia
Usages of right abstraction
/GKP.NIELIT
http://www.nielit.gov.in/gorakhpur
@GKP_NIELIT
/NIELITIndia
/school/NIELITIndia
usages of right abstraction
Hiding internal details of a system through abstraction can increase security by preventing users from accessing or modifying sensitive information they are not meant to.
The historical development of programming languages from machine code to high-level languages is an example of increasing levels of abstraction, building upon previous stages to create more expressive and manageable languages.
/GKP.NIELIT
http://www.nielit.gov.in/gorakhpur
@GKP_NIELIT
/NIELITIndia
/school/NIELITIndia
Code documentation
/GKP.NIELIT
http://www.nielit.gov.in/gorakhpur
@GKP_NIELIT
/NIELITIndia
/school/NIELITIndia
/GKP.NIELIT
http://www.nielit.gov.in/gorakhpur
@GKP_NIELIT
/NIELITIndia
/school/NIELITIndia
Language-Specific Considerations:�
/GKP.NIELIT
http://www.nielit.gov.in/gorakhpur
@GKP_NIELIT
/NIELITIndia
/school/NIELITIndia
Run time error and logical bug
/GKP.NIELIT
http://www.nielit.gov.in/gorakhpur
@GKP_NIELIT
/NIELITIndia
/school/NIELITIndia
Runtime Error�
/GKP.NIELIT
http://www.nielit.gov.in/gorakhpur
@GKP_NIELIT
/NIELITIndia
/school/NIELITIndia
Logical Bug�
The program may compile and execute without any obvious errors.
The underlying logic or algorithm in the code is incorrect, leading to the program producing the wrong output.
The program runs successfully but does not behave as intended.
A mathematical formula is incorrectly implemented, causing an inaccurate calculation, or an if-then statement uses the wrong condition, leading to an incorrect decision.
/GKP.NIELIT
http://www.nielit.gov.in/gorakhpur
@GKP_NIELIT
/NIELITIndia
/school/NIELITIndia
Black Box and White Box testing
/GKP.NIELIT
http://www.nielit.gov.in/gorakhpur
@GKP_NIELIT
/NIELITIndia
/school/NIELITIndia
Key Differences of Black and White Box Testing�
/GKP.NIELIT
http://www.nielit.gov.in/gorakhpur
@GKP_NIELIT
/NIELITIndia
/school/NIELITIndia
Debugging techniques
/GKP.NIELIT
http://www.nielit.gov.in/gorakhpur
@GKP_NIELIT
/NIELITIndia
/school/NIELITIndia
Systematic Debugging Process�
/GKP.NIELIT
http://www.nielit.gov.in/gorakhpur
@GKP_NIELIT
/NIELITIndia
/school/NIELITIndia
Key Debugging Techniques�
/GKP.NIELIT
http://www.nielit.gov.in/gorakhpur
@GKP_NIELIT
/NIELITIndia
/school/NIELITIndia
/GKP.NIELIT
http://www.nielit.gov.in/gorakhpur
@GKP_NIELIT
/NIELITIndia
/school/NIELITIndia
Thank You
Any Query
/GKP.NIELIT
http://www.nielit.gov.in/gorakhpur
@GKP_NIELIT
/NIELITIndia
/school/NIELITIndia