Python for Genomic Data Science Coursera Quiz Answers 2022 | All Weeks Assessment Answers [💯Correct Answer]

Hello Peers, Today we are going to share all week’s assessment and quizzes answers of the Python for Genomic Data Science course launched by Coursera totally free of cost✅✅✅. This is a certification course for every interested student.

In case you didn’t find this course for free, then you can apply for financial ads to get this course for totally free.

Check out this article “How to Apply for Financial Ads?”

About The Coursera

Coursera, India’s biggest learning platform launched millions of free courses for students daily. These courses are from various recognized universities, where industry experts and professors teach in a very well manner and in a more understandable way.

Here, you will find Python for Genomic Data Science Exam Answers in Bold Color which are given below.

These answers are updated recently and are 100% correct✅ answers of all week, assessment, and final exam answers of Python for Genomic Data Science from Coursera Free Certification Course.

Use “Ctrl+F” To Find Any Questions Answer. & For Mobile User, You Just Need To Click On Three dots In Your Browser & You Will Get A “Find” Option There. Use These Option to Get Any Random Questions Answer.

About Python for Genomic Data Science Course

This course will walk students through the fundamentals of the Python programming language as well as the iPython notebook. The Johns Hopkins University’s Genomic Big Data Science Specialization is currently in its third and last semester, and this is the third and final course.


  • Bioinformatics
  • Biopython
  • Python Programming
  • Genomics

Course Apply Link – Python for Genomic Data Science

Python for Genomic Data Science Quiz Answers

Week 1

Quiz 1: Lecture 1 Quiz

Q1. Which of the following is not a good programming strategy?

  • List all the steps by which the program computes the output.
  • Use external modules and libraries when they are available.
  • Identify the required inputs, such as data or specifications from the user.
  • Do not include many details in the overall design of the program.

Q2. Which of these is not true about pseudocode?

  • It does not use the rigorous syntax of a programming language.
  • It is an informal way to describe how you will solve a problem.
  • It lists all steps that are required in order to compute the result.
  • It can be read and interpreted by the computer.

Q3. Which feature is not true about Python?

  • It is an interactive language
  • It is extensible
  • It has a large standard library
  • It is a compiled language

Week 2

Quiz 1: Lecture 3 Quiz

Q1. What data type is the object below?


  • Array
  • Dictionary
  • Set
  • List

Q2. What is the value returned when the code below is executed:

grades = [70,80.0,90,100]


  • 90
  • 85
  • 80
  • 90.0

Q3. Suppose splice_site_pairs = [‘GT-AG’,’GC-AG’,’AT-AC’]. What is splice_site_pairs[:-1] ?

  • [‘GT-AG’,’GC-AG’,’AT-AC’]
  • [‘GT-AG’]
  • Error
  • [‘GT-AG’, ‘GC-AG’]

Q4. We want to add a new element to a list variable L. The new element is stored in a variable e. What command do we use?

  • L.addLast(e)
  • L.append(e)
  • L.addEnd(e)
  • L.add(e)

Q5. Suppose t = (‘a’, ‘c’, ‘g’, ‘t’). What will be the output of the following code:

t.append( (‘A’,’C’,’G’,’T’) )

print len(t)

  • 5
  • 8
  • 2
  • Error

Q6. What is the result of the print function in the following Python 3.xx code:

dna=input(“Enter DNA sequence:”)




  • ‘g’
  • ‘a’
  • ‘t’
  • ‘c’

Q7. To delete an entry with the key ‘a’ from the dictionary dna_counts={‘g’: 13, ‘c’: 3,

‘t’: 1, ‘a’: 16} what command do we use:

  • del dna_counts[‘a’:16]
  • dna_counts.delete(‘a’)
  • del dna_counts[‘a’]
  • dna_counts[-1]=”

Q8. Suppose dna is a string variable that contains only ‘a’,’c’,’g’ or ‘t’ characters. What Python code below can we use to find the frequency (max_freq) of the most frequent character in string dna?


Q9. Suppose L1 and L2 are two list variables. What does the list variable

L3 = list(set(L1)&set(L2)) contain?
  • All elements common to lists L1 and L2
  • All elements common between lists L1 and L2 without duplicates
  • All elements in lists L1 and L2
  • A list of sets formed with the elements of lists L1 and L2

Q10. How many elements are in the dictionary someData after the following code has been executed?

