Page 108 - Information_Practice_Fliipbook_Class11
P. 108

7.  Assertion(A):  The following statement will always generate a syntax error.
                          print(India)
              Reasoning(R):   If any statement in a Python program violates the rules of a programming language, it results in a syntax
                          error.
         Ans.  1. c  2. a  3. b  4. b  5. b  6. a  7. d


               Case-based Questions


           1.  Sandeep borrowed Rs 1250000 from his friend at the rate of 9%. He has to return the borrowed amount along with
              interest after three years. Write a program in Python to calculate the simple interest and then display the total amount that
              Sandeep has to pay back to his friend.

         Ans.  principal = 1250000
              rate = 9
              time = 3
              interest = (principal * rate * time)/100
              totalAmount = principal + interest
              print('Sandeep has to pay ',   totalAmount)
                                                                                   2
           2.  According to the theory of special relativity by Albert Einstein, the equation,   E = mc  computes the kinetic energy (E) of
              the body by multiplying the mass (m) of the body by the square of the speed of light (c). Anjum wants to write a Python
                                                                                                    8
              program to implement the above formula by accepting the values of m. He knows that the value of c is 3*10  m/s . Help her
              complete the task.
         Ans:  c =  3*10**8
              mass = int(input('Enter the value of mass in kilograms :  '))
              E =  mass * c * c
              print('The value of kinetic energy is  :  ',   E,   ' Joules')
           3.  Sumbul has just learned about different data types and operators in Python. She has written the following program. Can
              you tell her what outputs she should expect on execution of  this program?
              answer = True
              num = 15.7
              checkValue =  10>=num
              print( checkValue)
              num1 = int(num)
              numStr = str(num)
              print(num1 == num)
              print(num1 == numStr)
         Ans.  False
              False
              False
           4.  Priya has written the following code in Python to print her name. But there is an error in her program. Why do you think
              the program is not correct?
              myName = 'Preya'
              myName[2] = 'i'
              print(myName)
         Ans.  As the string is an immutable data type, the second statement will result in an error.

           5.  Sushant has written a program in Python to understand different types of operators. What output should he expect on its
              execution?
              message = 'Be Simple'
              value  = 25
              M1 = message * 2


          94   Touchpad Informatics Practices-XI
   103   104   105   106   107   108   109   110   111   112   113