Page 112 - PortGPT_V2.1_C8_Flipbook
P. 112

c.   If i = 1, then the loop while(i < 5) {i++;} will execute 4 times.                       ___

                      d.   i++ in while loop is known as update expression.                                        ___
                      e.   The while statement is the looping statement.                                           ___


                  4.  Short answer type questions.
                      a.   What is looping?
                           ____________________________________________________________________________
                      b.   Write the syntax to the for loop.

                           ____________________________________________________________________________
                      c.   What is the use of Jump statement?
                           ____________________________________________________________________________

                  5.  Long answer type questions.
                      a.   What is the difference between while and do-while statements?

                      b.   Write the syntax of the while loop and give an example.

                      c.   Distinguish between continue and break statements.



                  fun Zone


                                                                                                         Critical Thinking
                    Let's soLve

                  .   Write the output of the following programs.

                      1.  var i = 2;
                           var j = 10;
                           while(i < j)
                           {
                               i++;

                               document.write(i);
                           }
                      2.   var a=10;

                           b=20;
                           do
                           {
                                   a++;
                                   b+=a++;
                                   document.write(a+ " , " +b);
                           }while(a<=20);







                  110   Premium Edition-VIII
   107   108   109   110   111   112   113   114   115   116   117