Page 192 - Computer Science V2.0 Class 11
P. 192

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
                    V1 = value * 2
                    M2 = message + '2'
                    V2 = value + 2
                    print(M1,   M2,   sep = '##')
                    print(V1,  V2,  sep = '@@')

               Ans.  Be SimpleBe Simple##Be Simple2
                    50@@27


                                                       Assessment


              A.  Multiple Choice questions.
                 1.  Which of the following statements will result in an error?
                    a.  number = 07          b. number = 70         c. number = '07'      d. number = '70'
                 2.  Which of the following is a hexadecimal number?
                    a.  x0123                b. 0x123               c. 123x0              d. 1230x
                 3.  Which of the following is equivalent to 1E2?
                    a.  100.0                b. 10.0                c. 1.0                d. 1000.0

                 4.  Which of the following is NOT a sequence data type?
                    a.  String               b. Tuple               c. Dictionary         d. List

                 5.  Which of the following pair of  symbols is used to enclose values in a tuple?
                    a.  []                   b. {}                  c. <>                 d. ()

                 6.  Which of the following data types does not support operatiors?
                    a.  Set                  b. None                c. Dictionary         d. List

                 7.  Which of the following operators has the highest precedence?
                    a.  +                    b. %                   c. or                 d. =

                 8.  Which of the following statements  makes use of typecasting?
                    a.  num = 10.7 + 40.6    b. num = 3+4j          c. num = 10.7 + 40    d. num = 3 + 4

                 9.  Which of the following statements will result in a syntax error?
                    a.  num = int(input('Enter a number'))          b. num = input('Enter a number')
                    c.  num = input(int('Enter a number'))          d. num = float(input('Enter a string'))




               178   Touchpad Computer Science (Ver. 2.0)-XI
   187   188   189   190   191   192   193   194   195   196   197