Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 135 - 2609_Logiccode
P. 135

    Hashtag

                          #Mutable: It means something can be changed after it is created.
                          #Decision-making: It is the process of choosing what to do based on given conditions or rules.

                          REVISIT

                       ▶  Data types are used to define the type of value a variable can contain.
                       ▶  Comments enable us to understand the way a program works.
                       ▶  Operators can be defined as special symbols which perform arithmetic and logical computation.
                       ▶  Arithmetic operators perform arithmetic operations between two operands.
                       ▶  Assignment operators are used to assign the value of the right expression to the left operand.
                       ▶   Relational operators are used to compare the value of the two operands and returns True or False
                         accordingly.
                       ▶  Precedence of operators determines the order in which the operators are executed.
                       ▶  The if statement is the simplest conditional statement.
                       ▶   In the if…else statement, if the condition evaluates to True, the indented block following the if statement is
                         executed, otherwise the indented block after the else statement is executed.
                       ▶  Python allows the nested if statement.
                       ▶  The if…elif…else ladder helps us to test multiple conditions and follows a top-down approach.

                     1.  Tick ( ) the correct option.

                        a.  The statement using AND operator results true if ____________.
                            (i)  Both conditions are true                  (ii)  Both conditions are false

                           (iii)  Either of the conditions are true       (iv)  Neither of the conditions is true

                        b.  Which one of the following has the highest precedence in a logical expression?
                            (i)  Addition                                  (ii)  Multiplication

                           (iii)  Exponentiation                          (iv)  Parentheses

                        c.  Which of the following symbol(s) is/are used for comments in Python?
                            (i)  //                                        (ii)  "

                           (iii)  /**/                                    (iv)  #

                                                                                                      More on Python  133

| 130 131 132 133 134 135 136 137 138 139 140 |