21. What is a function?

  • A Python file that contains runnable code
  • A reusable section of code
  • A set of stylistic guidelines for working in Python
  • A downloadable resource with code instructions

22. Fill in the blank: A Python file that contains additional functions, variables, classes, and any kind of runnable code is called a _____.

  • parameter
  • library
  • module
  • built-in function

23. Which of the following choices is a valid header in a function definition?

  • def remove_user(username):
  • def remove_user(username)
  • remove_user(username):
  • def (remove_user(username))

24. Fill in the blank: A collection of modules that users can access in their programs is a _____.

  • style guide
  • built-in function
  • library
  • user-defined function

25. What does this line of code return?

print(type("h32rb17"))

  • int
  • “h32rb17”
  • str
  • h32rb17

26. What is returned from the following user-defined function if you pass it the argument "John"?

def greet(name):
greeting = "Hello"
return name
greet("John")

  • “John”
  • name
  • “Hello, John”
  • “Hello John”

27. What can a style guide help you with when working with Python? Select two answers.

  • Making it easier for other programmers to understand your code
  • Finding new modules you can incorporate into your code
  • Finding ways to make your code more complex
  • Making your code more consistent

28. Why are comments useful? Select three answers.

  • They explain the code to other programmers.
  • They make debugging easier later on.
  • They provide insight on what the code does.
  • They make the code run faster.

Shuffle Q/A 3

29. What are built-in functions?

  • Functions that return information
  • Functions that exist with Python and can be called directly
  • Functions that take parameters
  • Functions that a programmer builds for their specific needs

30. You imported a Python module, what do you now have access to in Python?

  • A manual that informs the writing, formatting, and design of documents
  • A function that exists within Python and can be called directly
  • A list of comments that you have included in previous code
  • Additional functions, variables, classes, and other kinds of runnable code

Leave a Reply