Python
What is the purpose of the map function?
What is one of the most common use of Python's sys library?
What is the basic difference between theses two operations in 're' module: match() and search()?
What is the correct syntax for instantiating a new object of the type Game?
What is the index of the first item in a tuple or list?
What is a future statement?
What is the method to retrieve the list of all active thread objects?
When opening a file, what is the difference between text mode and binary mode?
What is the correct syntax for defining a class called Game?
What is the correct syntax for calling an instance method on a class named Game?
What is a string in Python?
What is delegation?
What is the result of ("%g" % 74), '7' ?
What is the statement that can be used in Python if a statement is required syntactically but the program requires no action?
What is the syntax of assertions in Python?
What is the correct syntax that will set the variable "var1" to the value "correct" if variable "a" is greater than 1?
What is the correct way to run all the doctests in a given file from the command line?
What is the correct way to get the exception as variable in except statement?
What is the difference between the two methods, "foo is None", and "foo == None", for the purposes of determining if the type of an object is None?
What is a package?
What is a base case in a recursive function?
What is htmllib?
Read the following statements:Statement 1: A simple assignment statement binds a name into the current namespace, unless that name has been declared as global.Statement 2: A name declared as global is bound to the global (module-level) namespace.Which of the following is correct?
What is used to read the next line in a file up to the '\n'?
a = range(1, 10) m = map(lambda x: x % 2 == 0, a) What is the value of m
What is a persistent dictionary?
What is " __doc__" for in Python?
What is the output of the following code?def foo(param1, *param2):print param1print param2def bar(param1, **param2):print param1print param2foo(1,2,3,4,5)bar(1,a=2,b=3)
What is the output of the following? t=(1,2,4,3,5) print(t[1:3])
What is the correct way to increment the value of the variable "i" by 1?
x = reduce(lambda x,y:x+y,[int(x) for x in "1"*10]) What is the value of x?
What is the output of the following code? class A(object): def __init__(self): print "Constructor A was called" class B(A): def __init__(self): print "Constructor B was called" class C(B): def __init__(self): super(C,self).__init__() print "Constructor C was called" class D(C): def __init__(self): super(D,self).__init__() print "Constructor D was called" d = D()
What is the term used to describe items that may be passed into a function?
What is the output of the following script? def f(a, L=[]): L.append(a) return L print(f(1)) print(f(2)) print(f(3))
What is the difference between using list comprehensions and generator expressions?
What is the runtime complexity of searching for an item in a binary search tree?
What is the output of the following code:name = 'Jon'name.rjust(4, 'A')
Assume: a = 1 b = 4 c = (a == 'text') and a or b. What is the value of c?
What is the result of eval("7"), string.atoi("4"), int("7") ?
What is the best way to randomly select an item from list?
Assuming the node is in a singly linked list, what is the runtime complexity of searching for a specific node within a singly linked list?
What is the default SimpleHTTPServer port?
What is the value of the variable a after the following statement: a=(1,2,3); a=a[2];
What is the result of the expression: print [k(1) for k in [lambda x: x + p for p in range(3)]]?
What is the purpose of the pass statement in Python?
What is the result of the following expression: print((1, 2, 3) < (1, 2, 4))?
import itertools p = itertools.permutations([1, 2]) f = filter(lambda x: x[0] % 2 == 0, p) What is the value of f?
What is an abstract class?
What is key difference between a set and a list?
What is the return value of trunc()?