Pageviews

Wednesday 28 August 2019

+1]3.Principles Of Programming And Problem Solving - Solved Questions from text book


PLUS ONE 
COMPUTER APPLICATION / COMPUTER SCIENCE 

                   
  Chapter 3. (4 for CS)   Principles Of  Programming And Problem Solving

                  (+1. Computer Application  Questions and answers from text book)



1. What is an algorithm?

        In computer terminology an algorithm may be defined as a finite sequence of instructions to solve a problem. It is a step-by-step procedure to solve a problem, where each step represents a specific task to be carried out. However, in order to qualify as an algorithm.

2. Pictorial representation of algorithm is known as ______.

      Ans. Flowchart

3. Which flow chart symbol is always used in pair?

    Ans. connector

4. Which flow chart symbol has one entry flow and two exit flows?

   Ans. Decision  box.(Rhombus)

 5. Program written in HLL is known as ________.

    Ans.  Source code

 6. What is debugging?

         Debugging is the stage where programming errors are discovered and corrected. As long as computers are programmed by human beings, the programs will be subject to errors. Programming errors are known as 'bugs' and the process of detecting and correcting these errors is called debugging

 7. What is an object code?

       Now we have a program fully constituted by machine language instructions. This version of the source code is known as object code and it will be usually stored in a file by the compiler itself.

8. What is the role of a computer in problem solving?

      Computer can carry out tasks efficiently and accurately  if we give correct instructions. Computer is an obedient servant without any common sense.  So the computer can be used to solve problems by giving step by step instruction to solve it.

 9. What is the use of connector in a flow chart?

         When a flowchart becomes bigger, the flow lines start crisscrossing at many places causing confusion and reducing comprehension of the flowchart. Moreover, when the flowchart becomes too long to fit into a single page the use of flow lines becomes impossible. Whenever a flowchart becomes complex and the number and direction of flow lines is confusing or it spreads over more than one page, a pair of connector symbols can be used to join the flow lines that are broken. This symbol represents an "entry from", or an "exit to" another part of the flowchart.

 10. What do you mean by logical errors in a program?

      Two types of errors that occur in a program - syntax errors and logical errors

      Logical errors is due to improper planning of the program's logic. The language processor successfully translates the source code into machine code if there are no syntax errors. During the execution of the program, computer actually follows the program instructions and gives the output as per the instructions. But the output may not be correct. This is known as logical error. When a logical error occurs, all you know is that the computer is not giving the correct output. The computers do not tell us what is wrong. It should be identified by the programmer or user. In order to determine whether or not there is a logical error, the program must be tested. So, let us move on to the next stage of programming.

11. What are the limitations of a flow chart?

      a). Very time consuming to draw .
 
        b). Changing in logic is difficult.

       c). No standard about amount of details including .

12. What is the need of documentation for a program?

         A computerised system cannot be considered to be complete until it is properly documented. In fact documentation is an on-going process that starts in the problem study phase of the system and continues till its implementation and operation. We can write comments in the source code as part of documentation. It is known as internal documentation. It helps the debugging process as well as program modification at a later stage.Another version of documentation is the preparation of system manual and user manual. These are hard copy documents that contain functioning of the system, its requirements etc. and the procedure for installing and using the programs. While developing software for various applications, these manuals are mandatory. This kind of documentation is known as external documentation.

13. What is a computer program? How do algorithms help to write programs?

       A finite sequence of instructions to solve a problem written in a computer language.

Algorithm is a finite sequence of instructions to solve a problem. It is a step by step procedure to solve a problem. It may contain input, processing , conditions and  output statements. It follow the logical flow of the program. So writing of program is easy with the help of flowchart.

14. Write an algorithm to find the sum and average of 3 numbers.


    Step 1 : Start   

    Step 2 :  Get the input of three real numbers and store in a,b,c

    Step 3: calculate sum <- a + b + c

    Step 4: calculate avg <- sum / 3

     Step 5: print sum and avg.

     Step 6 : Stop

15. Draw a flowchart to display the first 10 natural numbers.


                     
      Same as first 100 natural numbers.Condition N<=100 instead of N<=10.       

16. What are the characteristics of an algorithm?

     a). It will begin with instructions to accept inputs.
     b). Uses variables to refer data.
    c). Each instructions should be precise and clear.
    d). Instructions should be simple.
    e). The total time taken to carry out all steps should be finite.
    f). After performing the instructions, the desired output must be obtained

17. What are the advantages of using a flowchart?

       a). Better communication: By using symbols, it is easy to convey ideas to other  programmers.

     b). Effective analysis:  Because it clearly specifies the flow of steps in the program.

    c). Effective synthesis:  Program can be divided into small modules and its solution  can represent separately and can finally placed together.
   d). Efficient Coding:   The flow chart act as a road map through which the programmer can develop program with out omission of important steps .

18. Briefly explain different phases in programming.

         a). Problem Identification : To identify the data involved in processing, its types, formula to be                used, activities involve and the output to be obtained.

        b). Preparing of Algorithms and flowchart: to develop a step by step procedure for problem                       solving.

        c). Coding:   writing of actual program  in computer language.

        d) Translation:  Conversion of high level language program to machine language.

        e). Debugging :  Finding and correcting of errors in the program

        f). Execution and testing : Running of the program and testing for correctness.

       g). Documentation: It will help to understand the program  for proper usage and modification.

                   Two types of documentations.
     1) Internal documentation : Adding comments in program code etc..
     2) External Documentation: Writing manuals about the program for user help.


Image result for flowchart symbols