0% found this document useful (0 votes)
7 views51 pages

EIT - CO2 - Programming Fundamental (CO2)

The document outlines a course on Programming Fundamentals aimed at teaching students the basics of programming, including syntax, algorithms, flowcharts, testing, and debugging. It includes instructional objectives, learning outcomes, and a syllabus covering key concepts such as coding standards and user interface design. Additionally, it provides examples of algorithms, pseudocode, and assignments to reinforce learning.

Uploaded by

gurugoutham28
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views51 pages

EIT - CO2 - Programming Fundamental (CO2)

The document outlines a course on Programming Fundamentals aimed at teaching students the basics of programming, including syntax, algorithms, flowcharts, testing, and debugging. It includes instructional objectives, learning outcomes, and a syllabus covering key concepts such as coding standards and user interface design. Additionally, it provides examples of algorithms, pseudocode, and assignments to reinforce learning.

Uploaded by

gurugoutham28
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 51

Department of CSA

COURSE NAME:
INTRODUCTION TO
INFORMATION TECHNOLOGY
mmmV (EIT)
COURSE CODE: 22CA1103
Topic:
PROGRAMMING
FUNDAMENTAL (CO2)
Prepared by: Dr. Taushif Anwar
Assistant Professor, CSA Module - 2
CREATED BY K. VICTOR BABU
AIM OF THE SESSION

To enable students grasp the basics of programming, such as basic syntax in the program, writing
algorithms, using flowcharts, as well as testing and debugging the program to fix its errors.

INSTRUCTIONAL OBJECTIVES

This Session is designed to:


1. Demonstrate the concept of programming fundamentals, including programming styles and types.
2. Discuss the role of programming and how it can be used to communicate with computers.
3. Define problem solving with algorithms and flowcharts in programming.
4. Explain the concept of testing and debugging and their role in troubleshooting programs.

LEARNING OUTCOMES

At the end of this session, you should be able to:


1. Determine the concept and terms used to describe computer programming.
2. Summarize the styles and types of programming languages.
3. Identify the difference between an algorithm and a flowchart in programming.
4. Apply algorithm and flowchart concept to problem solving in computer programming.
5. Demonstrate the basics of programming and how to apply them when writing a program.
CREATED BY K. VICTOR BABU
Syllabus
Algorithm, Flowchart, Programming styles, Programming
Fundamentals, Testing and Debugging, Coding Standards
and Best practices, User Interface Design introduction,
Elements of UI design & reports.

Book: Pradeep, K. S., & Preeti, S. (2004). Computer


Fundamentals. BPB PUBLICATIONS.

CREATED BY K. VICTOR BABU


Programming Fundamental

CREATED BY K. VICTOR BABU


Introduction

CREATED BY K. VICTOR BABU


Introduction
• Program
• A set of step-by-step instructions that tells a computer to
perform a specific task and to produce the required results.
• Programmer
• A Programmer is a person who designs, writes and test
computer programs.
• Programming
• Programming is a process of designing or creating a
program.
• It is a communication technique to explain the instructions
to the computer.
6
CREATED BY K. VICTOR BABU
Introduction
• Programming language
• A set of conventions in which instructions for the
machine are written.
• A high-level language used to write computer programs,
as COBOL or BASIC, or, sometimes, an assembly
language.
• An artificial language used to write instructions that can
be translated into machine language and then executed
by a computer.
7
CREATED BY K. VICTOR BABU
STEPS FOR PROBLEM SOLVING

8
CREATED BY K. VICTOR BABU
STEPS FOR PROBLEM SOLVING
• Analyzing the problem
• It is important to clearly understand a problem before
we begin to find the solution for it.
• We need to read and analyze the problem statement
carefully.
• By analyzing a problem, we would be able to figure
out what are the inputs that our program should accept
and the outputs that it should produce.

9
CREATED BY K. VICTOR BABU
STEPS FOR PROBLEM SOLVING
• Developing an Algorithm
• It is essential to device a solution before writing a
program code for a given problem.
• The solution is represented in natural language and is
called an algorithm.
• An algorithm is a plan for solving a problem.

10
CREATED BY K. VICTOR BABU
STEPS FOR PROBLEM SOLVING
• Coding
• After finalizing the algorithm, we need to convert the
algorithm into the format which can be understood
by the computer to generate the desired solution.
• Different high level programming languages can be
used for writing a program.
• Record the details of the coding procedures followed
and document the solution.

11
CREATED BY K. VICTOR BABU
STEPS FOR PROBLEM SOLVING
• Testing and Debugging
• The program tested on various parameters.
• The program should meet the requirements
of the user.
• It must respond within the expected time.
• It should generate correct output for all possible inputs.
• In the presence of syntactical errors, no output will be
obtained.
• In case the output generated is incorrect, then
the program should be checked for logical errors, if any.
12
CREATED BY K. VICTOR BABU
ALGORITHM
• An algorithm is defined as a step-by-step procedure
designed to perform an operation which will lead to
the desired result, if followed correctly.

