Page 385 - Webapplication11_C11_Flipbook
P. 385

Solved Exercise


                                                                Section A
                                                        (Objective Type Questions)

                 A.  Choose the correct option.
                     1.  Which of the following keywords is used to initialise variables in JavaScript?
                        i.  for                                          ii.  getElement
                       iii.  var                                        iv.  boolean
                     2.  Which of the following JavaScript methods can be used to display data in some form?
                        i.  alert( )                                     ii.  script tag
                       iii.  document.write                             iv.  Both i and iii
                     3.  Which of the following keywords is used to declare a constant in JavaScript?
                        i.  var                                          ii.  const
                       iii.  int                                        iv.  None of these
                     4.  What will be the output of the following code snippet?
                           <script type="text/javascript">
                           x = 6 + "9";
                           document.write(x);
                           </script>
                        i.  69                                           ii.   Error
                       iii.  15                                         iv.  Both i and iii
                     5.  Identify the kind of type conversion used:
                        document.write(null + 6)
                        i.  Typecasting                                  ii.  Explicit Type Conversion
                       iii.  Hybrid Type Conversion                     iv.  Implicit Type Conversion
                     6.  How is the comparison done when the switch statement matches the expression with the specified case labels?
                        i.  The expression’s value is compared.
                        ii.  The expression’s datatype is compared.
                       iii.   The expression’s value as well as its datatype are compared.
                        iv.  None of these
                     7.  What will be the output of the following code snippet?
                         var a = 1;
                         var b = 0;
                         while (a <= 3)
                      {
                            a++;
                            b += a + 5;
                            document.write(b+" ");
                      }
                        i.  7 15 24                                      ii.  15 7 24
                       iii.  1 2 3                                      iv.  24 15 7
                     8.  This layer describes the appearance of the document. Identify the layer.
                        i.  Content                                      ii.  Behaviour
                       iii.  Expression                                 iv.  Presentation





                                                                                                  JavaScript Part 1  383
   380   381   382   383   384   385   386   387   388   389   390