0% found this document useful (0 votes)
2 views8 pages

Introduction To Programming (Unit-1 Long Answers)

The document outlines the steps involved in problem-solving and programming, including identifying problems, generating solutions, and evaluating alternatives. It describes phases of problem solving, the importance of algorithm design, and methods for program verification and efficiency improvement. Additionally, it provides algorithms for various mathematical calculations and emphasizes the significance of algorithm analysis and notations.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views8 pages

Introduction To Programming (Unit-1 Long Answers)

The document outlines the steps involved in problem-solving and programming, including identifying problems, generating solutions, and evaluating alternatives. It describes phases of problem solving, the importance of algorithm design, and methods for program verification and efficiency improvement. Additionally, it provides algorithms for various mathematical calculations and emphasizes the significance of algorithm analysis and notations.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Introduction to Programming (Long Answers Unit-1)

1. Explain computer solving requirements.


Ans :)

Step 1: Identify and Define Problem Explain your problem clearly as possible as you can.

Step 2: Generate Possible Solutions

• List out all the solution that you find. Do not focus on the quality of the solution

• Generate the maximum number of solutions as you can without considering the quality of the
solution

Step 3: Evaluate Alternatives After generating the maximum solution, Remove the undesired
solutions.

Step 4: Decide a Solution After filtering all the solution, you have the best solution only. Then
choose one of the best solution and make a decision to make it as a perfect solution.

Step 5: Implement a Solution: After getting the best solution, implement that solution to solve a
problem.

Step 6: Evaluate the result after implementing a best solution, evaluate how much you solution
solve the problem. If your solution will not solve the problem then you can again start with Step2.

2. Describe phases of problem solving.


Ans:) PHASES OF PROBLEM SOLVING:
Problem Solving Phase

• Analysis and Specification Understand (define) the problem and what the solution must do

• Algorithm Development Develop a comprehensive unambiguous logical sequence of steps to solve


the problem

• Verification of Algorithm Follow steps closely (manually) to see if solution works.

Implementation Phase

• Program Development Translate algorithm into a program written in a programming language

• Program Testing Test program for syntactical and logical errors. Fix the errors.

Maintenance Phase

• Use the program to solve real world problems

• Maintain Modify the program to meet changing requirements

1|Page
3. Explain problem solving strategies.

Ans :) 1. Identify the problem: The first step is to know which problem you need to solve. Then, you
need to find the root cause of the problem. The best course of action is to gather as much data as
possible, speak to the people involved, and separate facts from opinions. Once this is done, formulate a
statement that describes the problem. Use rational persuasion to make sure your team agrees.

2. Break the problem down: Identifying the problem allows you to see which steps need to be taken to
solve it. First, break the problem down into achievable blocks. Then, use strategic planning to set a time
frame in which to solve the problem and establish a timeline for the completion of each stage.

3. Generate potential solutions: At this stage, the aim isn’t to evaluate possible solutions but to
generate as many ideas as possible. Encourage your team to use creative thinking and be patient — the
best solution may not be the first or most obvious one. Use one or more of the different strategies in
the following section to help come up with solutions — the more creative, the better.

4. Evaluate the possible solutions: Once you’ve generated potential solutions, narrow them down to a
shortlist. Then, evaluate the options on your shortlist.

5. Implement and monitor the solutions: Once you’ve identified your solution and got buy-in from your
team, it’s time to implement it. But the work doesn’t stop there. You need to monitor your solution to
see whether it actually solves your problem. Request regular feedback from the team members involved
and have a monitoring and evaluation plan in place to measure progress. If the solution doesn’t achieve
your desired results, start this step-by-step process again

4. Describe top-down design.

Ans :) Top-Down Approach is an approach to design algorithms in which a bigger problem is broken
down into smaller parts. Thus, it uses the decomposition approach. This approach is generally used by
structured programming languages such as C, COBOL and FORTRAN.

In this approach we look at the overall requirement and start coding. We build the main function first,
then add calls to various functions like add, subtract etc... And then display the output. After doing all
these we code the individual functions for addition, subtraction etc.

2|Page
5. Explain the importance of algorithm designing.

