Page 7 - IPP-12-2024
P. 7

22.  WAP to create the following series that stores the number of employees working in different departments
                    using a dictionary. Assume department names are Sales, Inventory, Marketing and Admin having 50, 25,
                    78 and 12 employees respectively.                                                         [2]
                Ans.  import pandas as pd
                     d = {'Sales':50, 'Inventory':25, 'Marketing':78, 'Admin':12}
                     s=pd.Series(d)
                     print(s)
                 23.  List any four benefits of E-waste Management.                                            [2]
                                                               Or
                      Mention any four Netiquette.
                Ans.  Four benefits of E-waste Management are:
                      (i)  Saves the environment and natural resources
                      (ii)  Allows for recovery of precious metals
                      (iii)  Protects public health and water quality
                      (iv)  Saves landfill space
                                                               Or
                      Four Netiquette are:
                      (i)  No copyright violation
                      (ii)  Share the expertise with others on the internet
                      (iii)  Avoid cyberbullying
                      (iv)  Respect other’s privacy and diversity
                 24.  Consider the following series:                                                          [2]
                    s=pd.Series([31,28,31,30,31],index=['Jan','Feb','Mar','Apr','May'])
                      What will be the output of the following statements?
                      (a)  print(s[s>30])               (b)  print(s['Jan':'Apr'])

                Ans.  (a)  Jan 31                       (b)  Jan 31
                         Mar 31                              Feb 28
                        May 31                               Mar 31
                        dtype: int64                         Apr 30
                                                             dtype: int64
                 25.  Manik needs to display the first three characters of the student’s name who has not paid the fees. He is
                    encountering an error while executing the following query:                                [2]
                    SELECT RIGHT(NAME, 3) FROM STUDENT WHERE FEES = NULL;
                      Help him in identifying the reason for the error(s) and write the correct query by suggesting possible
                    correction(s).
                Ans.  The problems with the given SQL query are—
                      (i)  To display the first three characters, the left() function should be used.
                      (ii)  The = operator should not be used with NULL keyword.
                      Corrected Query is:
                    SELECT LEFT(NAME, 3) FROM STUDENT WHERE FEES IS NULL;

                                                            Section C
                 26.  Write outputs for SQL queries (i) to (iii) which are based on the given table COURSE.     [3]
                          CID          CNAME          FEES        STARTDATE         TID
                         C201          PGDCA          12000       2018-07-02        101
                         C202           ADCA          15000       2018-08-15        103
                         C203           DCA           10000       2018-10-01        102
                         C204           DDTP          9000        2018-09-15        104
                         C205           DHN           20000       2018-08-01        101
                         C206         O LEVEL         18567       2018-07-25        105



                                                                                         Appendices          A.29
   2   3   4   5   6   7   8   9   10   11   12