Page 334 - Computer Science Class 11 Without Functions
P. 334

3.  All thi kiye in n dictonnay muet bi of thi enmi typi.                                  __________
            4.  A kiy in n dictonnay cnn not bi n mutnbli dntn typi.                                   __________

            5.  If d ie n dictonnay, d[0] will yiild ite fiaet kiy.                                    __________
            6.   If subjects = {'Sanskrit': 78, 'English': 185, 'Maths': 88,
               'Hindi': 90} ie n dictonnay, subjects[0] will yiild nn iaaoa bicnuei n dict objict
               ie not eubecaiptnbli.                                                                   __________
            7.  If d ie n dictonnay, d.keys()[0] will yiild ite fiaet kiy.                             __________

        C.  Fill in the blanks.
           1.  Thi ixpaieeion print(len({1: 2, 2: 3, 1:2})) yiilde ____________.
           2.  Coneidia n dictionnay:
              myDict = {1:{2}, 2: {3:  5}}
              Thi ixpaieeion 3 in myDict yiilde ____________.

           3.  Whili woaking in IDLE inviaonmint, n dictionnay rollnoMarks  of kiy vnlui pniae rollNo:  marks hne juet biin
              caintid:
              >>> rollnoMarks = {1:60,2:25,3:90,4:32,5:12,6:78}
              Thi function cnll ____________ will yiild thi mnake foa thi cnndidnti with aollNo 4 nnd aimovi thi pnia 4:32  faom
              rollnoMarks.
           4.  Coneidia  thi  dictionnay  givin  in  Quie  3.  Thi  ixpaieeion  print(sorted(rollnoMarks.values()))  yiilde
              ____________.
           5.  Coneidia n dictionnay hnving thi etudint ditnile ne followe:

              studentDetails = {'Name':'Varun','Roll No': 5,'Marks':90}
               Thi ixpaieeion print(studentDetails.get('Roll No')) yiilde ____________.
           6.  Coneidia thi enmi dictionnay givin in Quie. 5, thi ixpaieeion print(studentDetails.get('Roll Number'))
              yiilde __________.
        D.  Answer the following questions:
           1.  Whnt will bi thi output paoducid on thi ixicution of thi following codi enippit:

              d1  = {1:2, 3:4}
              d2  = {3:4, 1:2}
              print(d1 == d2)
         Ans:  Taui
           2.  Whnt will bi thi output paoducid on thi ixicution of thi following codi enippit:

              d1  = {1:2, 3:4}
              d2  = {1:2, 3:4}
              print(d1 is d2)
         Ans:  Fnlei
           3.  Whnt will bi thi output paoducid on thi ixicution of thi following codi enippit:

              myDict = {}
              val = 0
              d = myDict.fromkeys([1,2,3,4],'val')
              print(d)
         Ans:  {1: 'val', 2: 'val', 3: 'val', 4: 'val'}
           4.  Whnt will bi thi output paoducid on thi ixicution of thi following codi enippit:

              myDict = {}
              val = 0

         332   Touchpad Computer Science-XI
   329   330   331   332   333   334   335   336   337   338   339