Page 17 - Touchcode_C8_Flipbook
P. 17

Exercise


                 A.  Tick ( ) the correct option.

                     1.  Which of the following operator is not a logical operator?
                         a.  OR                                       b.  WHAT

                         c.  AND                                      d.  NOT

                     2.  Which of the following can create conditional statements?
                         a.  IF                                       b.  IF-ELSE

                         c.  Nested IF-ELSE                           d.  All the above
                     3.  Which of the following operator negates a condition?

                         a.  OR                                       b.  WHAT
                         c.  AND                                      d.  NOT

                     4.  Which of the following statement does the if-else statement requires?

                         a.  Evaluation                               b.  Execution
                         c.  Else execution block                     d.  All of the above

                     5.  Which of the following is less than or equal to the operator?
                         a.  =                                        b.  >=

                         c.  <=                                       d.  ==

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

                     1.  The keyword elif, checks another statement if previous statement is false.

                     2.  Operator with the lowest precedence is grouped with its operands first.


                     3.  Relational operator compare the value of two variables.


                     4.  In Python AND operator is denoted by ‘and’ keyword.


                     5.  If the condition is true, OR will return false and vice-versa.

                 C.  Fill in the blanks.
                                                 HELP BOX     not, and, 1, boolean, or


                     1.  Logical operators work like ........................... variables and return either TRUE or FALSE.

                     2.  If all the conditions are true, the ........................... operator returns TRUE.

                     3.  If all the conditions false, the ........................... operator returns FALSE.



                                                                                        Conditionals in Details  15
   12   13   14   15   16   17   18   19   20   21   22