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

choice = int(input("Press 1 to enter Event again or 2 to Exit"))
                                  if choice == 1:
                                      continue
                                  else:
                                      return
                              else:
                                  break
                          position = int(input("Enter Position :  "))
                          if position == 1:
                              points = 10
                          elif position == 2:
                              points = 5
                          elif position == 3:
                              points = 3
                          else:
                              points = 0

                          detailList = [eventName, position, points]
                          pointsTally[schoolName] = detailList
                          menu()


                      menu()

                                                           Assessment



                 A.  Multiple Choice questions.
                    1.  Which of the following creates a dictionary?
                      a. dict1 = {'a', 1:'b',2:'c',30:'d',100}
                      b. dict2 = {'a',1:'b',2:'c',30:'d',100}
                      c.  dict3 = {'a':1,'b':2,'c':30,'d':100}
                      d. dict4 = ['a':1,'b':2,'c':30,'d':100]
                    2.  Which of the following data types cannot be used as keys in a dictionary?
                      a.  Tuple                 b. String             c. Integer             d. List
                    3.  The statement d.clear() will ___________________________

                      a.  delete all key-value pairs of the dictionary d
                      b.  delete the dictionary d
                      c.  deletes only last key-value pair of dictionary d
                      d.  result in an error
                    4.  What will be the output produced on the execution of the following code snippet?
                      dictItems = {'Mug':400, 'Book':550, 'Watch':950}
                      print(sorted(dictItems))
                      a.  ['Book', 'Mug', 'Watch']
                      b.  {'Book': 550, 'Mug': 400, 'Watch': 950}
                      c.  {'Mug': 400, 'Book': 550, 'Watch': 950}
                      d.  None of these

                                                                                                        Dictionaries  427
   436   437   438   439   440   441   442   443   444   445   446