someData = { }someData['cheese'] = 'dairy'someData['Cheese'] = 'dairy'someData['Cheese'] = 'Dairy'someData['cheese'] = 'Dairy'
  • 0
  • 3
  • 2
  • Can’t say – an error message was issued.

Quiz 2: Lecture 4 Quiz

Q1. The following expression is true when rnatype is ‘ncRNA’ and length is at least 200, or rnatype is ‘ncRNA’ and length is 22:

(rnatype is 'ncRNA' and length>=200) or (rnatype is 'ncRNA' and length==22)

What Boolean expression below represents a negation of the above expression?

  • rnatype is not ‘ncRNA’ or ( length <200 and length != 22)
  • rnatype is not ‘ncRNA’ and ( length <200 or length != 22)
  • (rnatype is not ‘ncRNA’ and length < 200) and (rnatype is not ‘ncRNA’ and length != 22)
  • (rnatype is not ‘ncRNA’ and length < 200) or (rnatype is not ‘ncRNA’ and length != 22)

Q2. For what values of the variable fold would the following code print ‘condition B’?

if fold > 2 : print(’condition A’)
elif fold>100: print(’condition B’)
if fold> 2 or fold<2 : print('condition A')
else : print(’condition B’)
  • if fold is 2
  • if fold is bigger than 100 or fold is 2
  • if fold is bigger than 100
  • if fold is less than 2

Q3. How many times will Python execute the code inside the following while loop?

while i< 2048 :
  • 12
  • 2048
  • 11
  • 10

Q4. What sequence of numbers does the range(1,-23,-3) expression evaluate to?

  • -23, -20, -17, -14, -11, -8, -5, -2, 1
  • 1, -2, -5, -8, -11, -14, -17, -20
  • -23, -20, -17, -14, -11, -8, -5, -2
  • 1, -1, -3, -5, -7, -9, -11, -13, -15, -17, -19, -21

Q5. A substring in programming represents all characters from a string, between two specified indices. Given a variable string called seq, a student writes the following program that will generate all nonempty substrings of seq:

for i in range(len(seq)) : # line 1for j in range(i) : # line 2print(seq[j:i]) # line 3

Which of the following changes make the above program correct?

A. Program is correct as it is.

B. Change line 1 to:

for i in range(len(seq)+1) :

C. Change line 3 to:


D. Change line 2 to:

for j in range(i+1) :

  • Only A
  • Only C
  • Only D
  • Only B

Q6. While and for loops are equivalent: whatever you can do with one you can do with the other. Given the for loop written by the student in problem 5, which of the following while loops are equivalent to it:


while i<len(seq) :
while(j<i) :
i=1while i<len(seq) :j=1while(j<i) :print(seq[j:i])j=j+1i=i+1C.
i=0while i<len(seq) :j=0while(j<i) :print(seq[j:i])j+=1i+=1D.
i=0while i<len(seq)+1 :j=0while(j<i+1) :print(seq[j:i])j=j+1i=i+1E.
i=1while i<len(seq)+1 :j=1while(j<i+1) :print(seq[j:i])F.
i=0while i0) :print(seq[j:i])j=j+1i=i+1
  • A, C, and E only
  • E only
  • A and B only
  • C only

Q7. A student writes a program that for any two lists L1

and L2, computes a list L3 that contains only the elements that are

common between the two lists without duplicates. Which following

statement makes the following portion of code that computes L3


L3 = [] # line 1

for elem in L1: # line 2

if elem in L2: # line 3

L3.append(elem) # line 4

Add the following line (with the correct indentation) between lines 2 and 3:

if elem not in L3:

The following two lines are introduced with the correct indentation after line 2:

if elem in L3:


Change line 4 to:


Change line3 to be:

if elem in L2 and elem not in L3:

Q8. Study the following two Python code fragments:

Version 1.

d = {}result = Falsefor x in mylist:if x in d:result=Truebreakd[x] = TrueVersion 2.
d = {}result = Falsefor x in mylist:if not x in d:d[x]=Truecontinueresult = True

Both versions should determine if there is any element that appears more than once in the list mylist. If there is such an element than the variable result should be True, otherwise it should be False. For instance, if mylist=[1,2,2,3,4,5] the result variable should be True.

