Page 317 - Touhpad Ai
P. 317

ss_res = np.sum((mpg - y_pred) ** 2)
                               r2 = 1 - (ss_res / ss_total)

                               print(f”Model R² (Goodness of Fit): {r2:.3f}»)
                 Question 7                                                                                          (10)
                    34.  Add the following matrices and give the transpose of the sum.
                             2   4   8             5   3 –3
                        A =  –1  0   7        B =  9   1   4
                             3   5 –2              6   2   0
                        Study the following data of 10 students on “Daily Time Spent in Physical Exercise (in minutes)”

                             7   7   5             7   8   9
                        A =  8    1  1        S  =  7  1   7
                                               T
                             9   7  –2             5   1  –2


                                                       Student Name      Time (minutes)
                                                             A                 20
                                                             B                 35
                                                            C                  25
                                                             D                 40
                                                             E                 30
                                                             F                 45
                                                            G                  25
                                                             H                 30
                                                             I                 20
                                                             J                 35
                         a.   Calculate the mean, variance, and standard deviation of the data.
                         b.   What can you infer from the variance?
                        Ans.  a.  Mean = 30.5 Variance = 62.25 Standard Deviation = 7.89

                             b.   The variance (62.25) and standard deviation (7.89) show that students’ exercise times vary quite a
                                lot. Some students exercise for very short durations, while others spend much longer — indicating high
                                variation in daily fitness habits.

                    35.  Describe any 2 types of joins.
                        Ans.  INNER Join - Those records are selected that have matching values in both tables.  INNER JOIN
                             In an inner join, only those tuples that satisfy the matching condition are included,
                                                                                                             left    right
                             while the remaining tuples are excluded.                                       table    table
                             Syntax : SELECT table1.column1,table1.column2,table2.column1,....
                             FROM table1

                             INNER JOIN table2
                             ON table1.matching_column = table2.matching_column;
                             where table1: First table, table2: Second table and matching_column: Column common to both the
                             tables.
                             LEFT (OUTER) JOIN: This join returns all records from the left table, and the matching records from the
                             right table



                                                                                             Sample Question Paper  315
   312   313   314   315   316   317   318   319   320   321   322