Notice: Due to an ongoing migration of our storage and publishing system, material requested since last month will not be uploaded for the time being, and new requests are paused. All existing notes remain available.

Unit 5 MCQs Handling Data with Pandas; Data Visualisation with Matplotlib

ECE181 — Introduction To Python 60 questions. Pick an option to check it.

Read the notes Subjective questions

0 of 60 answered 0 right 0 wrong , 60 left

  1. Question 1 of 60 introduction to pandas Easy

    What is Pandas primarily used for in Python?

  2. Question 2 of 60 introduction to pandas Easy

    Which is the conventional way to import the Pandas library?

  3. Question 3 of 60 introduction to pandas Easy

    Pandas is built on top of which numerical computing library?

  4. Question 4 of 60 series Easy

    A Pandas Series is best described as a:

  5. Question 5 of 60 series Easy

    Which function is used to create a Pandas Series?

  6. Question 6 of 60 series Easy

    What is the default index for a Series created from a list of 4 elements?

  7. Question 7 of 60 dataframe Easy

    A Pandas DataFrame is a:

  8. Question 8 of 60 dataframe Easy

    Which method displays the first 5 rows of a DataFrame df by default?

  9. Question 9 of 60 dataframe Easy

    Which attribute gives the number of rows and columns of a DataFrame as a tuple?

  10. Question 10 of 60 working with csv files Easy

    Which Pandas function reads data from a CSV file into a DataFrame?

  11. Question 11 of 60 working with csv files Easy

    Which method writes a DataFrame df to a CSV file?

  12. Question 12 of 60 working with csv files Easy

    What does CSV stand for?

  13. Question 13 of 60 operations using dataframes Easy

    Which method provides summary statistics like mean, min, and max for numeric columns?

  14. Question 14 of 60 operations using dataframes Easy

    How do you select a single column named age from a DataFrame df?

  15. Question 15 of 60 operations using dataframes Easy

    Which method is used to remove rows containing missing (NaN) values?

  16. Question 16 of 60 line plots Easy

    Which Matplotlib function is used to create a line plot?

  17. Question 17 of 60 multiple subplots in one figure Easy

    Which function creates a figure with multiple subplots at once?

  18. Question 18 of 60 histograms Easy

    A histogram is mainly used to show the:

  19. Question 19 of 60 bar charts Easy

    Which Matplotlib function creates a vertical bar chart?

  20. Question 20 of 60 pie charts Easy

    A pie chart is best suited for showing:

  21. Question 21 of 60 introduction to pandas Medium

    You import pandas using import pandas as pd. Which statement correctly describes why pandas is preferred over plain Python lists for tabular data analysis?

  22. Question 22 of 60 series Medium

    Given s = pd.Series([10, 20, 30], index=['a', 'b', 'c']), what does s['b'] return?

  23. Question 23 of 60 series Medium

    What is the result of pd.Series([1, 2, 3]) + pd.Series([10, 20], index=[0, 2])?

  24. Question 24 of 60 dataframe Medium

    For a DataFrame df, which expression selects only the rows where the column age is greater than 30?

  25. Question 25 of 60 dataframe Medium

    What does df.shape return for a DataFrame with 100 rows and 5 columns?

  26. Question 26 of 60 dataframe Medium

    Which method would you use to view the first 5 rows of a DataFrame df?

  27. Question 27 of 60 working with csv files Medium

    You have a CSV file where columns are separated by semicolons (;). Which call reads it correctly?

  28. Question 28 of 60 working with csv files Medium

    You want to save a DataFrame df to a CSV file without writing the index column. Which call is correct?

  29. Question 29 of 60 working with csv files Medium

    When reading a CSV that has no header row, which argument ensures pandas does not treat the first data row as column names?

  30. Question 30 of 60 operations using dataframes Medium

    Given a DataFrame df with a numeric column sales, which expression computes the average of that column?

  31. Question 31 of 60 operations using dataframes Medium

    What does df.groupby('city')['sales'].sum() produce?

  32. Question 32 of 60 operations using dataframes Medium

    Which method returns the count of missing (NaN) values in each column of a DataFrame df?

  33. Question 33 of 60 operations using dataframes Medium

    You want to create a new column total equal to price multiplied by quantity. Which statement is correct?

  34. Question 34 of 60 line plots Medium

    Using matplotlib, which pair of calls plots y against x as a line and then displays it?

  35. Question 35 of 60 line plots Medium

    In plt.plot(x, y, 'r--'), what does the format string 'r--' specify?

  36. Question 36 of 60 multiple subplots in one figure Medium

    Which call creates a figure with a 2-row by 2-column grid of subplots?

  37. Question 37 of 60 multiple subplots in one figure Medium

    After fig, axes = plt.subplots(2, 2), how do you draw on the subplot in the bottom-right corner?

  38. Question 38 of 60 histograms Medium

    Which parameter of plt.hist(data, bins=20) controls the number of intervals the data range is divided into?

  39. Question 39 of 60 histograms Medium

    A histogram is most appropriate for visualizing which of the following?

  40. Question 40 of 60 bar charts Medium

    You have categories in a list cats and their counts in vals. Which call creates a vertical bar chart?

  41. Question 41 of 60 series Hard

    Given s = pd.Series([10, 20, 30], index=['a', 'b', 'c']), what does s[0:2] return compared to s['a':'b']?

  42. Question 42 of 60 dataframe Hard

    For a DataFrame df, which statement correctly distinguishes df.loc[] from df.iloc[] when the index is [2, 0, 1]?

  43. Question 43 of 60 operations using dataframes Hard

    Given df1 with index ['a','b'] and df2 with index ['b','c'], what is the result of df1 + df2 for overlapping and non-overlapping labels?

  44. Question 44 of 60 working with csv files Hard

    A CSV has a column of integers but some cells are empty. After pd.read_csv('data.csv'), what dtype does that column typically have and why?

  45. Question 45 of 60 operations using dataframes Hard

    For a numeric DataFrame df, how do df.apply(np.sum, axis=0) and df.apply(np.sum, axis=1) differ?

  46. Question 46 of 60 dataframe Hard

    What is the key behavioral difference between df.dropna(how='all') and df.dropna(how='any') (default)?

  47. Question 47 of 60 line plots Hard

    When plotting plt.plot(x, y1); plt.plot(x, y2) on the same axes without specifying colors, what happens?

  48. Question 48 of 60 multiple subplots in one figure Hard

    Using fig, ax = plt.subplots(2, 2), how should you correctly access the subplot in the bottom-right position?

  49. Question 49 of 60 histograms Hard

    For plt.hist(data, bins=10) on data ranging from 0 to 100, what determines each bin's width and count?

  50. Question 50 of 60 bar charts Hard

    What is the fundamental difference between plt.bar() and plt.hist()?

  51. Question 51 of 60 pie charts Hard

    In plt.pie(sizes, autopct='%1.1f%%'), what does autopct control and how are wedge sizes determined?

  52. Question 52 of 60 introduction to pandas Hard

    Why can a pandas Series hold heterogeneous data more flexibly than a plain NumPy array of a fixed numeric dtype?

  53. Question 53 of 60 operations using dataframes Hard

    Given df.groupby('cat')['val'].transform('mean'), how does its output differ from df.groupby('cat')['val'].mean()?

  54. Question 54 of 60 working with csv files Hard

    What is the effect of pd.read_csv('data.csv', index_col=0) versus omitting index_col?

  55. Question 55 of 60 dataframe Hard

    Which comparison of df['col'] and df[['col']] is correct?

  56. Question 56 of 60 multiple subplots in one figure Hard

    When fig, axes = plt.subplots(1, 3, sharey=True) is used, what does sharey=True accomplish?

  57. Question 57 of 60 series Hard

    For s = pd.Series([1, 2, 3]), why does s + pd.Series([1, 2, 3], index=[1, 2, 3]) produce NaN values?

  58. Question 58 of 60 histograms Hard

    In plt.hist(data, bins=20, density=True), what does density=True change about the y-axis?

  59. Question 59 of 60 line plots Hard

    Given time-series x values that are unsorted, what visual artifact does plt.plot(x, y) produce and why?

  60. Question 60 of 60 operations using dataframes Hard

    What does df.merge(other, on='key', how='outer') produce compared to how='inner'?

That's unit 5

Answer a few questions and your score shows up here.