Page 342 - Web Applications (803) Class 11
P. 342

9.  Which of the following code snippets represent an infinite loop?
                             Code Snippet 1                           Code Snippet 2

                         for(i=10;i>=1;i--)                        var a=10;
                         {                                         while(a>=1)
                            document.writeln(i);                   {
                         }                                         document.writeln(a);
                                                                         a++;
                                                                   }
                      i.  Code Snippet 1                              ii.  Code Snippet 2
                     iii.  Both of these                              iv.  None of these
                 10.   Where do we insert the script tag?
                      i.  Head section                                ii.  Body section
                     iii.  Both i and ii                              iv.  None of these

                   Ans. 1.  iii.       2.  iv.       3.  ii.       4.  i.         5.  iv.        6.  iii.      7.  i.
                       8.  iv.         9.  ii.      10.  iii.

              B.  Fill in the blanks.

                  1.   ................................ execute the same set of operations over and over again.   [CBSE Handbook]
                  2.   Variables defined in ................................ scope have a limited lifespan.
                  3.  ................................ statement skips the loop execution for a particular iteration.   [CBSE Handbook]
                  4.  A ................................ is a classification of the type of data that can be stored in a variable or object.
                  5.  A variable's ................................ refers to the area of a program where it can be accessed.
                  6.  ................................ the statement exits the loop and stops unnecessary execution.   [CBSE Handbook]
                  7.  Plus sign is used to ................................ numbers and strings.        [CBSE Handbook]
                  8.  In ................................ scope, variables can be used anywhere in the program.

                  9.  ................................ method checks if an expression is true or false.
                 10.  ................................ is called composite data type.

                   Ans. 1.  Loops         2.  local              3.  continue                4.  data type
                       5.  scope          6.  break              7.  join                    8.  global
                         9.  Boolean     10.  Object

              C.  State whether these statements are true or false:
                  1.   JavaScript is a compiled programming language.
                  2.  The break statement is used to “jump out” of a loop.
                  3.  The confirm() method is used to accept information from the user about an action.
                  4.  One of the limitations of JavaScript is that it increases compilation time, allowing for more application development time.
                  5.  JavaScript has excellent options for making a website more interactive and user-friendly.
                  6.  A do… while loop is an entry-controlled loop.
                  7.  The for loop will end if the loop condition is false.

                  8.  The default block in a switch case is never executed.
                  9.  One can add as many scripts into a single HTML document as one likes.
                 10.  Keywords can be used as variable names.
                      Ans. 1.  False      2.  True      3.  False      4.  False     5.  True
                          6.  False       7.  True      8.  False      9.  True     10.  False

                340     Touchpad Web Applications-XI
   337   338   339   340   341   342   343   344   345   346   347