Which of the following statements is True for any value of the list mylist after the execution of both versions of code?

  • Version 1 is not computing the result variable correctly.
  • Both the result and d variables have the same value.
  • The value of the result variable is the same, but the variable d is different.
  • Version 2 is not computing the result variable correctly.

Q9. Study the following if statement:

if x>10 or x<-10: print('big') elif x>1000000: print('very big')elif x<-1000000: print('very big')else : print('small')

For what values of x will the above code print ‘very big’?

  • For x > 1000000 or x < -1000000
  • For x < -1000000
  • For x > 1000000
  • For no value

Q10. What will be the value of the variable i after the following code is executed:

i = 1while i < 100:if i%2 == 0 : breaki += 1else:i=1000
  • 1
  • 98
  • 2
  • 99

Week 3

Quiz 1: Lecture 5 Quiz

Q1. A student writes several functions to swap the values of the two variables x and y, i.e. if x=1 and y=2, after calling the swap function x=2 and y=1. The different functions that the student writes are given below:

def swap1(x,y) :

def swap2(x,y) :

def swap3(x,y) :

def swap4(x,y) :

Which of the functions swap1, swap2, swap3, and swap4 is correct?

  • Function swap2 only
  • Functions swap1, and swap2 only
  • Functions swap2, and swap4 only
  • Functions swap2, swap3, and swap4 only

Q2. Consider the following two functions:

def f1(x):
if (x > 0):
x = 3*x
x = x / 2
return x

def f2(x):
if (x > 0):
x = 3*x
x = x / 2

For what values of x will f1 and f2 return the same value?

  • For x< 3/2
  • When x is zero or positive
  • For negative values of x only
  • For x > 3/2

Q3. A recursive function in programming is a function that calls itself during its execution. The following two functions are examples of recursive functions:

def function1(length):if length > 0:print(length)function1(length - 1)def function2(length):while length > 0:print(length)function2(length - 1)

What can you say about the output of function1(3) and function2(3)?

  • function1 produces the output: 3 2 1 and function2 runs infinitely.
  • function1 produces the output:




and function2 runs infinitely.

  • The two functions produce the same output 1 2 3.
  • The two functions produce the same output:




Q4. The following recursive function takes three positive integer arguments:

def compute(n,x,y) :
if n==0 : return x
return compute(n-1,x+y,y)
What is the value returned by the compute function?

  • x
  • n*(x+y)
  • x+n*y
  • x+y

Q5. What will the returned value be for the compute function defined in Question 4 if the argument n is negative?

  • x+n*y
  • x
  • The function will never return a value.
  • x-n*y

Q6. The following functions are all intended to check whether a string representing a dna sequence contains any characters that are not ‘a’,’c’,’g’,’t’, ‘A’, ‘C’, ‘G’, or ‘T’. At least some of these functions are wrong. Which ones are correct?

def valid_dna1(dna):for c in dna:if c in 'acgtACGT':return Trueelse:return False
def valid_dna2(dna):for c in dna:if 'c' in 'acgtACGT':return 'True'else:return 'False'
def valid_dna3(dna):for c in dna:flag = c in 'acgtACGT'return flag
def valid_dna4(dna):for c in dna:if not c in 'acgtACGT':return Falsereturn True
  • valid_dna1, and valid_dna3 only
  • valid_dna4 only
  • valid_dna1, valid_dna2, and valid_dna4 only
  • valid_dna2 only

Q7. What is the type of variable L3 and what is its value if L1 and L2 are lists?

L3 = [i for i in set(L1) if i in L2]

  • L3 is a set with elements common between the lists L2 and L3.
  • L3 is a list that contains only the elements that are common between the lists (without duplicates).
  • L3 is a tuple with elements that are both in L1 and L2
  • L3 is a list with all the elements in L1 and L2

Q8. What will be printed after executing the following code?

>>>def f(mystring):
message="Inside function now!"
>>>message="Outside function!"
>>>f("Test function:")
  • Outside function!
  • Outside function!
    • Test function:
    • Inside function now!
  • Test function:
    • then an error message
  • An error message.

Q9. Which statement below is true about a function:

  • its arguments always appear within brackets
  • may have no parameters
  • must have at least one parameter
  • must always have a return statement

Q10. Which of the following function headers is correct?

A. def afunction(a1 = 1, a2):

B. def afunction(a1 = 1, a2, a3 = 3):

C. def afunction(a1 = 1, a2 = 2, a3 = 3):

  • C
  • A
  • A,B
  • None is correct.

