1. Which of the following import will cause an ImportError ?
import zen
import antigravity
import this
2. Which of the below statement is Idiomatic ?
if "data": do_something()
if "data": do_something()
3. What's will be the value of the variable "result" in the below program.
array = [1,2,3] result = array[10:]
4. What numbers are printed by the below program.
Ignore "(" and "," in the output Python 2.x users.
class Node(object): ctr = 1 class SubNodeA(Node): pass class SubNodeB(Node): pass print (Node.ctr, SubNodeA.ctr, SubNodeB.ctr) Node.ctr = 3 print (Node.ctr, SubNodeA.ctr, SubNodeB.ctr) SubNodeB.ctr = 2 print (Node.ctr, SubNodeA.ctr, SubNodeB.ctr) SubNodeA.ctr = 4 print (Node.ctr, SubNodeA.ctr, SubNodeB.ctr)
1 1 1
3 3 3
3 3 2
3 4 2
1 1 1
3 3 3
2 2 2
4 4 4
1 1 1
3 1 1
3 2 2
3 2 4
1 1 1
3 3 3
2 2 2
4 4 4
5. What's the default byte-code interpreter of Python ?.