11. In Python, what is the process of restructuring code while maintaining its original functionality?

  • Refactoring
  • Converting
  • Branching
  • Reprogramming

12. A data professional wants to summarize a function’s behavior and explain its arguments and return values. What should they add to the beginning of the function’s body?

  • An algorithm
  • A logical operator
  • A docstring
  • A comparator

13. What is the Python comparator for equal to?

  • ==
  • <=
  • !=
  • >=

14. A data professional writes the following code: print(33 > 12 or 9 < 7). What result will Python display when they run the code?

  • False
  • Not equal
  • True
  • Equal

15. In Python, when does an if statement execute a piece of code?

  • When the condition evaluates to not equal
  • When the condition evaluates to false
  • When the condition evaluates to equal
  • When the condition evaluates to true

16. Fill in the blank: In Python, the _____ statement sets a piece of code to run only when the condition of the if statement is false.

  • then
  • else
  • elif
  • if

17. A data professional wants to define a function to calculate the square of a number. What code should they begin with?

  • return find_square(n):
  • if find_square(n):
  • def find_square(n):
  • else find_square(n):

18. Fill in the blank: A data professional can use the _____ keyword to make a Python function produce new results and save the results for later use.

  • else
  • return
  • def
  • if

Shuffle Q/A 2

19. What is the term for code that is written to be readable and to make its purpose clear?

  • Self-documenting
  • Branching
  • Immutable
  • Open source

20. A data professional adds a docstring to the beginning of a function’s body. What is the purpose of the docstring?

  • To define the function
  • To summarize the function’s behavior and explain its arguments and return values
  • To make the function produce new results and save the results for later use
  • To run the function and print the results

Leave a Reply