# Python for Data Science, AI & Development Quiz Answers

## All Weeks Python for Data Science, AI & Development Quiz Answers

This course will take you from zero to programming in Python in a matter of hours—no prior programming experience necessary! You will learn Python fundamentals, including data structures and data analysis, complete hands-on exercises throughout the course modules, and create a final project to demonstrate your new skills.

By the end of this course, you’ll feel comfortable creating basic programs, working with data, and solving real-world problems in Python. You’ll gain a strong foundation for more advanced learning in the field, and develop skills to help advance your career.

Enroll in Python for Data Science, AI & Development Course on Coursera

### Python for Data Science, AI & Development Week 01 Quiz Answers

Q1. What is the value of x after the following lines of code?

x=2

x=x+2

• 4
• 2

Q2. What is the result of the following operation 3+2*2 ?

• 3
• 7
• 9

Q3. What is the type of the following “7.1”

• float
• string

Q4. What is the result of the following code segment: int(True)

• 1
• 0
• error

Q5. In Python, what is the result of the following operation: ‘1’+’2′ ?

• 3
• ‘3’
• ’12’

Q6. Given myvar = ‘hello’ , how would you return myvar as uppercase?

• len(myvar)
• myvar.find(‘hello’)
• myvar.upper()

Q7. What is the result of the following : str(1+1) ?

• ‘2’
• ’11’

Q8. What is the result of the following: “ABC”.replace(“AB”, “ab”) ?

• ‘abC’
• ‘ABc’

Q9. In Python 3, what is the type of the variable x after the following: x=1/1 ?

• float
• int

### Python for Data Science, AI & Development Week 02 Quiz Answers

Q1. Consider the tuple A=((11,12),[21,22]), that contains a tuple and list. What is the result of the following operation A ?

• (11,12)
• [21,22]
• ((11,12),[21,22])

Q2. Consider the tuple A=((1),[2,3],), that contains a tuple and list. What is the result of the following operation A?

• 4
• 
• 1

Q3. The method append does the following:

• adds one element to a list
• merges two lists or insert multiple elements to a list

Q4. Consider the following list : A=[“hard rock”,10,1.2]

What will list A contain affter the following command is run: del(A) ?

• [10,1.2]
• [“hard rock”,1.2]
• [“hard rock”,10]

Q5. If A is a list what does the following syntax do: B=A[:] ?

• assigns list A to list B
• variable B references a new copy or clone of the original list A

Q6. What is the result of the following: len((“disco”,10,1.2, “hard rock”,10)) ?

• 5
• 6
• 0

Q7. Consider the following dictionary:

{ “The Bodyguard”:”1992″, “Saturday Night Fever”:”1977″}

select the values

• 1977″
• “1992”
• “The Bodyguard”
• “Saturday Night Fever

Q8. The variable release_year_dict is a Python Dictionary, what is the result of applying the following method: release_year_dict.keys() ?

• retrieve the keys of the dictionary
• retrieves, the values of the dictionary

Q9. Consider the Set: V={‘A’,’B’}, what is the result of V.add(‘C’)?

• {‘A’,’B’,’C’}
• error
• {‘A’,’B’}

Q10. What is the result of the following: ‘1’ in {‘1′,’2’} ?

• False
• True

### Python for Data Science, AI & Development Week 03 Quiz Answers

Q1. What is the output of the following code?

``````x="Go"

if(x=="Go"):

print('Go ')

else:

print('Stop')

print('Mike')``````
• Go Mike
• Mike
• Stop Mike

Q2. What is the result of the following lines of code?

``````x=1
x>-5``````
• True
• False

Q3. What is the output of the following few lines of code?

``````x=0
while(x<2):
print(x)
x=x+1``````
• 0
• 1
• 0
• 1
• 2
• 0
• 1
• 3
• 4

Q4. What is the result of running the following lines of code ?

``````class Points(object):
def __init__(self,x,y):

self.x=x
self.y=y

def print_point(self):

print('x=',self.x,' y=',self.y)

p1=Points(1,2)
p1.print_point()``````
• x=1;
• x=1 y=2
• y=2

Q5. What is the output of the following few lines of code?

``````for i,x in enumerate(['A','B','C']):
print(i+1,x)``````
• 1 A
• 2 B
• 3 C
• 0 A
• 1 B
• 2 C
• 0 AA
• 1 BB
• 2 CC

Q6. What is the result of running the following lines of code ?

``````class Points(object):

def __init__(self,x,y):

self.x=x
self.y=y

def print_point(self):

print('x=',self.x,' y=',self.y)

p2=Points(1,2)

p2.x='A'

p2.print_point()``````
• x= 1 y=2
• x= A y=2
• x=A, y=B

Q7. Consider the function step, when will the function return a value of 1?

