Page 73 - Touchcode_C8_Flipbook
P. 73

WHAT IS A BUG?
                 A bug is an unexpected problem in your program. You follow a sequence of activities to write

                 a program, from which we expect to return a specific output. Any change in the expected
                 and actual output of the program is known as a bug or a glitch.

                 So, we can say that bug is a general term which is used to describe any unexpected problem
                 with hardware or software. Consider an example, suppose you create a boat to sail in the
                 ocean. Now when the boat is ready and you try to sail it in the water, you realize that there

                 is a small hole in the bottom of the boat from where the water is seeping in. Water seeping
                 in the boat at a slow speed may create a problem for the boat in the long run. So, this hole
                 in the bottom of the boat can be termed as a ‘bug’ in programming.

                   Coding           uiz   01                                                          Critical Thinking



                    State whether the following statements are true (T) or false (F).

                    a.  Algorithm is an example of sequence.


                    b.  Sequence of programming reflects logical thinking.





                                          Coding fact

                   Admiral Grace Hopper was the first person to use the term ‘bug’ to represent a

                   computer error.



                 SEQUENCING WITH LOOPS AND CONDITIONS
                 While writing an algorithm, three basic building blocks are used, sequencing, selection and

                 iteration.
                 Building  blocks help us to uncover the solution to a complex problem which  can be

                 understood and implemented by others using programming.

                 To understand the concept of sequencing in programming.
                 Let’s take an example of Sequence:


                                                                                                     Subject Enrichment
                  Example 1: Algorithm to swap two numbers.

                  Step 1:  READ num1, num2
                  Step 2:  temp = num1


                                                                                        Advanced Sequencing      71
   68   69   70   71   72   73   74   75   76   77   78