Page 6 - PYTHON-12
P. 6

14.  What will be the output of the following query?                                          (1)

                 SELECT AVG(salary) FROM Employees WHERE department = 'HR';
                  (a)  The average salary of all employees in the Employees table.
                  (b)  The average salary of employees whose department is ‘HR’, including those with NULL values for salary.
                  (c)  The average salary of employees whose department is ‘HR’, excluding NULL values for salary.
                  (d)  The total salary of all employees in the Employees table whose department is ‘HR’.
             Ans.  (c)  The average salary of employees whose department is ‘HR’, excluding NULL values for salary.
              15.  In a table in MySQL database, an attribute X of datatype varchar(15) has the value ‘Computer’. The attribute
                 Y of datatype char(15) has the value ‘Science’. How many characters are occupied by attribute X and
                 attribute Y?                                                                               (1)
                  (a)  15, 7                                (b)  8, 15
                  (c)  8, 7                                 (d)  7, 8
             Ans.  (b)  8, 15
              16.  What does COUNT() function return when used as COUNT(*) with SQL SELECT statement?       (1)
                  (a)  The number of distinct rows
                  (b)  The sum of all values
                  (c)  The number of non-NULL values
                  (d)  The total number of rows in the table, including NULL values
             Ans.  (d)  The total number of rows in the table, including NULL values
              17.  Which type of network topology has a central hub or switch?                              (1)
                  (a)  Mesh Topology                        (b)  Bus Topology
                  (c)  Star Topology                        (d)  Ring Topology
             Ans.  (c)  Star Topology
              18.  Which device can selectively forward data based on MAC address, thereby reducing unnecessary traffic?  (1)
                  (a)  Bridge                               (b)  Switch
                  (c)  Router                               (b)  Hub
             Ans.  (a)  Bridge
              19.  Why is a switch called an intelligent hub?                                               (1)
             Ans.  A switch is called an intelligent hub because it forwards the message across a network only to the intended node.

            Q.20 and 21 are Assertion and Reasoning based questions. Mark the correct choice as:
              (a)  Both A and R are true and R is the correct explanation for A.
              (b)  Both A and R are true but R is not the correct explanation for A.
              (c)  A is true but R is false.
              (d)  A is false but R is true.

              20.  Assertion (A): A function in Python can be called before it is defined in the code.
                 Reason (R): Python uses a top-down approach for code execution.                            (1)
             Ans.  (d)  A is false but R is true
              21.  Assertion (A): A foreign key establishes a relationship between two tables.
                 Reason (R): A foreign key must contain unique values in the parent table.                  (1)
             Ans.  (b)  Both A and R are true but R is not the correct explanation for A.

                                                         Section B
              22.  Why are lists called mutable data type? Explain with examples.                           (2)
             Ans.  Lists are called mutable data type because the values in a list can be changed or modified and can be accessed
                 using the index value enclosed within square brackets.
                  For example:
                 L = [1,3,6,7,98]
                 L[2] = 56
                  The new list is L = [1,3,56,7,98].


                       Appendices                                                                          A.37
   1   2   3   4   5   6   7   8   9   10   11