Quiz 2: Lecture 6 Quiz

Q1. Which of the following is a correct Python program to obtain the Python version you are using?




import sys





import sys


  • A, B, C
  • B, C, D
  • B
  • A, B

Q2. What does the following code do?

import randomdef create_dna(n, alphabet=’acgt’):return ’’.join([random.choice(alphabet) for i in range(n)])dna = create_dna(1000000)
  • Creates a dna variable containing a string of length 1000000, and with the a,c,g,t characters.
  • Creates a dna variable containing a string of length 999999, and with the a,c,g,t characters.
  • Creates a dna variable containing a string of length less than 1000000, and with the a,c,g,t characters.
  • Creates a dna variable containing a string of length 1000000, containing the ‘acgt’ substring repeated.

Q3. The following functions are all supposed to count how many times a certain base (represented as a character variable in Python) appears in a dna sequence (represented as a string variable in Python):

def count1(dna, base):
    i = 0
    for c in dna:
        if c == base:
	    i += 1 
    return i

def count2(dna, base):
    i = 0 
    for j in range(len(dna)):
        if dna[j] == base:
	    i += 1 
    return i 

def count3(dna, base):
    match = [c == base for c in dna]
    return sum(match)

def count4(dna, base):
    return dna.count(base)

def count5(dna, base):
    return len([i for i in range(len(dna)) if dna[i] == base])

def count6(dna,base):
    return sum(c == base for c in dna)

Which of them is correct?

  • count4, count5 only
  • count1, count2, count3, and count4 only
  • count2, count3 only
  • All of them are correct.

Q4. Which of the correct functions defined in the previous exercise is the fastest?

Hint. You will need to generate a very large string to test them on, and the function clock() from the time module to time each function.

  • count4
  • count2
  • count3
  • count1

Q5. If the PYTHONPATH environment variable is set, which of the following directories are searched for modules?

A) PYTHONPATH directory

B) current directory

C) home directory

D) installation dependent default path

  • B and D only
  • A, B, and C
  • B only
  • A, B, and D

Q6. A student imports a module called dnautil in Python using the following command:

import dnautil

What does the following call to the dir function do?


  • Prints all the documentation associated with the function dir
  • Lists all the attributes of the dnautil module
  • Lists the gc and has_stop_codon functions
  • Lists all the functions in the dnautil module

Week 4

Quiz 1: Lecture 7 Quiz

Q1. A student wants to write into a file called myfile, without deleting its existing content. Which one of the following functions should he or she use?

  • f = open(‘myfile’, ‘r’)
  • f = open(‘myfile’, ‘a’)
  • f = open(‘myfile’, ‘b’)
  • f = open(‘myfile’, ‘+’)

Q2. Which of the following statements are true?

A) When you open a file for reading, if the file does not exist, an error occurs.

B) When you open a file for writing, if the file does not exist, a new file is created.

C) When you open a file for reading, if the file does not exist, the program will open an empty file.

D) When you open a file for writing, if the file exists, the existing file is overwritten with the new file.

E) When you open a file for writing, if the file does not exist, an error occurs.

  • B, C, and D only
  • A, B, and D only
  • A and B only
  • All of them are correct

Q3. Examine the following three functions that take as argument a file name and return the extension of that file. For instance, if the file name is ‘myfile.tar.gz’ the returned value of the function should be ‘gz’. If the file name has no extention, i.e. when the file name is just ‘myfile’, the function should return an empty string.

def get_extension1(filename):

def get_extension2(filename):
    import os.path

def get_extension3(filename):
    return filename[filename.rfind('.'):][1:]

Which of the these functions are doing exactly what they are supposed to do according to the description above?

  • get_extension1 only
  • get_extension3 only
  • get_extension2 only
  • None of them.

Q4. A student is running a Python program like this:

python myfile1.fa myfile2.faIn the program the following lines are present:
import systocheck=sys.argv[1]

What is the value of the variable tocheck?

  • ‘myfile1.fa’
  • ‘’
  • ‘myfile2.fa’


