MBI 256 Quizzes (after midterm)
What is the output of the following code? class test: def __init__(self,a="Class and Object"): self.a=a def display(self): print(self.a) obj=test() obj.display()
"Class and Object"
Which pattern would NOT match "123!456!"? [0-9]+!\d+! (\d*\W)+ [1-6!]+ (\D+\s?)+
(\D+\s?)+
What will be the output of the following code snippet? class Sales: def __init__(self, id): self.id = id id = 250 val = Sales(150) print (val.id)
150
What is the result of this code? class A: def a(self): print(2) class B(A): def a(self): print(4) class C(B): def c(self): print(6) c = C() c.a()
4
What is the result of this code? class A: def method(self): print(2) class B(A): def method(self): print(4) B().method()
4
How many groups are in the regex (ab)(c(d(e)f))(g)? (Please answer a number)
5
What would group(3) be of a match of 1(23)(4(56)78)9(0)?
56
Which repeated character can match zero or one repetitions of the previous thing?
?
Which of the following statements best describes a constructor?
A constructor is a special function that sets the initial values of an object's variables.
Which string would NOT be matched by "^ATG[^N]*TGA$"? ATGNNNTGA ATGGCAGACGTGA ATGGCGC ATGTTTAAATGA
ATGNNNTGA
What would [1-5][0-9] match?
Any two-digit number from 10 to 59
If I have an unknown nucleotide query, and I want to search against NCBI nucleotide databases. Which BLAST program should I use?
BLASTN
Which module in Biopython is used to download full records from NCBI Entrez?
EFetch
What is Python Enhancement Proposal (PEP) 8?
Guidelines for writing code
Which keyword can be used to input data into tables of a database?
INSERT
Which of the following database is a collection of manually drawn pathway maps representing our knowledge on the molecular interaction, reaction and relation networks?
KEGG
Which of the following databases is NOT a Protein database?
KEGG
Which of the following tools in ExPASy can be used to do Multiple Sequence Alignment?
MUSCLE
Which of the following statement is NOT correct for the method re.search? Finds a match of a pattern anywhere in the string Matches at the beginning of the string Scans through string looking for the first location where the regular expression pattern produces a match, and return a corresponding match object Return None if no position in the string matches the pattern
Matches at the beginning of the string
Which choice is Python Enhancement Proposal (PEP) 8-compliant as the name of a class? MyClassName my_class_name My_Class_Name Myclassname
MyClassName
Which function in Biopython is used to parse the BLAST result in XML format for a file with a single query?
NCBIXML.read()
Which function in Biopython is used to read in FASTA sequences as SeqRecord objects one by one?
SeqIO.parse()
Which of these patterns would not re.match the string "ATGATGATG"? ATGATG ATG TGATGATG AT
TGATGATG
Which of the following statements is not true for databases? Structured Query Language (SQL) is a high level programming language for relational database management and data manipulation. SQLite is a C library that provides a lightweight disk-based database that doesn't require a separate server process and allows accessing the database using a nonstandard variant of the SQL query language. Information in relational databases is organized as a set of tables with columns and rows. Use "import sqlite" to import SQLite module in python.
Use "import sqlite" to import SQLite module in python
What is the output for list[1]? import re Seq = 'ACTGAACTGAAACTGAAAA' list = re.findall('AA*', Seq) print(list[2])
['A', 'AA', 'AAA', 'AAAA'] list[1] = 'AA' list[2] = 'AAA'
Which of the following code is more pythonic? base = ['A', 'T', 'G', 'C'] x = 0 while x < len(base): v =base[x] print(v) x += 1 base = ['A', 'T', 'G', 'C'] for x in range(len(base)): v =base[x] print(v) base = ['A', 'T', 'G', 'C'] for x in base: print(x) if attr == True: print('True!') if attr == None: print('attr is None!')
base = ['A', 'T', 'G', 'C'] for x in base: print(x)
Which of the following keywords mark the beginning of the class definition?
class
Which command is used to save changes in databases when using sqlite3 module in Python?
commit()
After executing the SQL database, the result is inside the cursor object. Which function can be used to access the content of the database?
fetchall()
What type of object is a method?
function
How to import Biopython if it is installed?
import Bio
Which module prints the Zen of Python when imported?
import this
Which of the following statements can be used to check, whether an object "obj" is an instance of class A or not?
isinstance(obj, A)
Which of the following RNAs are NOT small RNAs? mRNAs (messenger RNAs) piRNAs (Piwi-associated RNAs) siRNAs (small interfering RNAs) miRNAs (microRNAs)
mRNAs
Which of the following code is more pythonic? name = "Ryan" age = 5 print("My name is %s, and I am %d years old." % (name, age)) print("My name is {}, and I am {} years old.".format(name, age)) print("My name is " + name, "and I am " + age + " years old.") print("My name is " + name, "and I am " + str(age) + " years old.")
print("My name is {}, and I am {} years old.".format(name, age))
Which function in Biopython is used to call the online version of BLAST?
qblast()
Which of the following keywords must be included as a parameter in every class function?
self
Which module in Python is used to provide a SQL interface compliant with the DB-API 2.0?
sqlite3
Which of the following can be used to invoke the __init__ method in B from A, where A is a subclass of B?
super().__init__() or B.__init__(self)
Which of these is the same as the metacharacter '+'?
{1,} (between 1 and infinity repetitions)