# Q.1   In a farm there are some cows and birds. If there are total 35 heads and 110 legs then how many cows and birds are there?

Ans:

Algorithm

• Each bird has 1 head and 2 legs and cow has 1 head and 4 Step 1: Start

Step 2: Suppose number of cows are x and birds are y. Step 3: Total number of heads are 35 then x * y = 35 Step 4: Total legs are 110 then 4x * 2y = 110

Step 5: Multiply step 3 by 2 then 2(x * y) = 35 x 2 so 2x * 2y = 70

Step 6: Subtract step 5 from step 4 so 4x * 2y = 110- 2x * 2y = 70 so become 2x    40 the value of X= 20

Step 7: Put value of x = 20 in equation x * y = 35 so value of y becomes 15 Step 8: So total number of cows are 20 and total number of birds are 15

ebraic Form Let no of cows Let no of birds Total heads = 35

Then x *  y = 35———- (i)

Total legs = 110

Then 4x * 2y = 110——- (ii)

Multiply equation (i) by “2” 2(x * y) = 35 x 2

2x * 2y =

Subtraction equation (iii) from (ii) 4x*2y      110

2x * 2 y    70

2x             40

40’2

20

Put x = 20 in equation (i) X * y = 35

20* y = 35 Y = 35 – 20

So number of cows x = 20 So number of birds y = 15

• Draw a flowchart that Input two numbers n1 and n2. Determine whether nlI divides

Ans:

• Draw a nowchart that Input a year and determine whether it is a leap year or not. Ans:

• Draw a nowchart that Input a number and calculate its factorial. Ans:

• Draw a nowchart to fmd LCM (Least Common Multiple) of two numbers. Ans:

# Q.6   Draw a nowchart that Input a number and display its factors. Ans:

• Define problem and problem Ans:

Problem:

A problem is an obstacle, hurdle, difficulty or challenge, or any situation that needs to be removed or solved.

Problem solving:

Problem-solving is a skill which can be developed by following a well-organized approach. Programming is also a problem solving activity. Problem Solving is the main task of computer science which is the job of computer programmer.

# Q.8   List the problem solving steps. Ans:

The following five steps are involved in problem solving 1: Defining a Problem

2: Understanding a Problem. 3: Planning a Solution.

4: Defining Candid Solutions. 5: Selecting the Best Solution

# Q.9   What do you mean by define the problem? Mention strategies. Ans:

Defining the problem is initial stage of problem solving. A well-defined problem is the one that does not contain any ambiguities. When we are going to solve some problem first we need to see whether the problem is defined well or not. If the problem is not defined well first of all define the problem. If the problem is not well defined then use the following are strategies to define the problem:

• Gain Background
• Use
• Draw a

# Q.10    What do you mean by well-defined problem? Ans:

A well-defined problem is the one that does contain ambiguities. All the conditions are clearly specified and it has a clear goal. It is easy to understand and solve.

# Q.11    What do you know understanding the problem or analyzing a problem? Ans:

The process of understanding the problem for developing its solution is called analyzing the problem. It is important to understand the problem before jumping into the solution of the problem. Understanding of a problem usually includes identification of the 5 Ws (what, who, when, where, and why).

# Q.12    Give one example of understanding the problem by using 5 Ws? Ans:

Understanding of a problem usually includes identification of the 5 Ws (what, who, when, where, and why).

Example: Suppose your class teacher assigns you a task to prepare a list of students in your school whose names start with letter ‘A’. The list is required in order to prepare an alphabetical directory of all school students and there is only one week to complete the task. We can analyse this problem by identifying 5Ws in the problem statement as given below:

• What: List of students names starting with letter ‘A’.
• Who:
• Why: To prepare the directory of
• When: Within a
• Where:

# Q.13    What do you mean by planning a solution? Mention strategies for problem solving. Ans:

Planning the solution of the problem is a creative stage of problem solving. It refers to dividing the solution into steps and arranging them into proper order that will solve the problem

• Divide and conquer
• Guess, Check and Improve
• Act it Out
• Prototype (Draw)

