Question 1 of 25
Hints left: 3
Q1
Suppose listExample is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after listExample.pop(1)?
-
A
-
B
-
C
-
D
Q2
What will be the output of the following Python code? import math [str(round(math.pi)) for i in range (1, 6)]
-
A
-
B
-
C
-
D
Q3
What will be the output of the following Python code? A = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] B = [[3, 3, 3], [4, 4, 4], [5, 5, 5]] [B[row][col]*A[row][col] for row in range(3) for col in range(3)]
-
A
-
B
-
C
-
D
Q4
To which of the following the "in" operator can be used to check if an item is in it?
Q5
What will be the output of the following Python code? values = [[3, 4, 5, 1], [33, 6, 1, 2]] v = values[0][0] for row in range(0, len(values)): for column in range(0, len(values[row])): if v < values[row][column]: v = values[row][column] print(v)
Q6
What will be the output of the following Python code? l=[[1, 2, 3], [4, 5, 6]] for i in range(len(l)): for j in range(len(l[i])): l[i][j]+=10 l
-
A
-
B
-
C
-
D
Q7
What will be the output of the following Python code? names1 = ['Amir', 'Bear', 'Charlton', 'Daman'] names2 = names1 names3 = names1[:] names2[0] = 'Alice' names3[1] = 'Bob' sum = 0 for ls in (names1, names2, names3): if ls[0] == 'Alice': sum += 1 if ls[1] == 'Bob': sum += 10 print sum
Q8
Suppose list1 is [4, 2, 2, 4, 5, 2, 1, 0], Which of the following is correct syntax for slicing operation?
Q9
What will be the output of the following Python code? data = [[[1, 2], [3, 4]], [[5, 6], [7, 8]]] def ttt(m): v = m[0][0] for row in m: for element in row: if v < element: v = element return v print(ttt(data[0]))
Q10
What is the list comprehension equivalent for: list(map(lambda x:x**-1, [1, 2, 3]))?
Q11
What will be the output of the following Python code? a="hello" b=list((x.upper(),len(x)) for x in a) print(b)
-
A
-
B
-
C
-
D
Q12
Suppose list1 = [0.5 * x for x in range(0, 4)], list1 is:
-
A
-
B
-
C
-
D
Q13
To shuffle the list(say list1) what function do we use?
Q14
What will be the output of the following Python code? >>>list1 = [1, 3] >>>list2 = list1 >>>list1[0] = 4 >>>print(list2)
Q15
Read the information given below carefully and write a list comprehension such that the output is: ['e', 'o'] w="hello" v=('a', 'e', 'i', 'o', 'u')
Q16
Suppose list1 is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after list1.reverse()?
-
A
-
B
-
C
-
D
Q17
What will be the output of the following Python code? t=32.00 [round((x-32)*5/9) for x in t]
Q18
Write a list comprehension equivalent for the Python code shown below. for i in range(1, 101): if int(i*0.5)==i*0.5: print(i)
Q19
What will be the output of the following Python code? a = [1, 5, 7, 9, 9, 1] b=a[0] x= 0 for x in range(1, len(a)): if a[x] > b: b = a[x] b= x print(b)
Q20
What is the output of print(k) in the following Python code snippet? k = [print(i) for i in my_string if i not in "aeiou"] print(k)
Q21
What will be the output of the following Python code? [ord(ch) for ch in 'abc']
Q22
What will be the output of the following Python code? >>> a=[14,52,7] >>>> b=a.copy() >>> b is a
Q23
What will be the output of the following Python code? l=[1,2,3,4,5] [x&1 for x in l]
-
A
-
B
-
C
-
D
Q24
What will be the output of the following Python code? word1="Apple" word2="Apple" list1=[1,2,3] list2=[1,2,3] print(word1 is word2) print(list1 is list2)
Q25
What is the output when we execute list("hello")?