Page 373 - Informatics_Practices_Fliipbook_Class12
P. 373

24.  Fill in the blanks in the code snippet given below so that the code outputs 'Dispur'.
                import ___________ as pd

               stateCapitals  = {'Punjab':  Chandigarh',  'Goa':'Panaji',  Assam':  'Dispur',
                'Sikkim':'Gangtok'}
               NP = ___________.Series(___________)

               print(NP[___________])
            25.  Differentiate between entity integrity and referential integrity. Support your answer with suitable examples.
                                                            Section-C
             26.  Consider the table MYPET given below:

                                                          TABLE: MYPET
                    Pet_id       Pet_Name            Breed          LifeSpan        Price          Discount

                      101          Rocky      Labrador Retriever       12           16000             5
                      202          Duke       German Shepherd          13           22000            10

                      303          Oliver     Bulldog                  10           18000             7
                      404         Cooper      Yorkshire Terrier        16           20000            12

                      505          Oscar      Shih Tzu               NULL           25000             8
                 Write the SQL statements to:
                i.  Display the Breed of all the pets in uppercase.

                ii.  Display the total price of all the pets.
                iii.  Display the average life span of all the pets.
                                                               OR
                 Consider the following table PRODUCT:

                                                         Table: PRODUCT
                                        PID          PNAME           PRICE        QUANTITY

                                      P1001       Eraser             10.50            5

                                      P1002       Ball Pen           15.00            2
                                      P1003       Gel Pen            25.10            3

                                      P1004       Ruler               5.00            1
                 What will be the output produced on the execution of following SQL statements?

                i.  SELECT 10+MOD(QUANTITY,3) FROM PRODUCT WHERE PNAME = "Eraser";
                ii.  SELECT ROUND(PRICE,2)*QUANTITY FROM PRODUCT WHERE QUANTITY > 2;
                iii.  SELECT UCASE (RIGHT(PNAME,2)) FROM PRODUCT;
             27.  Write Python code for the following:
                 (a)  Create a dictionary containing names of 5 items and their quantity.
                 (b)  Create a DataFrame df from the dictionary created in part (a).

                 (c)  Display only those items whose quantity is greater than 50.





                                                                                                Practice Paper 2  359
   368   369   370   371   372   373   374   375   376   377   378