# Q.14    Define Candid Solutions

Ans:

The word candid refers to something spontaneous and unplanned. All the possible solutions of a problem that produce estimated result are known as candid solutions. To find candid solutions of a problem programmer has to look for different methods to solve the problem and come up with several solutions. It is not necessary that candid solution is the actual solution of the problem.

# Q.15    What do you mean by selecting the best solution? Ans:

After defining the candid solutions, only one solution can be selected. The selection of final solution of a problem should be based on the following criteria.

Speed: The selected solution of the problem should be efficient.

Cost: The selected solution of the problem should provide a cost-effective way of implementation.

Complexity: The selected solution of the problem should not be complicated. It should contain minimum number of instructions ‘ simple steps.

# Q.16    What is Gain Background knowledge to define the problem. Ans:

We try to know the situation and circumstances in which the problem is happening. In this way, we can identify the given state. It also helps to know what a good solution will look like. How we shall be able to measure the solution.

# Q.17    Define the problem by using guesses. Ans:

We try to guess the unknown information through appropriate guesses. These guesses may be based upon our past experiences.

# Q.18    Define “Draw a picture” strategy for well-defined problem. Ans:

If the problem is not well-defined, we can draw a picture and fill the undefined information.

# Q.19    What is top down design or divide and conquer rule? Ans:

At this stage the problem is decomposed into sub-problems. Rather on concentrating the bigger problem as a whole, we try to solve each sub-program separately. This leads to a simple solution. This technique is known as top down design (also called divide and conquer rule).

# Q.20    Define Algorithm md nowchart. Ans:

Algorithm:

An algorithm is a finite set of steps, which, if followed, accomplish a particular task. It is written in natural language for human understanding.

Flowchart:

Flowchart is the graphical or visual representation of an algorithm to solve problem using symbols.

# Q.21    What is the purpose of oval shape / Terminal shape symbol in nowchart? Ans:

An oval shape symbol that represents the Start or End of a flowchart.

# Q.22    What is the purpose of Input/Output Symbol in nowchart? Ans:

A parallelogram represents either input or output operation regardless of the input or output method.

# Q.23    What is the purpose of Rectangle symbol in flowchart? Ans:

Rectangle shape symbol is used to represent the process or action taken or shows all the calculations and store results.

# Q.24    What is the purpose of Diamond symbol in flowchart? Ans:

A diamond represents a decision symbol used for comparison or a decision. It changes the flow of control and computer decides a particular path to be followed.

# Q.25    What is the purpose of Connector symbol in flowchart? Ans:

A small circle represents a connector symbol and is used to join various parts of a Flow chart.

# Q.26    Draw a flowchart to convert Celsius (Centigrade) to Fahrenheit temperature. Ans:

• Draw a flowchart to find acceleration of moving objects with given mass and the force.

Ans:

• Draw a flowchart to fmd the volume of cube. Ans:

• Draw a flowchart to fmd plain interest on an amount. Ans:
• Draw a flowchart to fmd the area of a parallelogram. Ans:
• Draw a flowchart to determine whether a given number is odd or even. Ans:

# Q.32    What is role of algorithm in problem solving? Ans:

The Role of algorithm in problem solving is as follows:

• An algorithm has a vital role in problem solving as it provides a step-by-step guide to the problem
• Computer programming is the process of taking an algorithm and coding it in a programming
• Formulating an algorithm is the first step for developing a computer program

# Q.33    How we measure the efficiency of an algorithm? Ans:

The efficiency of an algorithm is measured on the basis of two metrics:

1. Number of steps: An algorithm must be considered efficient if it takes less number of steps to reach the
2. Space used in computer memory: An algorithm using less space in computer memory is considered more efficient with respect to memory

# Q.34    What is Test Data? Give example. Ans:

Test data is data which has been specially identified for use in test, typically of computer program. After solving a problem, we need to test whether the solution is correct or not, and for testing, we need “Test Data”.

Example: If we want to test the algorithm to find the largest among three given numbers a, b and c, then we need three values. These values can be positive, negative or zero, e.g., (a = 100, b = 200, c = 30), (a =22, b = -45, c 38). (a = 14, b 0, c  10), etc. So, for thinking about  testing, we also need to think about test data.

# Q.35    Why test data is important? Ans:

After solving a problem, we need to test whether the solution is correct or not, and for testing, we need Test Data. Test data helps to point out the defects and errors made during finding a solution to some problem. By using test data we improve the solution of the problem.

# Q.36    What is Valid and Invalid test data? Ans:

Valid test data is data that is valid with the input requirement of the algorithm while Invalid test data is data that is invalid with the input requirement of the algorithm.

# Q.37    Compare verification and validation. Ans:

Verification means to test if the solution is actually solving the same problem for which it was designed while Validation means to test whether the solution is correct or not.

# Q.38    What is a Trace Table?

Ans:

A trace table is a technique used to test algorithms, in order to make sure that no logical errors occur while the algorithm is being processed.

# Q.39    What happen if you give invalid data for testing the algorithm? Give example. Ans:

When you give invalid data as input to the algorithm during testing process then algorithm gives you unexpected output. Testing an algorithm using invalid data ensures that the algorithm can gracefully handle unexpected data inputs.

Example: If an algorithm is supposed to take a numeric value between 1 and 50 as input, but that input is not between 1 to 50 so it is invalid test data.

# Q.40    Which thing you first see when problem statement is given? Ans:

When we solve a problem statement, first we need to see whether the problem is defined well or not.

# Q.41    What happens if your algorithm is failed during verification? Ans:

If an algorithm is failed during verification, then it is important to identify the root cause of failure and then to correct it. Sometimes the error is logical. It means the solution is working but not giving required results.

# Q.42    What are advantages of flowchart? Ans:

Some advantages of flowchart are following:

• Easy to
• Easy to understand problem
• Easy to identity errors (if any).
• Easy to observe flow from one step to the

# Q.43    What are disadvantages of flowchart? Ans:

Following are some disadvantages of flowchart:

• More time is required to draw a
• Modifying a flowchart is not very easy every
• It is not suitable for very large and complex

# Q.44    What are advantages of algorithm? Ans:

Some advantages of algorithm are following:

• Easy to
• Techniques to write an algorithm are easy to
• To solve a large problem, algorithms are

# Q.45    What are disadvantages of algorithm? Ans:

Some disadvantages of algorithm are following:

• Modifying an existing algorithm is not very easy every
• Showing the flow from one step to the other is not very
• Usage of goto makes it difficult to identify errors

# Q.46    What do you mean by Boundary test data values? Ans:

A solution is tested on extreme values.

Example: To calculate interest we consider principal amount as 0 or a very huge amount.

# Q.47    What do you mean by Absent data? Ans:

It is also important to investigate that the solution still works if less number of inputs are given than expected. Example: If a system asks to enter driving license number, then everyone cannot provide this information. It is important to see how the system reacts in such situations.

# Q.48    What do you mean by. Wrong data format? Ans:

It is to check how the system reacts on entering data in wrong format.

Example: Giving a numeric value as input when alphabet is expected.

# Q.49    Write any two criteria for selection of final solution of a problem. Ans:

Two criteria are following:

Speed: When the solution is implemented in a programming language, the program should run fast.

Cost: The selected solution of the problem should provide a cost-effective way of implementation

# Q.50    What do you know about Act it Out strategy? Ans:

In this strategy the designer defines the list of “to-do” tasks. Afterwards he’she performs the task.

# Q.51    What do you know about Prototype (Draw)? Ans:

This technique draws a pictorial representation of the solution. It is not the final solution. However, it may help a designer to understand the important components of the solution.

# Q.52    What are the tasks performed by most of the nowchart? OR List steps for drawing

a flowchart. Ans:

Input to the flowchart

Type of processing required Decisions to be taken

The output to be produced after processing

# Q.53    How to plan a solution using guess, check and improve strategy? Ans:

The designer guesses a solution to a problem Checks the correctness of the solution.

If the solution is not according to expectations, then he’she refines the solution the refinement is an iterative process.