1. Programming Process
21BCA2T313 : Computing And Programming Fundamentals
Prof. Vishnu Priya P M
Assistant Professor Dept. of Computer Science
Kristu Jayanti College, Autonomous
(Reaccredited A++ Grade by NAAC with CGPA 3.78/4)
Bengaluru – 560077, India
2. UNIT 1: PROGRAMMING PROCESS
Developing a program, program development cycle; Introduction to Algorithms, Characteristics,
writing an algorithm; Flowchart, Symbols, guidelines for preparing flowchart, benefits of flowcharts,
limitations of flowcharts; Pseudo code, Pseudo code guidelines, benefits of pseudo code, limitations of
pseudo code;
Number System conversion.
3. DEVELOPING A PROGRAM
Developing a program involves a series of steps to translate a solution or algorithm into a working software
application.
• Problem Definition and Requirements Gathering:
Clearly define the problem you're trying to solve and gather all the requirements from stakeholders or users.
• Algorithm Design and Pseudocode:
Plan out the logic of your program using pseudocode or flowcharts. Break down the problem into smaller
steps and plan how they will be implemented.
• Choose a Programming Language:
Select a programming language that is suitable for the task and aligns with your team's expertise and the
project's requirements.
• Coding:
Write the actual code based on the pseudocode or algorithm you've designed. Implement the logic and use
the chosen programming language's syntax.
4. • Testing and Debugging:
Test your program to ensure that it works as expected. Identify and fix any errors (bugs) in your code.
• Optimization:
Improve the efficiency and performance of your code, if necessary. This might involve optimizing
algorithms or code structure.
• Documentation:
Create documentation that explains how to use your program, the logic behind it, and any important
technical details.
• Version Control:
Use version control systems (like Git) to track changes to your code over time. This helps in
collaboration and tracking progress.
• Integration and Deployment:
If your program interacts with other software or systems, integrate it seamlessly. Deploy your program
to the desired environment (e.g., a server or user's machine).
5. • User Acceptance Testing (UAT):
Have users or stakeholders test the program in a real-world scenario to ensure it meets their
needs and expectations.
• Feedback and Iteration:
Gather feedback from users and stakeholders. If needed, iterate on your program to make
improvements and address issues.
• Final Testing and Quality Assurance (QA):
Conduct thorough testing to ensure your program is stable, secure, and reliable.
• Release and Maintenance:
Once your program is ready and tested, release it to users or clients. Monitor its performance, fix
any post-release issues, and provide ongoing maintenance.
6. PROGRAM DEVELOPMENT CYCLE
The program development cycle, also known as the software development life
cycle (SDLC), outlines the stages involved in creating and maintaining a software
application. This cycle provides a structured approach to software development,
ensuring that the resulting software meets user requirements, is of high quality,
and is delivered within a reasonable timeframe.
7. Requirements Gathering and Analysis:
Define the purpose of the software and gather detailed requirements from stakeholders and users.
Analyze and prioritize these requirements to ensure a clear understanding of what the software
should accomplish.
System Design:
Design the system architecture, outlining the components, modules, and their interactions.
Create a high-level design that defines the structure of the software and how different parts will
work together.
Detailed Design:
Create detailed design specifications for each component or module.
Define data structures, algorithms, user interfaces, and any external interfaces.
Implementation (Coding):
Write the actual code based on the design specifications.
Use best coding practices and adhere to coding standards.
8. Testing:
Test each component/module individually (unit testing) to identify and fix bugs.
Integrate different components/modules and perform integration testing to ensure they work
together correctly.
Conduct system testing to validate the entire software against the defined requirements.
Deployment:
Deploy the software in a production or user environment.
Ensure all necessary resources are available for the software to run effectively.
User Acceptance Testing (UAT):
Let users or stakeholders test the software in a real-world environment to ensure it meets their needs
and expectations.
Feedback and Iteration:
Collect feedback from users and stakeholders and make necessary changes based on their input.
Release and Maintenance:
9. Release the software to users or clients.
Monitor the software's performance, fix any post-release issues (bugs), and provide ongoing
maintenance and updates.
Retirement or Enhancement:
If the software becomes outdated or is no longer needed, it may be retired.
If the software needs new features or updates, enter the cycle again to make enhancements.
10. ALGORITHM
An algorithm is a step-by-step set of well-defined instructions for solving a
problem or performing a task. In essence, an algorithm provides a systematic
approach to tackling a problem, outlining the exact sequence of actions to be
taken in order to achieve a desired outcome. Algorithms are not limited to
computer science; they are used in various fields, including mathematics,
engineering, and everyday life.
11. CHARACTERISTICS OF ALGORITHMS
• Well-Defined Steps: An algorithm's steps must be precisely defined and unambiguous,
leaving no room for interpretation.
• Finiteness: Algorithms must have a finite number of steps. They cannot continue indefinitely;
they must eventually terminate and produce an output.
• Input and Output: Algorithms take some input, process it through the defined steps, and
produce an output. The output could be a solution to a problem, a result of computation, or a
modified version of the input data.
• Effectiveness: Algorithms should be practical and feasible, meaning that they can be
executed using a finite amount of resources, such as time and memory.
12. • Deterministic: Each step of the algorithm must be well-defined and lead to a single,
unambiguous action. There should be no randomness or ambiguity in how the algorithm
behaves.
• Independence: The steps of an algorithm should be independent, meaning that each step relies
only on the results of previous steps and the given input.
• Correctness: An algorithm is correct if it produces the desired output for all valid inputs and
follows its defined behavior without errors.
• Optimality: Some algorithms aim to find the best possible solution according to certain criteria,
such as efficiency, accuracy, or resource usage.
13. WRITING AN ALGORITHM
Writing an algorithm involves breaking down a problem into a sequence of clear and unambiguous steps.
Understand the Problem: Before you start writing an algorithm, make sure you fully
understand the problem you're trying to solve. Identify the inputs, the desired output, and any
constraints or requirements.
Plan and Design: Think about the approach you want to take to solve the problem. Consider
different strategies and select the one that seems most appropriate. This might involve dividing
the problem into smaller subproblems, applying specific techniques, or iterating through data.
Outline the Steps: Break down the problem-solving process into a sequence of steps. Each step
should be clear, concise, and independent. Use a combination of text and pseudocode (a
simplified programming-like language) to describe the actions to be taken.
14. Use Control Structures: Incorporate control structures like loops (for, while) and conditional
statements (if, else) to control the flow of the algorithm based on different conditions.
Assign Variables: If your algorithm involves data manipulation, assign variables to store and
manipulate the data as needed.
Handle Input and Output: Specify how the algorithm will handle input (if any) and how it will
produce the desired output. Input could come from users, files, sensors, etc.
Consider Error Handling: Think about potential issues that might arise during execution, such as
invalid input or unexpected scenarios. Incorporate error-handling steps if necessary.
Test the Algorithm: Run through the algorithm manually with example inputs to make sure the
steps are correct and that the algorithm produces the expected output.
15. Refine and Optimize: If needed, refine the algorithm to improve its efficiency, readability, or
correctness. This might involve restructuring steps, simplifying logic, or optimizing loops.
Document the Algorithm: Write a clear description of the algorithm's purpose, steps, and any
relevant details. This documentation will help others understand and implement the algorithm.
16. Algorithm: Sum of Two Numbers
Input: Two numbers - num1, num2
Output: Sum of num1 and num2
1. Start
2. Read num1
3. Read num2
4. Set sum = num1 + num2
5. Print sum
6. Stop
17. FLOWCHART
A flowchart is a graphical representation of a process, algorithm, or system using
different shapes and arrows to depict the flow of steps and decisions. It's a visual
tool that helps convey the logic and structure of a process in a clear and
understandable way. Flowcharts are widely used in various fields, including
computer programming, business process analysis, system design, and education.
18. Start/End: Represents the beginning or end of a process. Usually depicted as an oval or rounded
rectangle.
Process/Action: Represents a specific action or task in the process. Displayed as a rectangle with
rounded corners.
Decision: Represents a decision point where the process can take different paths based on a
condition. Displayed as a diamond shape with "Yes" and "No" branches.
Input/Output: Represents data input or output from/to the process. Shown as a parallelogram.
Connector: Indicates a connection between different parts of the flowchart. Often represented
as a small circle.
Flow Arrows: Arrows connect the various symbols to show the sequence and direction of steps.
24. SYMBOLS USED IN FLOWCHARTS:
o Terminal (Start/End): Represents the start or end of a process. Usually depicted as an oval or
rounded rectangle.
o Process/Action: Represents a specific action or task in the process. Displayed as a rectangle with
rounded corners.
o Decision: Represents a decision point where the process can take different paths based on a
condition. Displayed as a diamond shape with "Yes" and "No" branches.
o Input/Output: Represents data input or output from/to the process. Shown as a parallelogram.
o Connector: Indicates a connection between different parts of the flowchart. Often represented as
a small circle.
o Flow Arrows: Arrows connect the various symbols to show the sequence and direction of steps.
25. GUIDELINES FOR PREPARING FLOWCHARTS:
Define the Scope: Clearly define the process or system you're depicting with the flowchart.
Understand the purpose and desired outcome.
Identify Symbols: Choose the appropriate symbols for each element in your process—start, end,
actions, decisions, inputs, outputs, and connectors.
Order and Sequence: Organize the flow of actions logically. Use arrows to indicate the sequence
of steps, ensuring that the process is easy to follow.
Keep it Simple: Use simple and clear language for labels inside the symbols. Avoid excessive
detail; focus on conveying the main steps.
Use Consistency: Maintain a consistent style throughout the flowchart, including symbol shapes,
line styles, and text formatting.
26. Use Standard Conventions: Stick to commonly recognized symbols to ensure your flowchart is
easily understandable by others.
Avoid Ambiguity: Make sure each decision point has clear conditions, such as "Yes" or "No," and
that each path leads to a well-defined outcome.
Test with Examples: Verify the flowchart's accuracy by running through examples to see if it
produces the expected results.
Review and Refine: Share the flowchart with others to get feedback. Refine it based on their
input to enhance clarity and correctness.
27. BENEFITS OF FLOWCHARTS:
Visual Representation: Flowcharts provide a visual overview of a process, making it easier to understand
complex sequences of actions and decisions.
Clarity and Communication: Flowcharts facilitate clear communication among team members, stakeholders,
and individuals with varying levels of expertise.
Process Analysis: Flowcharts help identify bottlenecks, inefficiencies, or areas for improvement in a process,
aiding in optimization.
Standardization: Flowcharts allow organizations to standardize processes, ensuring consistent procedures
are followed.
Documentation: They serve as documentation of processes, making it easier to train new employees or
troubleshoot issues.
Decision Analysis: Flowcharts aid in decision-making by visually representing different choices and
outcomes.
28. LIMITATIONS OF FLOWCHARTS:
Complexity: For highly complex processes, flowcharts can become convoluted and difficult to
follow.
Limited in Detail: Flowcharts may not capture all the nuances of a process, especially when it
involves extensive decision trees or intricate logic.
Dynamic Processes: Flowcharts represent static processes; they don't capture dynamic or real-
time interactions.
Not Ideal for Algorithms: While flowcharts are great for high-level processes, they might not be
the best choice for detailing intricate programming algorithms.
Subjective Interpretation: Different individuals may interpret the same flowchart differently,
leading to confusion or miscommunication.
29. PSEUDOCODE
Pseudocode is a high-level description of a computer program or algorithm that
uses a combination of natural language and simplified programming constructs.
It's used to outline the logic of a program before actual coding begins, helping to
clarify and plan the steps necessary to solve a problem. Pseudocode is not tied to
a specific programming language and is primarily meant to convey the algorithm's
logic in a human-readable manner.
30. PSEUDOCODE GUIDELINES:
Keep It Simple: Use plain language and simple programming constructs that convey the logic
without getting into implementation details.
Use Indentation: Indentation helps to indicate the structure and nesting of statements, making
the pseudocode more readable.
Use Standard Conventions: While pseudocode isn't bound to a specific programming language,
adopting common conventions (like if-else statements or loops) makes it more understandable.
Focus on Logic: Emphasize the algorithm's logic rather than specific syntax. Use descriptive
variable names and meaningful comments.
31. Use Control Structures: Utilize standard control structures like loops, conditionals, and function
calls to express the flow of the algorithm.
Modularization: Break down the algorithm into smaller, manageable modules to enhance
clarity and reusability.
Avoid Ambiguity: Make sure each step is unambiguous, and the logic is clear. Readers should
be able to understand the intent without ambiguity.
Test with Examples: Run through the pseudocode with examples to ensure it accurately
describes the desired behavior
32. Algorithm: Find Maximum of Three Numbers
Input: Three numbers - num1, num2, num3
Output: Maximum of the three numbers
1. Start
2. Read num1
3. Read num2
4. Read num3
5. If num1 >= num2 and num1 >= num3 then
1. Set max = num1
2. Print max
6. Else If num2 >= num1 and num2 >= num3 then
1. Set max = num2
2. Print max
7. Else
1. Set max = num3
2. Print max
8. End
1. Start
2. Read num1
3. Read num2
4. Read num3
5. Set max = num1
6. If num2 > max
then
1. Set max =
num2
7. End If
8. If num3 > max
then
1. Set max =
num3
9. End If
33. BENEFITS OF PSEUDOCODE:
o Language Agnostic: Pseudocode is not tied to any specific programming language, making it useful for
collaboration among individuals with different programming backgrounds.
o Focus on Logic: Pseudocode allows developers to focus on the algorithm's logic and design before getting
into the complexities of actual coding.
o Clear Communication: It serves as a bridge between developers and non-developers, allowing stakeholders
to understand the high-level approach.
o Planning and Documentation: Pseudocode aids in planning and documenting the algorithm's design,
making it easier to revisit and revise the logic.
o Algorithm Design: It's particularly useful for designing complex algorithms where the exact syntax is less
important than the overall logic.
34. LIMITATIONS OF PSEUDOCODE:
Not Executable: Pseudocode is not directly executable like code written in a programming
language. It requires translation into a specific language for implementation.
Level of Detail: Pseudocode may lack the level of detail required for actual coding, leading to
ambiguities or inconsistencies when translated.
Subjective Interpretation: Like any form of natural language, pseudocode can be interpreted
differently by different people, potentially leading to misunderstandings.
Limited for Complex Algorithms: While pseudocode is great for outlining logic, extremely
complex algorithms might still require additional diagrams or descriptions to fully convey their
intricacies.
Translatability: Translating pseudocode into code requires understanding the specific
programming language's syntax and idioms.
35. NUMBER SYSTEM CONVERSION.
Number system conversion refers to the process of changing a numerical representation from one
base or radix to another. In computer science and digital systems, the most common number
systems are decimal (base 10), binary (base 2), octal (base 8), and hexadecimal (base 16).
Converting between these number systems is important for tasks like programming, digital design,
and data representation.
36. DECIMAL TO BINARY:
Divide the decimal number by 2.
Record the remainder (0 or 1).
Continue dividing the quotient by 2 until the quotient becomes 0.
The binary equivalent is the sequence of recorded remainders (read in reverse order).
Let's convert the decimal number 25 to binary.
Divide 25 by 2: Quotient = 12, Remainder = 1
Divide 12 by 2: Quotient = 6, Remainder = 0
Divide 6 by 2: Quotient = 3, Remainder = 0
Divide 3 by 2: Quotient = 1, Remainder = 1
Divide 1 by 2: Quotient = 0, Remainder = 1
Reading the remainders in reverse order gives us: 11001
So, the binary equivalent of decimal 25 is 11001.
37. BINARY TO DECIMAL:
Multiply each binary digit by 2 raised to the power of its position (starting from the rightmost digit as 0). Sum
up the results.
Let's convert the binary number 101101 to decimal.
Starting from the rightmost digit (least significant bit):
1 * 2^0 = 1
0 * 2^1 = 0
1 * 2^2 = 4
1 * 2^3 = 8
0 * 2^4 = 0
1 * 2^5 = 32
Summing these values gives: 1 + 0 + 4 + 8 + 0 + 32 = 45
So, the decimal equivalent of binary 101101 is 45.
38. DECIMAL TO HEXADECIMAL:
Divide the decimal number by 16.
Record the remainder.
Continue dividing the quotient by 16 until the quotient becomes 0.
Replace remainders greater than 9 with corresponding hexadecimal letters (A, B, C, D, E, F).
Let's convert the decimal number 206 to hexadecimal.
Divide 206 by 16: Quotient = 12, Remainder = C (12 in hexadecimal)
Divide 12 by 16: Quotient = 0, Remainder = E
Reading the remainders in reverse order gives us: EC
So, the hexadecimal equivalent of decimal 206 is EC.
39. BINARY TO DECIMAL:
Multiply each binary digit by 2 raised to the power of its position (starting from the rightmost digit as 0). Sum
up the results.
Let's convert the binary number 110110 to decimal.
Starting from the rightmost digit (least significant bit):
0 * 2^0 = 0
1 * 2^1 = 2
1 * 2^2 = 4
0 * 2^3 = 0
1 * 2^4 = 16
1 * 2^5 = 32
Summing these values gives: 0 + 2 + 4 + 0 + 16 + 32 = 54
So, the decimal equivalent of the binary number 110110 is
54.
40. OCTAL TO DECIMAL:
Multiply each octal digit by 8 raised to the power of its position (starting from the rightmost digit as 0). Sum
up the results.
Let's convert the octal number 247 to decimal.
Starting from the rightmost digit (least significant digit):
7 * 8^0 = 7
4 * 8^1 = 32
2 * 8^2 = 128
Summing these values gives: 7 + 32 + 128 = 167
So, the decimal equivalent of the octal number 247 is 167.
41. HEXADECIMAL TO DECIMAL:
Multiply each hexadecimal digit by 16 raised to the power of its position (starting from the rightmost digit as
0). Sum up the results, replacing any hexadecimal letters with their decimal equivalents.
Let's convert the hexadecimal number 1A7 to decimal.
Starting from the rightmost digit (least significant digit):
7 * 16^0 = 7
A (10 in decimal) * 16^1 = 160
1 * 16^2 = 256
Summing these values gives: 7 + 160 + 256 = 423
So, the decimal equivalent of hexadecimal 1A7 is 423.