All Coursera Quiz Answers

End-of-Course Graded Assessment: Using Python Quiz Answers

In this article i am gone to share Coursera Course: Programming in Python by Meta Week 5 | End-of-Course Graded Assessment: Using Python Quiz Answers with you..

 

End-of-Course Graded Assessment: Using Python Quiz Answers

Question 1)
Python is an interpreted language. Which of the following statements correctly describes an interpreted language?

  • Python will save all code first prior to running.
  • The source code is converted into bytecode that is then executed by the Python virtual machine.
  • The source code is pre-built and compiled before running.
  • Python needs to be built prior to it being run.

Question 2)
Why is indentation important in Python?

  • The code will compile faster with indentation.
  • Python used indentation to determine which code block starts and ends.
  • It makes the code more readable.
  • The code will be read in a sequential manner

Question 3)
What will be the output of the following code?

names = ["Anna", "Natasha", "Mike"]
names.insert(2, "Xi")
print(names)
  • [“Anna”, “Natasha”, Xi]
  • [“Anna”, “Natasha”, 2, “Xi”, “Mike”]
  • [“Anna”, “Xi”, ”Mike” ]
  • [“Anna”, “Natasha”, “Xi”, “Mike”]

Question 4)
What will be the output of the code below?

for x in range(1, 4):
print(int((str((float(x))))))
  • 1 , 2
  • 1.0, 2.0
  • Will give an error
  • “one”, “two”

Question 5)
What will be the output of the following code:

sample_dict = {1: 'Coffee', 2: 'Tea', 3: 'Juice'}
for x in sample_dict:
print(x)
  • {1 2 3}
  • ‘Coffee’, ‘Tea’, ‘Juice’
  • 1 2 3
  • (1, ‘Coffee’)
    (2, ‘Tea’)
    (3, ‘Juice’)

Question 6)
What will be the output of the recursive code below?

def recursion(num):
print(num)
next = num - 3
if next > 1:
recursion(next)

recursion(11)
  • 11 8 5 2
  • 2 5 8 11
  • 2 5 8
  • 8 5 2

Question 7)
What will be the type of time complexity for the following piece of code:

def bigo(numbers):
for i in numbers:
print(numbers)

bigo([1, 7, 13, 19])
  • Quadratic Time
  • Constant Time
  • Logarithmic Time
  • Linear Time

Question 8)
What will be the output of the code below:

str = 'Pomodoro'
for l in str:
if l == 'o':
str = str.split()
print(str, end=", ")
  • [‘Pomodoro’]
  • [‘P’, ‘m’, ‘d’, ‘o’]
  • Will throw an error
  • [‘Pomodoro’, ‘modoro’, ‘doro‘, ‘ro’]

Question 9)
Find the output of the code below:

def d():
color = "green"
def e():
nonlocal color
color = "yellow"
e()
print("Color: " + color)
color = "red"
color = "blue"
d()
  • yellow
  • red
  • green
  • blue

Question 10)
Find the output of the code below:

num = 9
class Car:
num = 5
bathrooms = 2

def cost_evaluation(num):
num = 10
return num

class Bike():
  • 9
  • 2
  • 10
  • 5

Question 11)
Which of the following is the correct implementation that will return True if there is a parent class P, with an object p and a sub-class called C, with an object c?

  • print(issubclass(p,C))
  • print(issubclass(C,P))
  • print(issubclass(P,C))
  • print(issubclass(C,c))

Question 12)
Django is a type of:

  • Micro-framework
  • Asynchronous framework
  • Full-stack framework

Question 13)
Which of the following is not true about Integration testing:

  • Tests the flow of data from one component to another.
  • It combines unit tests.
  • It is where the application is tested as a whole.
  • Primarily dealt by the tester.

Question 14)
While using pytest for testing, it is necessary to run the file containing the main code before we can run the testing file containing our unit tests.

  • True
  • False

Question 15)
What will be the output of the code below:

class A:
def a(self):
return "Function inside A"

class B:
def a(self):
return "Function inside B"

class C:
pass

 

  • Function inside B
  • Function inside A
  • No output
  • None of the above