Question 1 of 25
Hints left: 3
Q1
Write a list comprehension to produce the list: [1, 2, 4, 8, 16......212].
Q2
What will be the output of the following Python code? matrix = [[1, 2, 3, 4], [4, 5, 6, 7], [8, 9, 10, 11], [12, 13, 14, 15]] for i in range(0, 4): print(matrix[i][1], end = " ")
Q3
To remove string "hello" from list1, we use which command?
Q4
Which of the following matrices will throw an error in Python?
-
A
-
B
-
C
-
D
Q5
What will be the output of the following Python code? a=[10,23,56,[78]] b=list(a) a[3][0]=95 a[1]=34 print(b)
-
A
-
B
-
C
-
D
Q6
What will be the output of the following Python code? list1 = [1, 2, 3, 4] list2 = [5, 6, 7, 8] print(len(list1 + list2))
Q7
What will be the output of the following Python code? names1 = ['Amir', 'Bala', 'Charlie'] names2 = [name.lower() for name in names1] print(names2[2][0])
Q8
Suppose list1 is [3, 5, 25, 1, 3], what is min(list1)?
Q9
What will be the output of the following Python code? def addItem(listParam): listParam += [1] mylist = [1, 2, 3, 4] addItem(mylist) print(len(mylist))
Q10
What will be the output of the following Python code? points = [[1, 2], [3, 1.5], [0.5, 0.5]] points.sort() print(points)
-
A
-
B
-
C
-
D
Q11
What will be the output of the following Python code? numbers = [1, 2, 3, 4] numbers.append([5,6,7,8]) print(len(numbers))
Q12
What will be the output of the following Python code? a=[1,2,3,4] b=[sum(a[0:x+1]) for x in range(0,len(a))] print(b)
Q13
What will be the output of the following Python code? l1=[1,2,3] l2=[4,5,6] [x*y for x in l1 for y in l2]
-
A
-
B
-
C
-
D
Q14
What will be the output of the following Python code? data = [[[1, 2], [3, 4]], [[5, 6], [7, 8]]] print(data[1][0][0])
Q15
What will be the output of the following Python code? A = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] [[col + 10 for col in row] for row in A]
-
A
-
B
-
C
-
D
Q16
What will be the output of the following Python code? x=[[1],[2]] print(" ".join(list(map(str,x))))
Q17
What will be the output of the following Python code snippet? print([i.lower() for i in "HELLO"])
Q18
Suppose listExample is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after listExample.pop()?
-
A
-
B
-
C
-
D
Q19
What will be the output of the following Python code? a=[13,56,17] a.append([87]) a.extend([45,67]) print(a)
-
A
-
B
-
C
-
D
Q20
What will be the output of the following Python code? A = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] A[1]
Q21
What will be the output of the following Python code? s="a@b@c@d" a=list(s.partition("@")) print(a) b=list(s.split("@",3)) print(b)
-
A
-
B
-
C
-
D
Q22
What will be the output of the following Python code? def f(values): values[0] = 44 v = [1, 2, 3] f(v) print(v)
Q23
What will be the output of the following Python code? a=[1,2,3,4] b=[sum(a[0:x+1]) for x in range(0,len(a))] print(b)
Q24
What will be the output of the following Python code? b=[2,3,4,5] a=list(filter(lambda x:x%2,b)) print(a)
Q25
What will be the output of the following Python code snippet? print([[i+j for i in "abc"] for j in "def"])
-
A
-
B
-
C
-
D