Page 239 - AI Ver 3.0 Class 11
P. 239

4.   Which punctuator is used in Python for accessing attributes and methods of objects?
                        a.   Comma (,)                                   b.  Period (.)
                        c.   Colon (:)                                   d.  Semicolon (;)

                    5.   Which punctuator is used to separate statements on the same line in Python?
                        a.   Semicolon (;)                               b.  Period (.)
                        c.   Newline                                     d.  Comma (,)

                    6.   How many times will the while loop execute in the following program?
                        number = int(input("Enter a number to print its multiplication table: "))
                        counter = 1
                        print("Multiplication table of", number, ":")
                        while counter <= 10:
                            print(number, "x", counter, "=", number * counter)
                            counter += 1
                        a.   9                                           b.  10
                        c.  11                                           d.  0

                    7.   How do you write multiple rows to a CSV file in Python?
                        a.   writer.writerow(data)                       b.  writer.write(data)
                        c.   writer.writerows(data)                      d.  writer.writemultiple(data)

                    8.   What would be the output of the following code?
                        import numpy as np
                        arr_2d = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
                        print(arr_2d)
                        a.   [1 2 3] [4 5 6] [7 8 9]                     b.  (1 2 3) (4 5 6) (7 8 9)
                        c.   [[1 2 3] [4 5 6] [7 8 9]]                   d.  [[1, 2, 3], [4, 5, 6], [7, 8, 9]]

                    9.   What is the main purpose of the Pandas library?
                        a.  Web development                              b.  Data manipulation and analysis
                        c.   Game development                            d.  Graphics design
                    10.   What are the two main data structures provided by Pandas?
                        a.  List and Tuple                               b. Array and Matrix

                        c.   Series and DataFrame                        d.  Dictionary and Set
                    11.   How do you select the second row from a DataFrame using the .iloc[ ] method?
                        a.   df.loc[1]                                   b.  df.iloc[1]

                        c.   df.iloc[2]                                  d.  df.select[1]
                    12.   How can you add a new column to the end of a DataFrame in pandas?
                        a.   Using the append() method

                        b.  Using the insert() method
                        c.   Using the concat() method
                        d.  Directly assigning values to a new column using dataframe's bracket notation






                                                                                         Python Programming     237
   234   235   236   237   238   239   240   241   242   243   244