Python, Variables, and Functions Quiz Answer

Python, Variables, and Functions Quiz Answer

Learn to Program: The Fundamentals Week 1 Quiz Answer

 
In this article i am gone share Coursera Course: Learn to Program: The Fundamentals Week 1 | Python, Variables, and Functions Quiz Answer with you.
 
 

Python, Variables, and Functions

Question 1)
Read the description given by
 
help(round)
 
Then select the function call(s) below that run without error. You can check your answers by running the code in the Python Shell.
  • round(45.345, 2)
  • round(45)
  • round()
  • round(45.345, 2, 5)
  • round(45.8)
 
 
Question 2)
What type of value does built-in function \color{black}{\verb|id|}id return? Determine the answer using the description given by
 
help(id)
 
  • int
  • float
 
 
Question 3)
Consider this code:
 
x = 12 / 3
 
What value does x refer to?
 
Answer: 4.0
 
 
Question 4)
Consider this code:
 
x = 8 / 4
 
What value does x refer to?
 
Answer: 2.0
 
 
 
Question 5)
Consider this code:
 
x = 12 // 3
 
What value does x refer to?
 
Answer: 4
 
 
Question 6)
Consider this code:
 
x = 8 // 4
 
What value does x refer to?
 
Answer: 2
 
 
 
Question 7)
Consider this code:
x = 3
y = 5
x = y 
After the code above has executed, what value does x refer to?
 
Answer: 5
 
 
 
Question 8)
Consider this code:
x = 3
y = 5
x = y 
After the code above has executed, what value does y refer to?
 
Answer: 5
 
 
 
Question 9)
Consider this code:
apple = banana
When the code above is executed, what type of error occurs?
  • NameError
  • SyntaxError
 
Question 10)
Consider this code:
8 = x
When the code above is executed, what type of error occurs?
  • SyntaxError
  • NameError
 
Question 11)
Consider this code:
 
def f(data):
    return data * 0.5
 
Select the phrase that describes \color{black}{\verb|data|}data.
  • a parameter
  • an argument
  • a function name
 
 
Question 12)
Consider this code:
def g(a, b):
    c = a + b
    return c 
How many parameters does function \color{black}{\verb|g|}g have?
  • 0
  • 3
  • 2
  • 1
 
 
Question 13)
Consider this code:
def example(a, b, c):
    d = a + b – c
    return d 
How many parameters does function \color{black}{\verb|g|}g have?
  • 0
  • 3
  • 2
  • 1
 
 
Question 14)
Consider this code:
 
data = 3
data2 = 7.5
result = min(data, data2)
 
Select the phrase that describes data in the third line.
  • an argument
  • a function name
  • a parameter
Question 15)
Consider this code:
value = 8.564
result = round(value)
Select the phrase that describes value in the second line.
  • an argument
  • a parameter
  • a function name
Question 16)
Consider this code:
round(45.342)
What value does the expression above produce?
 
Answer: 45
 
 
 
Question 17)
Consider this code:
 
def bigger(x):
    return x ** x
 
bigger(12)
 
Which value does \color{black}{\verb|bigger(12)|}bigger(12) produce?
  • 302875106592253
  • 11112006825558016
  • 8916100448256
  • 285311670611
 
 
Question 18)
Consider this code:
 
def even_bigger(x):
    return (2 * x) ** x
 
even_bigger(12)
 
Which value does even_bigger(12) produce?
  • 10240000000000
  • 2481152873203736576
  • 36520347436056576
  • 584318301411328
 
 

Leave a Comment