Page 173 - Computer Science Class 11 With Functions
P. 173

9.  What is the difference between a list and a tuple
             Ans.   (i)  A list is enclosed in [] while a tuple is enclosed in ()
                  (ii)  A list is mutable while a tuple is immutable
              10.  What is the difference between unary and binary operators?
             Ans.  A unary operator takes one operand while a binary operator takes two operands.
              11.  What will be the output when the following expressions are evaluated?
                      (i)  33 * 5/6 + 1
                     (ii)  2 * (22//7) * 5
                    (iii)  10 ** 2 - 45 / 6
                    (iv)  "SUN" + "MOON"
                     (v)  45 % 3 > 8 and 23 // 6
                    (vi)  (90 - 3 // 5) > 5 or 2 ** 3 > 5
                   (vii)  not True or False and True
                  (viii)  "TOWER" * 3
             Ans.     (i)  28.5
                    (ii)  30

                   (iii)  92.5
                   (iv)  'SUNMOON'
                    (v)  False
                   (vi)  True

                  (vii)  False
                  (viii) 'TOWERTOWERTOWER'
              12.  Identify the errors in the given code:
                 radius = input("Enter a number")
                 area = 3.14*Radius**2
                 PRINT("The area is" + area)
             Ans.  radius = int(input("Enter a number") ) ………int() should be used
                  area = 3.14*radius**2                       ………wrong variable name
                  print("The area is " , area)                ………wrong function name and usage
              13.  Write a program that takes the temperature in Celsius and displays it in Fahrenheit.
             Ans.  #Objective: Given temperature in degree Celcius. Display in fahrenheit.
                  celcius = float(input("Enter temperature in degree Celcius : "))
                  F = celcius * 9 / 5 + 32
                  print("The temperature in degree Fahrenheit is  : ", F)

                   Assertion and Reasoning Based Questions



                  The following questions are assertion(A) and reasoning(R) based. Mark the correct choice as
                  a.  Both A and R are true and R is the correct explanation of A
                  b.  Both A and R are true and R is not the correct explanation of A
                  c.  A is true but R is false
                  d.  A is false but R is true
               1.  Assertion(A):  0x876 is a hexadecimal number
                  Reasoning(R):  The computer understands only hexadecimal number system.


                                                                                        Data Types and Operators  171
   168   169   170   171   172   173   174   175   176   177   178