• Algorithms have a definite beginning and a definite


end, and a finite number of steps.

• A good algorithm, which is precise, unique and


finite, receives input and produces an output.

CREATED BY K. VICTOR BABU


ALGORITHM
• Why do we need an algorithm?
• The programmer first prepares a roadmap of the
program to be written, before actually writing the
code.
• Writing an algorithm is mostly considered as a
first
step to programming.
• The purpose of using an algorithm is to increase
the reliability, accuracy and efficiency of
obtaining solutions.
14

CREATED BY K. VICTOR BABU


ALGORITHM
• Characteristics of a good algorithm
• Precision — the steps are precisely stated or defined.
• Uniqueness — results of each step are uniquely
defined and only depend on the input and the result
of the preceding steps.
• Finiteness — the algorithm always stops after a
finite number of steps.
• Input — the algorithm receives some input.
• Output — the algorithm produces some output.
15

CREATED BY K. VICTOR BABU


ALGORITHM
 Problem: How to brush your teeth
 Real life Example
Step 1: Start
Step 2: Wake up
Step 3: Wash mouth
Step 4: Wash brush, apply toothpaste
Step 5: Brush your teeth
Step 6. Wash mouth and brush
Step 7: Put brush back to holder
Step 8: Stop
CREATED BY K. VICTOR BABU
ALGORITHM
## Algorithm for sum of two numbers
Step 1: start
Step 2: declare variables num1, num2
and sum.
Step 3: read values for num1, num2.
Step 4: add num1 and num2 and assign
the result to a variable sum.
Step 5: display sum
Step 6: stop 17
CREATED BY K. VICTOR BABU
ALGORITHM

Algorithm for the


average of three
numbers?

18
CREATED BY K. VICTOR BABU
ALGORITHM
## Algorithm for average of three numbers
Step 1: Start
Step 2: Read A, B, C
Step 3: Avg=(A+B+C)/3
Step 4: Print Avg
Step 5: Stop

19
CREATED BY K. VICTOR BABU
REPRESENTATION OF ALGORITHMS
• Flowchart - visual representation of algorithms

20

CREATED BY K. VICTOR BABU


CREATED BY K. VICTOR BABU
Flowchart
## Flowchart for sum of two numbers

22
CREATED BY K. VICTOR BABU
Flowchart
## Write an algorithm to check whether a number is
odd or even

23
CREATED BY K. VICTOR BABU
Pseudocode
• A pseudocode is another way of representing an algorithm.

• It is considered as a non-formal language that helps programmers


to write algorithm.

• It is a detailed description of instructions that a computer must


follow in a particular order.

• No specific standard for writing a pseudocode exists.

• The word “pseudo” means “not real,” so “pseudocode” means


“not real code”.
24
CREATED BY K. VICTOR BABU
Pseudocode
Following are some of the frequently used keywords while
writing pseudocode:
• INPUT
• COMPUTE
• PRINT
• INCREMENT
• DECREMENT
• IF/ELSE
• WHILE
• TRUE/FALSE

25
CREATED BY K. VICTOR BABU
Pseudocode
• Pseudocode for the sum of two numbers will
be:
INPUT num1
INPUT num2
COMPUTE Result = num1 + num2
PRINT Result

26
CREATED BY K. VICTOR BABU
Pseudocode
• Pseudocode for calculating area and perimeter of a
rectangle.
Input length
Input breadth
compute area = length * breadth
print area
compute perim = 2 * (length +
breadth)
print perim

27
CREATED BY K. VICTOR BABU
Assignment

• Write an algorithm/Pseudocode/Flowchart to find the greatest among


three different numbers entered by the user.

CREATED BY K. VICTOR BABU


Assignment

Ques: Write a Algorithm and draw a flowchart where multiple


conditions are checked to categorize a person as either child
(<13), teenager (>=13 but <20) or adult (>=20),based on age
specified.

CREATED BY K. VICTOR BABU


Assignment
Step 1- Start
Step 2- Input age
Step 3- If age < 13
Print "Child"
Elif age >= 20
Print "adult"
Else
Print "teenager"
Step 4. Stop

CREATED BY K. VICTOR BABU


Assignment

CREATED BY K. VICTOR BABU


Testing and Debugging
Testing
• Testing is the process to find bugs and errors.

• Testing is the process to identify the failure of


implemented code.
• Testing is the display of errors.
• Testing is done by the tester.
• There is no need of design knowledge in the
testing process.

CREATED BY K. VICTOR BABU


Testing and Debugging
Debugging
• Debugging is the process to correct the bugs
found during testing.
• Debugging is the process to give the freedom to
code failure.
• Debugging is a deductive process.

CREATED BY K. VICTOR BABU


Testing and Debugging
• Debugging is done by either programmer
or developer.
• Debugging can’t be done without proper
design knowledge.