A student launches the Python interpreter from his home directory. His home directory contains another directory called 'mydir',  and 'mydir' contains two files called 'foo' and 'bar'. The home directory does not contain any files, only other directories.  What will happen when he writes the following code at the Python prompt:>>> import os
>>> filenames = os.listdir('mydir')
>>> f= open(filenames[0])
  • An error will be produced stating that the file to be opened does not exist.
  • A variable f representing a file object will be created, and the first file in the directory ‘mydir’ will be opened.
  • An error will be produced stating that filename is not subscriptable.
  • A variable f representing a file object will be created, and the first file in the directory ‘mydir’ will be opened for reading in text mode.

Quiz 3: Lecture 8 Quiz

Q1. What module can we use to run BLAST over the internet in Biopython:


Q2. Which one of the following modules is not part of the Bio.Blast package in Biopython:


Q3. Using Biopython find out what species the following unknown DNA sequence comes from:


Hint. Identify the alignment with the lowest E value.

  • Salvia miltiorrhiza
  • Nicotiana tabacum
  • Antirrhinum majus
  • Citrullus lanatus

Q4. Seq is a sequence object that can be imported from Biopython using the following statement:

from Bio.Seq import Seq

If my_seq is a Seq object, what is the correct Biopython code to print the reverse complement of my_seq?

Hint. Use the built-in function help you find out the methods of the Seq object.

print('reverse complement is %s' % complement(my_seq.reverse()))
print('reverse complement is %s' % reverse(my_seq.complement()))
print('reverse complement is %s' % complement(my_seq))
print('reverse complement is %s' % my_seq.reverse_complement())

Q5. Create a Biopython Seq object that represents the following sequence:


Its protein translation is:


Quiz 4: Final Exam (Read Instructions First)

Q1. Welcome to the final exam.

If you haven’t yet read the instructions, please exit the exam and read the Final Exam Instructions.

Please run the following data set in the program(s) that you have written: dna2.fasta

If you created your program(s) correctly, you will be able to answer the questions below.

How many records are in the multi-FASTA file?

  • 679
  • 22
  • 18
  • 34

Q2. What is the length of the longest sequence in the file?

  • 2341
  • 5341
  • 4894
  • 10457

Q3. What is the length of the shortest sequence in the file?

  • 103
  • 115
  • 78
  • 964

Q4. What is the length of the longest ORF appearing in reading frame 2 of any of the sequences?

  • 1644
  • 618
  • 1719
  • 1458

Q5. What is the starting position of the longest ORF in reading frame 3 in any of the sequences? The position should indicate the character number where the ORF begins. For instance, the following ORF:



starts at position 1.

  • 636
  • 832
  • 758
  • 132

Q6. What is the length of the longest ORF appearing in any sequence and in any forward reading frame?

  • 2307
  • 2394
  • 1719
  • 1281

Q7. What is the length of the longest forward ORF that appears in the sequence with the identifier gi|142022655|gb|EQ086233.1|16?

  • 1560
  • 1644
  • 1719
  • 1317

Q8. Find the most frequently occurring repeat of length 6 in all sequences. How many times does it occur in all?

  • 1020
  • 153
  • 219
  • 194

Q9. Find all repeats of length 12 in the input file. Let’s use Max to specify the number of copies

of the most frequent repeat of length 12. How many different 12-base sequences

occur Max times?

  • 4
  • 5
  • 7
  • 10

Q10. Which one of the following repeats of length 7 has a maximum number of occurrences?



Hopefully, this article will be useful for you to find all the Week, final assessment, and Peer Graded Assessment Answers of Python for Genomic Data Science Quiz of Coursera and grab some premium knowledge with less effort. If this article really helped you in any way then make sure to share it with your friends on social media and let them also know about this amazing training. You can also check out our other course Answers. So, be with us guys we will share a lot more free courses and their exam/quiz solutions also, and follow our Techno-RJ Blog for more updates.

7 thoughts on “Python for Genomic Data Science Coursera Quiz Answers 2022 | All Weeks Assessment Answers [💯Correct Answer]”

  1. I have been exploring for a little bit for any high-quality articles or blog posts on this kind of area . Exploring in Yahoo I at last stumbled upon this website. Reading this info So i am happy to convey that I’ve a very good uncanny feeling I discovered just what I needed. I most certainly will make sure to do not forget this website and give it a look on a constant basis.

  2. You can certainly see your skills in the paintings you write. The sector hopes for even more passionate writers such as you who are not afraid to mention how they believe. At all times go after your heart.


Leave a Comment

Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker🙏.

Powered By
Best Wordpress Adblock Detecting Plugin | CHP Adblock