31. Which of the following calls to the sorted() function uses correct syntax?

  • sorted([532, 73, 85])
  • sorted[73, 85, 532]
  • sorted[(85, 523, 73)]
  • sorted():

32. In the following code, what is the argument?

def welcome_user(name):

print("Welcome," name)

username="elarson"

welcome_user(username)

  • welcome_user
  • def
  • name
  • username

33. When working in Python, what is a library?

  • A collection of modules that provide code users can access in their programs
  • A module that allows you to work with a particular type of file
  • A Python file that contains additional functions, variables, classes, and any kind of runnable code
  • A collection of stylistic guidelines for working with Python

34. What is returned from the following user-defined function if you pass it the argument of 2?

def multiples(num):
multiple = num * 3
return num
multiples(2)

  • multiples
  • 6
  • num
  • 2

35. What is an advantage of including this comment in the following code? Select all that apply.

# For loop iterates to print an alert message 5 times

for i in range(5):

print("alert")

  • It ensures the loop will function when the code is run in Python.
  • It can help other programmers understand the purpose of this loop.
  • It can help you understand the code if you revisit it in the future.
  • It is displayed in the output when the code is run in Python.

36. Which of the following statements accurately describe functions? Select all that apply.

  • Functions can be used no more than 10 times from within a single program.
  • When functions are updated, the changes are applied everywhere they are used.
  • Functions are useful for automation.
  • Functions can be reused throughout a program.

37. What does this line of code return?

print(sorted(["h32rb17", "p52jb81", "k11ry83"]))

  • [“h32rb17”, “k11ry83”, “p52jb81”]
  • [“p52jb81”]
  • [“p52jb81”, “k11ry83”, “h32rb17”]
  • [“h32rb17”]

Leave a Reply