Page 57 - Computer - 7
P. 57

  Python provides int( ), float( ), and str( ) functions to convert one type of data into another.
              Operators are special symbols that are used to perform a mathematical operation or logical

                computation.
              Operators available in Python can be categorised as Arithmetic, Assignment, Relational, Logical,
                and String operators.
              Precedence of operators defines the order of evaluation of the operators in an expression.


                                                  INFO RETENTION
                                                  INFO RETENTION


          A.   Select the correct option for each of the following statements.
              1.   In Python, the output of the expression 24 % 3 will be ______.
                  (a)  8                   (b)  0                   (c)  24                 (d)  3

              2.  The operators that combine two expressions involving relational operators are ______.
                  (a)  Logical             (b)  String              (c)  Arithmetic         (d)  Assignment
              3.  If the value of a variable Num is 25, what will be its value after the statement Num *= 4 is
                  executed?
                  (a)  29                  (b)  21                  (c)  100                (d)  6.25
              4.  Which of the following operators has the highest precedence?
                  (a)  Subtraction         (b)  Division            (c)  Multiplication     (d)  Exponentiation
              5.  The Floor division operator is represented by ______.
                  (a)  %                   (b)  //                  (c)  **                 (d)  #

          B.  Fill in the blanks with the correct answer.
              1.  The _________ operator repeats a string a specified number of times.
              2.  The values on which operators perform tasks are called _________.
              3.  The _________ logical operator reverses the value of an expression.
              4.  The _________ function is used to convert a string data into its corresponding integer value.
              5.  The _________ data type stores the values True and False.

          C.  Write ‘T’ for True and ‘F’ for False statement.
              1.  The Concatenation operator is used to add two numeric values.                              _______
              2.  Multi-line comments in Python are enclosed within double quotes.                           _______
              3.  Arithmetic calculations can be performed on float data.                                    _______
              4.  The input( ) function treats all data as string.                                           _______
              5.  The Logical operator OR returns the value False if any one of the expressions              _______
                  evaluates to True.
          D.  Answer the following questions.
              1.  What are operators? Describe the different types of operators used in Python.
              2.  What is the difference between print( ) and input( ) function.

              3.  What is a data type? Explain the common data types available in Python with an example of each.
              4.  What is precedence of operators? What is its purpose?


                                                                                                              55
   52   53   54   55   56   57   58   59   60   61   62