CREATED BY K. VICTOR BABU


What is a Bug?
• The term bug refers to any shortcoming in a software
system that causes it to behave in unexpected and
undesirable ways.
• These could range from irrational or incorrect
responses, unpredictable failures, system crashes, etc.
• Essentially, it is a programming error leading to
software malfunction, which has been detected before
the website or app is deployed to production.
Bugs can be of multiple types. A few of them would be:
• Bugs affecting algorithms
• Bugs affecting logic – e.G. Infinite loops
• Bugs emerging due to uninitialized variables
CREATED BY K. VICTOR BABU
What is an error?
• The term Error refers to coding or programming
mistake that usually shows up due to incorrect syntax
or faulty loops.
• Errors are also of various types:
• Errors in calculation caused by wrong formula.
• Data handling errors caused by overwriting
necessary files
• Configuration errors caused due to insufficient
storage space

CREATED BY K. VICTOR BABU


What are Coding Standards?
• Coding standards as a set of rules,
techniques, and best practices to create
clear, more readable, more efficient
code with minimal errors.
• They offer a uniform format by
which software engineers can use to
build refined and highly functional
code.

CREATED BY K. VICTOR BABU


Coding Standards & Best Practices To
Follow
• Choose industry-specific coding
standards
• Focus on code readability
• Standardize headers for different module
• Don’t use a single identifier for multiple
purposes
• Turn daily backups into an drive.
• Leave comments and prioritize
CREATED BY K. VICTOR BABU
documentation.
What is user interface (UI) design?

• Designers aim to create interfaces


which users find easy to use and
pleasant.
• A user interface is the point of
interaction between humans and
computers.
• User interface design is the process of
designing how these interfaces look
CREATED BY K. VICTOR BABU
and behave.
Designing User Interfaces for Users

• Graphical user interfaces (GUIs)—Users


interact with visual representations on digital
control panels. A computer’s desktop is a GUI.
• Voice-controlled interfaces (VUIs)—Users
interact with these through their voices. Most
smart assistants—e.g., Siri on iPhone and
Alexa on Amazon devices—are VUIs.
• Gesture-based interfaces—Users engage
with 3D design spaces through bodily motions:
e.g., in virtual reality (VR) games.
CREATED BY K. VICTOR BABU
CREATED BY K. VICTOR BABU
User interface elements
• Input controls
• Input controls allow users to input information
into the system.
• Navigation components
• Navigational components help users move
around a product or website.

CREATED BY K. VICTOR BABU


User interface elements
• Informational components
• Informational components share information
with users. This includes notifications, progress
bars, message boxes, and pop-up windows.
• Containers
• Containers hold related content together.

CREATED BY K. VICTOR BABU


Assignment
Write an algorithm that performs the following:
Ask a user to enter a number. If the number is
between 0 and 10, write the word Blue.
If the number is between 10 and 20, write the word
Red.
If the number is between 20 and 30, write the word
Green.
If it is any other number, write that Not valid
color.

CREATED BY K. VICTOR BABU


CREATED BY K. VICTOR BABU
Question

Write an algorithm for the


swapping between two numbers?

CREATED BY K. VICTOR BABU


Write an algorithm for the swapping
between two numbers?

Step-1 Start
Step-2 Input Two Numbers Say NUM1, NUM2
Step-3 Display Before Swap Values NUM1, NUM2
Step-4 TEMP = NUM1
Step-5 NUM1 = NUM2
Step-6 NUM2 = TEMP
Step-7 Display After Swap Values NUM1, NUM 2
Step-8 Stop Algorithm

CREATED BY K. VICTOR BABU


Question

Write an algorithm for the


swapping between two numbers
(without help of third variable)?

CREATED BY K. VICTOR BABU


Write an algorithm for the swapping
between two numbers?

STEP 1: START.
STEP 2: ENTER NUM1, NUM2.
STEP 3: PRINT NUM1, NUM2.
STEP 4: NUM1 = NUM1 + NUM2.
STEP 5: NUM2 = NUM1 – NUM2.
STEP 6: NUM1 = NUM1 – NUM2.
STEP 7: PRINT NUM1, NUM2.
STEP 8: END

CREATED BY K. VICTOR BABU


Question

Write an algorithm that accepts


four numbers as input and find the
largest and smallest of them.

CREATED BY K. VICTOR BABU


find the largest and smallest Number

Step 1 Declare variables num1, num2, num3, num4,


min and max
Step 2 Ask user to input 4 numbers and store it on
variables num1, num2, num3 and num4
Step 3 If num1 >= num2, set max = num1 and min =
num2
Step 4 If num3 > max, set max = num3
Step 5 If num4 > max set max = num4
Step 6 If num3 < min, set min = num3
Step 7 If num4 < min, set min = num4
Step 8 Display min and max
CREATED BY K. VICTOR BABU

You might also like