Python

0
Answered
0
Correct
0%
Accuracy
Question 1 Easy Mcq

What is the purpose of the map function?

Question 2 Easy Mcq

What is one of the most common use of Python's sys library?

Question 3 Easy Mcq

What is the basic difference between theses two operations in 're' module: match() and search()?

Question 4 Easy Mcq

What is the correct syntax for instantiating a new object of the type Game?

Question 5 Easy Mcq

What is the index of the first item in a tuple or list?

Question 6 Easy Mcq

What is a future statement?

Question 7 Easy Mcq

What is the method to retrieve the list of all active thread objects?

Question 8 Easy Mcq

When opening a file, what is the difference between text mode and binary mode?

Question 9 Easy Mcq

What is the correct syntax for defining a class called Game?

Question 10 Easy Mcq

What is the correct syntax for calling an instance method on a class named Game?

Question 11 Easy Mcq

What is a string in Python?

Question 12 Easy Mcq

What is delegation?

Question 13 Easy Mcq

What is the result of ("%g" % 74), '7' ?

Question 14 Easy Mcq

What is the statement that can be used in Python if a statement is required syntactically but the program requires no action?

Question 15 Easy Mcq

What is the syntax of assertions in Python?

Question 16 Easy Mcq

What is the correct syntax that will set the variable "var1" to the value "correct" if variable "a" is greater than 1?

Question 17 Easy Mcq

What is the correct way to run all the doctests in a given file from the command line?

Question 18 Easy Mcq

What is the correct way to get the exception as variable in except statement?

Question 19 Easy Mcq

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?

Question 20 Easy Mcq

What is a package?

Question 21 Easy Mcq

What is a base case in a recursive function?

Question 22 Easy Mcq

What is htmllib?

Question 23 Easy Mcq

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?

Question 24 Easy Mcq

What is used to read the next line in a file up to the '\n'?

Question 25 Easy Mcq

a = range(1, 10) m = map(lambda x: x % 2 == 0, a) What is the value of m

Question 26 Easy Mcq

What is a persistent dictionary?

Question 27 Easy Mcq

What is " __doc__" for in Python?

Question 28 Easy Mcq

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)

Question 29 Easy Mcq

What is the output of the following? t=(1,2,4,3,5) print(t[1:3])

Question 30 Easy Mcq

What is the correct way to increment the value of the variable "i" by 1?

Question 31 Easy Mcq

x = reduce(lambda x,y:x+y,[int(x) for x in "1"*10]) What is the value of x?

Question 32 Easy Mcq

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()

Question 33 Easy Mcq

What is the term used to describe items that may be passed into a function?

Question 34 Easy Mcq

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))

Question 35 Easy Mcq

What is the difference between using list comprehensions and generator expressions?

Question 36 Easy Mcq

What is the runtime complexity of searching for an item in a binary search tree?

Question 37 Easy Mcq

What is the output of the following code:name = 'Jon'name.rjust(4, 'A')

Question 38 Easy Mcq

Assume: a = 1 b = 4 c = (a == 'text') and a or b. What is the value of c?

Question 39 Easy Mcq

What is the result of eval("7"), string.atoi("4"), int("7") ?

Question 40 Easy Mcq

What is the best way to randomly select an item from list?

Question 41 Easy Mcq

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?

Question 42 Easy Mcq

What is the default SimpleHTTPServer port?

Question 43 Easy Mcq

What is the value of the variable a after the following statement: a=(1,2,3); a=a[2];

Question 44 Easy Mcq

What is the result of the expression: print [k(1) for k in [lambda x: x + p for p in range(3)]]?

Question 45 Easy Mcq

What is the purpose of the pass statement in Python?

Question 46 Easy Mcq

What is the result of the following expression: print((1, 2, 3) < (1, 2, 4))?

Question 47 Easy Mcq

import itertools p = itertools.permutations([1, 2]) f = filter(lambda x: x[0] % 2 == 0, p) What is the value of f?

Question 48 Easy Mcq

What is an abstract class?

Question 49 Easy Mcq

What is key difference between a set and a list?

Question 50 Easy Mcq

What is the return value of trunc()?

Showing 50 of 127 questions