Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 123 - 2625 PortGPt V2.1
P. 123

    Worksheet                     2

                                                   (Based on chapters 5 to 8)

                    Tick ( ) the correct option.

                          1.  Which of the following is a reserved word that has a special meaning for the JavaScript
                             interpreter?

                             (i)  Keyword                                  (ii)  Variable
                             (iii)  Operator                               (iv)   Expressions

                          2.  Which of the following can we use to write the JavaScript code?
                             (i)  Notepad                                  (ii)  Visual Studio Code

                             (iii)  Sublime Text                           (iv)   All of these

                          3.  Which statement executes certain statements depends on the user’s choice?
                             (i)   Switch statement                        (ii)   If statement

                             (iii)   If else statement                     (iv)   None of these

                          4.  If a = 15 and b = 21, then what will be the output of the following code?
                                if(true)
                                    document.write(a*b-a);

                               else
                                    document.write(a**b);
                             (i)  100                                      (ii)  200

                             (iii)   300                                   (iv)   Nothing will print

                          5.  In JavaScript,  the statements  that  are  used to repeat a set of instructions  are  called
                             _________________:
                             (i)   Iterative                               (ii)   Looping statements

                             (iii)   simply loops                          (iv)   all of these

                          6.  An _________________ is defined as a change in an object’s state.
                             (i)   Event                                   (ii)  Event handler

                             (ii)  Function                                (iv)  All of these

                          7.  Which of the following appears in this instance when the button is clicked?
                             (i)   Message box                             (ii)   Alert box
                             (iii)  Both (i) and (ii)                      (iv)   None of these

                          8.  Which of the following is used to add multi-line comments in JavaScript?

                             (i)   /* */                                   (ii)   ==
                             (iii)   <!-- -->                              (iv)   " "

                                                                                                         Worksheet 2  121

| 118 119 120 121 122 123 124 125 126 127 128 |