get started with python coursera week 4 quiz answers

Test your knowledge: Lists and tuples

1. Lists and their contents are immutable, so their elements cannot be modified, added, or removed.

  • True
  • False

2. What Python method adds an element to the end of a list?

  • append()
  • type()
  • pop()
  • remove()

3. A data professional wants to instantiate a tuple. What Python elements can they use to do so? Select all that apply.

  • The tuple() function
  • Parentheses
  • The insert() function
  • Square brackets

4. What Python technique formulaically creates a new list based on the values in an existing list?

  • List comprehension
  • List conversion
  • List sequencing
  • List nesting

Test your knowledge: Dictionaries and sets

5. Fill in the blank: In Python, a dictionary’s _____ must be immutable.

  • sets
  • lists
  • keys
  • order

6. In Python, what does the items() method retrieve?

  • Both a dictionary’s keys and values
  • Only a dictionary’s keys
  • A dictionary’s sets
  • Only a dictionary’s values

7. A data professional is working with two Python sets. What function can they use to find all the elements from both sets?

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

Test your knowledge: Arrays and vectors with NumPy

8. Python libraries and packages include which of the following features? Select all that apply.

  • Documentation
  • Reusable collections of code
  • Cells
  • Modules

Shuffle Q/A 1

9. What is the core data structure of NumPy?

  • Dictionary
  • Global variable
  • Array
  • List

10. A data professional wants to confirm the number of dimensions of an array. What NumPy attribute can they use to do so?

  • shape
  • ndim
  • dimension
  • dtype

Leave a Reply