Practice Quiz: Slow Code

6. Which of the following is NOT considered an expensive operation?

  • Parsing a file
  • Downloading data over the network
  • Going through a list
  • Using a dictionary

7. Which of the following may be the most expensive to carry out in most automation tasks in a script?

  • Loops
  • Lists
  • Vector
  • Hash

8. Which of the following statements represents the most sound advice when writing scripts?

  • Aim for every speed advantage you can get in your code
  • Use expensive operations often
  • Start by writing clear code, then speed it up only if necessary
  • Use loops as often as possible

9. In Python, what is a data structure that stores multiple pieces of data, in order, which can be changed later?

  • A hash
  • Dictionaries
  • Lists
  • Tuples

10. What command, keyword, module, or tool can be used to measure the amount of time it takes for an operation or program to execute? (Check all that apply)

  • time
  • kcachegrind
  • cProfile
  • break

Devendra Kumar

Project Management Apprentice at Google

Leave a Reply