``````def step(x):
if x>0:
y=1
else:
y=0
return y``````
• if x is larger than 0
• if x is equal to or less then zero
• if x is less than zero

Q8. What is the output of the following lines of code?

``````a=1

def do(x):
a=100
return(x+a)

print(do(1))``````
• 2
• 101
• 102

### Python for Data Science, AI & Development Week 04 Quiz Answers

Q1. What is the result of the following lines of code?

``````a=np.array([0,1])
b=np.array([1,0])
np.dot(a,b) ``````
• 0
• 1
• array([1,1])

Q2. What is the value of Z after the following code is run?

``````X=np.array([[1,0],[0,1]])
Y=np.array([[0,1],[1,0]])
Z=X+Y
``````
• array([[1,1],[1,1]])
• array([[1,0],[0,1]])
• array([[0,1],[1,1]])

Q3. What values does the variable out take if the following lines of code are run?

``````X=np.array([[1,0,1],[2,2,2]])
out=X[0:2,2]
out``````
• array([1,0])
• array([1,2])
• array([1,1])

Q4. What is the value of Z after the following code is run?

``````X=np.array([[1,0],[0,1]])
Y=np.array([[2,2],[2,2]])
Z=np.dot(X,Y)``````
• array([[2,2],[2,2]])
• array([[2,0],[0,2] ])
• array([[3,2],[2,3]])

Q5. Consider the following text file: Example1.txt:

This is line 1

This is line 2

This is line 3

What is the output of the following lines of code?

``````with open("Example1.txt","r") as file1:

print(FileContent)``````
• This is line 1
• This is line 2
• This is line 3
• This is line 1
• This

Q6. What do the following lines of code do?

``````with open("Example1.txt","r") as file1:

print(FileContent)``````
• Write to the file “Example1.txt”
• Append the file “Example1.txt”

Q7. What do the following lines of code do?

``````with open("Example.txt","a") as writefile:

writefile.write("This is line A\n")
writefile.write("This is line B\n")``````
• Append the file “Example.txt”
• Write to the file “Example.txt”

Q8. What task do the following lines of code perform?

``````with open('Example2.txt','r') as readfile:
with open('Example3.txt','w') as writefile:
writefile.write(line)
``````
• Check the mode of the open function for each file object.
• Copy the text from Example2.txt to Example3.txt.
• Print out the content of Example2.txt.

Q9. Consider the dataframe df. How would you access the element in the 1st row 3rd column

• df.iloc[2,0]
• df.iloc[1,3]
• df.iloc[0,2]

Q10. What method gets the unique elements of the following: df[‘Length’] ?

• unique

### Python for Data Science, AI & Development Week 05 Quiz Answers

Q1. What are the 3 parts to a response message?

• Start or status line, header, and body
• Bookmarks, history, and security
• Encoding, body, and cache
• HTTP headers, blank line, and body

Q2. What is the purpose of this line of code “table_row=table.find_all(name=’tr’)” used in webscraping?

• It will find all of the data within the table marked with a tag “tr”
• It will find all of the data within the table marked with a tag “h1
• It will find all of the data within the table marked with a tag “a
• It will find all of the data within the table marked with a tag “p

Q3. In what data structure do HTTP responses generally return?

• Tuples
• Nested Lists
• JSON
• Lists

Q4. The Python library we used to plot the chart in the lab is

• Plotly
• MatPlotLib
• Pandas
• PyCoinGecko
##### Python for Data Science, AI & Development Coursera Course Review:

In our experience, we suggest you enroll in the Python for Data Science, AI & Development Course and gain some new skills from Professionals completely free and we assure you will be worth it.

Python for Data Science, AI & Development course is available on Coursera for free and this course is a part of the IBM Full Stack Cloud Developer Professional Certificate, if you are stuck anywhere between quiz or graded assessment quiz, just visit Networking Funda to get Python for Data Science, AI & Development Quiz Answers

##### Conclusion:

I hope this Python for Data Science, AI & Development Quiz Answers would be useful for you to learn something new from this Course. If it helped you then don’t forget to bookmark our site for more Coursera Quiz Answers

Keep Learning!

#### Get all IBM Full Stack Cloud Developer Professional Certificate Quiz Answers

Introduction to Cloud Computing Coursera Quiz Answers

Introduction to Web Development with HTML, CSS, JavaScript Quiz Answers

Developing Cloud Native Applications Coursera Quiz Answers

Developing Cloud Apps with Node.js and React Coursera Quiz Answers

Introduction to Containers w/ Docker, Kubernetes & OpenShift Quiz Answers

Python for Data Science, AI & Development Coursera Quiz Answers

Python Project for AI & Application Development Coursera Quiz Answers

Developing Applications with SQL, Databases, and Django Quiz Answers

Application Development using Microservices and Serverless Quiz Answers

Full Stack Cloud Development Capstone Project Coursera Quiz Answers

error: Content is protected !!