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

alpha = alpha + data[c-1] + '!!'
                      beta = beta + data[c]
                  print(alpha, beta, sep='#')

             Ans: WHAT!!IS!!THIS!!#15

                   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):  A list assignment does not create a new copy of the list.
                  Reasoning (R):  List is a mutable data type.
               2.  Assertion(A):  '+' is an operator that can be used to concatenate a pair of lists.
                  Reasoning(R):  + is a generic operator for concatenating lists, strings, and tuples.
               3.  Assertion(A):  The method extend() can insert elements at any position in the list.
                  Reasoning(R):  extend() only takes an iterable sequence as an argument.
             Ans.  1. a  2. a  3. d


                  Case Based Questions


               1.  Avantika is a fashion designer and has to present her designs at an upcoming exhibition. She wants to maintain a fixed list
                  of categories of clothing that she would like to exhibit. These categories are:
                  ●  Wedding collection (wedding)
                  ●  Casual Wear (casual)
                  ●  Party Wear (party)
                  ●  Sports Wear (sports)
                  Avantika wants to be able to enter the type of clothing for several pieces of clothing and finally see on the screen the
                  number of clothing items in each category. As a software developer, help her do this job. If a clothing item is not from one
                  of the mentioned categories, then an appropriate error message should be displayed.
                  Approach:
                  a.  First create a tuple of categories:
                     clothCategory = ('wedding', 'casual', 'party', 'sports')
                  b.  Intialise count of each type of clothing to 0:
                     countW,countC, countP, countS  = 0, 0, 0, 0
                  c.  For each input (type of clothing):
                     i.  If in the clothCategory, increment the appropriate count
                     ii. Otherwise print an error message

             Ans:  '''
                  Objective: To count clothing for each category
                  Input: clothing ids, clothing names, and clothing categories
                  Output: category-wise count
                  '''
                  clothCategory = ('wedding collection', 'casual wear', 'party wear', 'sports wear')


                                                                                                Lists and Tuples  311
   308   309   310   311   312   313   314   315   316   317   318