Ans :) Algorithm design affects how well your solution works, how fast it runs, how much memory it

uses and how easy it is to understand and modify. Choosing best right algorithm can make a big

difference in the quality and efficiency of your solution. Designing algorithms requires a set of principles

and techniques. To begin, you must define the problem clearly and precisely including the inputs and

outputs, assumptions and goals of the solution breaking down the problem into smaller and simpler

subprograms can help, use recursion, divide, and conquer.

6. Explain program verification.

Ans :) Verification is the process of checking that software achieves its goal without any bugs.it is the

process to ensure whether the product that is developed is right or not. It verifies whether the

developed product fulfils the requirements that we have. The commonly used validation activities in

software testing are usability testing, performance testing, system testing, security testing, and

functionality testing. A few verification methods are inspection, code review, disk checking and

walkthroughs.

7. How to improve the efficiency of an algorithm.

Ans :) One of the best ways to improve your algorithm efficiency and correctness is to use pseudo

code and diagrams to plan and visualize your algorithm before you write any code. Pseudo code is a

simplified and informal way of describing the steps and logic of your algorithm, using natural language

and basic symbols. The most efficient algorithm is one that takes the least amount of execution time and

memory usage possible while still yielding a correct answer.

3|Page
8. Explain algorithm analysis and notations.

Ans :) Algorithm analysis is an important part of computational complexity theory, which provides

theoretical estimation for the required resources of an algorithm to solve a specific computational

problem. Analysis of algorithm is the determination of the amount of time and space resources required

to execute it Notations: Asymptotic Notations is used to describe the running time of an algorithm how

much time an algorithm takes with a given input n.

There are three different notations: big O, big Theta, and big Omega.

9. Write an algorithm to convert Fahrenheit to Celsius.

Ans :) ALGORITHM:

Step 1: Start
Step 2: Read F
Step 3: Find C= (F-32)*(5/9)
Step 4: Print C
Step 5: Find F= (9/5)*C+32
Step 6: Print F
Step 7: Stop
10. Draw a flowchart to find greatest of two numbers.

4|Page
11. Write an algorithm to calculate simple interest.

Ans :) ALGORITHM:

Step 1: Read p, t, r

Step 2: Print inputs

Step 3: Find si= (p*t*r)/100

Step 4: Print si

Step 5: Stop

12. Draw a flowchart to check whether the given year is leap year or not.

Ans :)

5|Page
13. Write an algorithm to find the area of a triangle using heron’s formulae.

Ans :) ALGORITHM:

Step-1: Declare side1, side2, side3, s, area.

Step-2: Read side1, side2, side3 using scanf () function.

Step-3: Calculate Semi-perimeter(s) using s = (side1 + side2 + side3) / 2;

Step-4: Calculate the area using Heron's formula i.e area = sqrt(s * (s - side1) * (s - side2) * (s- side3));

Step-5: Print Resultant area.

Step-6: Exit or terminate the program.

14. Draw a flowchart to interchange two numbers.

Ans :)

6|Page
15. Write an algorithm to find roots of quadratic equation.

Ans :) ALGORITHM:

Step 1. Start

Step 2. Read the coefficients of the equation, a, b and c from the user.

Step 3. Calculate discriminant = (b * b) – (4 * a * c)

Step 4. If discriminant > 0:

4.1: Calculate root1 = (-b + sqrt (discriminant)) / (2 * a)

4.2: Calculate root2 = (-b - sqrt (discriminant)) / (2 * a)

4.3: Display "Roots are real and different"

4.4: Display root1 and root2

Step 5: Else if discriminant = 0:

5.1: Calculate root1 = -b / (2 *a)

5.2: root2 = root1

5.3: Display "Root are real and equal"

5.4: Display root1 and root2

Step 6. Else:

6.1: Calculate real = -b / (2 * a)

6.2: Calculate imaginary = sqrt (-discriminant) / (2 * a)

6.3: Display “Roots are imaginary”

6.4: Display real, "±”, imaginary, "i"

Step 7. Stop

7|Page
16. Draw a flowchart to find average of 10 numbers entered by the user.
Ans :)

8|Page

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy