COMPUTER SCIENCE 10TH – DETAILED QUESTION ANSWERS
PROBLEM SOLVING AND ALGORITHM DESIGNING
Q.1: What is problem solving?
Ans.
PROBLEM SOLVING:
Problem solving is a procedure to figure out the solution of complex problems. Problem solving is the main process in computer programming, where programmers first understand the problem, plan the solution, and then understand how to translate the algorithm into something a computer can do, and finally how to write the specific syntax or code required by a computer to get the job done.
Q.2: Define Problem?
Ans.
PROBLEM:
Problem sometimes referred as an issue, is any situation that occurs and is unexpected or prevents something from occurring. In programming, a problem is considered as a matter which is difficult to solve, it is a complex task or routine.
Q.3: What are the strategies of problem solving?
Ans.
PROBLEM SOLVING PROCESS:
Finding a suitable solution for issues can be accomplished by the following the basic four-step problem-solving process given below.
- Define the problem.
- Generate alternative solutions.
- Evaluate and select an alternative.
- Implement and follow up on the solution.
DEFINE THE PROBLEM
Specifically, the task of defining the problem consists of identifying what you know (input-given data), and what you want to obtain (output-the result). During this step, it is more important to understand the described problem.
GENERATE ALTERNATIVE SOLUTIONS
Many alternative solutions to the problem should be generated to achieve the desired results. Generating multiple alternatives can enhance the value of the best solution. So, it is good to generate a list of all possible solutions and evaluate to decide which one is the best for that particular problem.
EVALUATE AND SELECT AN ALTERNATIVE
Good problem-solving approach uses a series of considerations when selecting the best alternative. In this step, evaluate all possible solutions related to a target standard and select the best alternative. A particular alternative will solve the problem without causing other unanticipated problems.
IMPLEMENT AND FOLLOW UP ON THE SOLUTION
The implementation of the best solution also includes planning on what happens when something goes wrong with the selected solution. It is also important to follow up and track the results of the solution at every stage of implementation.
Q.4: What is algorithm?
Ans.
ALGORITHM
An algorithm is a procedure or formula for solving a problem. It can be defined as the set of well-defined step-by-step instructions to solve a program. In computer science, an algorithm usually means a small procedure that solves a specific problem; algorithms are widely used throughout all areas of IT. There are two common methods to represent algorithm designs: pseudocode and flowcharts.
Q.5: Explain the role of algorithm in problem solving. OR Describe the advantages of algorithm.
Ans. ROLE OF ALGORITHM IN PROBLEM SOLVING
Algorithms give us the most ideal option of accomplishing a task in problem solving. Algorithms are used to find the best possible way of solving a problem. In doing so, they improve the efficiency of a program. With the best algorithm, a computer program will be able to produce very accurate results. An algorithm can be used to improve the speed at which a program executes.
Q.6: What are the qualities of a good algorithm?
Ans. QUALITIES OF A GOOD ALGORITHM
- Inputs and outputs should be defined exactly.
- Every step in an algorithm must be clear, precise, and unambiguous.
- It should be effective among many different ways to solve a problem.
- It shouldn't have computer code. Instead, the algorithm must be written in such a way that it can be used in similar programming languages.
Q.7: Write some examples of algorithm.
Ans. ALGORITHM EXAMPLES
ALGORITHM 1: MAKING A CUP OF TEA
Step 1: Start.
Step 2: Put the teabag in a cup.
Step 3: Fill the kettle with water.
Step 4: Boil the water in the kettle.
Step 5: Pour some of the boiled water into the cup.
Step 6: Add milk to the cup.
Step 7: Add sugar to the cup.
Step 8: Stir the tea.
Step 9: Drink the tea.
Step 10: Stop.
ALGORITHM 2: SUBTRACTION OF TWO NUMBERS
Step 1: Start
Step 2: Declare variables n1, n2 & sub
Step 3: Read values n1 & n2
Step 4: Subtract n1 & n2 and assign the result to sub
sub = n1 - n2
Step 5: Display sub
Step 6: Stop
ALGORITHM 3: ADDITION OF TWO NUMBERS
Step 1: Start
Step 2: Declare variables n1, n2 & sum
Step 3: Read values n1 & n2
Step 4: Add n1 & n2 and assign the result to sum
sum = n1 + n2
Step 5: Display sum
Step 6: Stop
ALGORITHM 4: MULTIPLICATION OF TWO NUMBERS
Step 1: Start
Step 2: Declare variables n1, n2 & mul
Step 3: Read values n1 & n2
Step 4: Multiply n1 & n2 and assign the result to mul
mul = n1 * n2
Step 5: Display mul
Step 6: Stop
ALGORITHM 5: AREA OF CIRCLE
Step 1: Start
Step 2: Declare variable r and area
Step 3: Read value of r
Step 4: Apply formula {Area = (3.142) * r * r}
area = (3.142) * r * r
Step 5: Display area
Step 6: Stop
Q.8: What is flowchart?
FLOWCHART:
A flowchart is a pictorial representation of an algorithm, workflow or process, showing the steps as boxes of various kinds, and their order by connecting them with arrows. It is used to show the sequence of steps and logic of solution to a given problem. Flowcharts are used in analyzing, designing, documenting or managing a process or program in various fields.
Q.9: Define different symbols used in flowchart.
FLOWCHART SYMBOLS
- TERMINAL OR START/STOP
The terminal symbol is used to indicate the beginning (START) and ending (STOP) in the program logic flow.
(Symbol: Oval shape shown)
- Process
Process symbol is used to illustrate a process, action or an operation. These are represented by rectangles.
(Symbol: Rectangle shown)
3. Input / Output
The input / output symbol is used to denote any type of input data or output information.
(Symbol: Parallelogram shape shown)
4. Decision
The decision symbol is used in a flowchart to indicate a point at which a decision has to be made and a branch to one of two or more alternative points are possible.
(Symbol: Diamond shape shown)
5. Arrows or Flowlines
Flowlines with arrowheads are used to indicate the flow of operation. It shows the exact sequence in which the instructions are to be executed.
(Symbol: Arrow shown)
Q.10: Write down the importance of flowchart in problem solving.
IMPORTANCE OF FLOWCHART IN SOLVING A PROBLEM
Communication
Flowcharts are a better way of communicating the logic of a system.Effective Analysis
With the help of flowchart, a problem can be analyzed in a more effective way, therefore reducing cost and wastage of time.Efficient Coding
The flowcharts act as a guide or blueprint during the systems analysis and program development phase.Proper Debugging
The flowchart helps in debugging a process.Efficient Program Maintenance
The maintenance of an operating program becomes easy with the help of a flowchart. It helps the programmer to put efforts more efficiently on that part.
Q.11: Write down the example of flowchart.
Ans. FLOWCHART EXAMPLE
(Flowchart Diagram)
- Start
- Input Number 1, Number 2
- Sum = Number 1 + Number 2
- Print Sum
- Stop
Q.12: What are the differences between algorithm and flowchart?
Ans. DIFFERENCES BETWEEN ALGORITHM & FLOWCHART
ALGORITHM | FLOWCHART |
---|---|
It is a step-by-step solution of a program. | It is the diagrammatic representation which shows the flow of data. |
Text in common language is used in algorithm. | Symbols and shapes are used in flowchart. |
It is difficult to write and understand. | It is easy to construct and understand. |
Algorithm doesn't have any specific rules. | Flowchart has specific rules for its construction. |
Q.13: Define data structures.
Ans. Data Structures:
Data structure is a particular means of organizing and storing data in computers in such a way that we can perform operations on the stored data more efficiently. Data structures have a wide and diverse scope of usage across the fields of Computer Science and Software Engineering. Data structure may be linear or non-linear.
Q.14: Describe linear data structure.
Ans. LINEAR DATA STRUCTURE
Linear data structure arranges the data in a linear fashion. The data elements are arranged sequentially such that the element is directly linked to its previous and the next elements. This data structure supports single-level storage of data. And hence, transfer of the data is achieved through a single run only.
Examples of linear data structures are Stack, Queue, Array, etc.
Q.15: Define stack and its operations.
Ans. STACK
Stack is a linear data structure that stores information in such a way that the last item stored is the first item retrieved. It is based on the principle of LIFO (Last-in-first-out). The stack in digital computers is a group of memory locations with a register that holds the address of top of element. Stacks usually perform two operations.
- Push: It is used to insert an element on top of stack.
- Pop: It is used to delete an element from top of stack.
No comments:
Post a Comment