21. Where are modules accessed in Python?

  • Within a set
  • Within a global variable
  • Within a package or library
  • Within a dictionary

22. Fill in the blank: A _____ NumPy array can be created from a list of lists, where each internal list is the same length.

  • four-dimensional
  • one-dimensional
  • three-dimensional
  • two-dimensional

23. A data professional is working with a pandas dataframe named sales that contains sales data for a retail website. They want to know the price of the least expensive item. What code can they use to calculate the minimum value of the Price column?

  • sales[‘Price’].min()
  • sales.min().(Price)
  • sales = ‘Price’.min()
  • sales.min().Price

24. In pandas, what is the difference between the iloc[] and loc[] methods?

  • iloc[] merges two dataframes vertically; loc[] merges two dataframes horizontally.
  • iloc[] selects dataframe rows and columns by name; loc[] selects dataframe rows and columns by index.
  • iloc[] merges two dataframes horizontally; loc[] merges two dataframes vertically.
  • iloc[] selects dataframe rows and columns by index; loc[] selects dataframe rows and columns by name.

25. A data professional wants to merge two pandas dataframes. They want to join the data so only the keys that are in both dataframes get included in the merge. What technique can they use to do so?

  • Inner join
  • Outer join
  • Right join
  • Left join

26. In Python, what data structure helps store and manipulate an ordered collection of items?

  • Tuple
  • Dictionary
  • Set
  • List

27. A data professional is working with a list named cities that contains data on global cities. The string 'Houston' is the third element in the list. What Python code can they use to remove the string 'Houston' from the list?

  • cities.pop(2)
  • cities.pop(4)
  • cities.pop(3)
  • cities.pop(1)

28. A data professional is working with a dictionary named employees that contains employee data for a healthcare company. What Python code can they use to retrieve only the dictionary’s values?

  • values.employees()
  • items.employees()
  • employees.items()
  • employees.values()

Shuffle Q/A 3

29. A data professional is working with two Python sets. What function can they use to find elements from both sets that are mutually not present in the other?

  • union()
  • difference()
  • intersection()
  • symmetric_difference()

30. Fill in the blank: In Python, _____ typically contain a collection of functions and global variables.

  • modules
  • logical operators
  • keywords
  • comparators

Leave a Reply