1) One of the following 10 statements generates an error. Which one? (Your answer should be a number between 1 and 10.)

x = [[7,8],3,”hello”,[6,8],”world”,17] # Line 1
z = [x,x] # Line 2
y = x[0:50] # Line 3
w = x # Line 4
w = 7 # Line 5
a = z + z # Line 6
x = “ping” # Line 7
y = y + y # Line 8
y = 7 # Line 9
w = 7 # Line 10

`Answer(s) : Line 10`

2) What is the value of mystring after the following lines are executed?

def mystery(s):
for i in range(len(s),1,-2):
s = s[1:]+s;
return(s)

mystring = “siruseri”
mystring = mystery(mystring)

a) x == 14, y == 14, u == 15, v == 15
b) x == 17, y == 15, u == 14, v == 15
c) x == 17, y == 15, u == 17, v == 15
d) x == 14, y == 15, u == 14, v == 15

`Answer(s) : `serisiru``

Consider the following lines of Python code.
a = ‘nptel’
b = [12,14,16]
c = 72

x = [a,b,c]
y = [a,b[:],c]
u = x[:]
v = y

b = 17
v = 15

Which of the following is correct?

(a) x == 14, y == 14, u == 15, v == 15
(b) x == 17, y == 15, u == 14, v == 15
(c) x == 17, y == 15, u == 17, v == 15
(d) x == 14, y == 15, u == 14, v == 15

`Answer(s) : (c)  x == 17, y == 15, u == 17, v == 15`

a = ‘nptel’
b = [12,14,16]
c = 72

x = [a,b,c]
y = [a,b[:],c]
u = x[:]
v = y

b = [12,17,16]
v = 15

Which of the following is correct?

(a) x == 14, y == 14, u == 15, v == 15
(b) x == 17, y == 15, u == 14, v == 15
(c) x == 17, y == 15, u == 17, v == 15
(d) x == 14, y == 15, u == 14, v == 15

`Answer(s) : (d) x == 14, y == 15, u == 14, v == 15`