Question 1 of 25
Hints left: 3
Q1
Is the following Python code valid? >>> a,b,c=1,2,3 >>> a,b,c
Q2
What will be the output of the following Python code? numberGames = {} numberGames[(1,2,4)] = 8 numberGames[(4,2,1)] = 10 numberGames[(1,2)] = 12 sum = 0 for k in numberGames: sum += numberGames[k] print(len(numberGames) + sum)
Q3
What is the data type of (1)?
Q4
What will be the output of the following Python code? a = ('check',) n = 2 for i in range(int(n)): a = (a,) print(a)
-
A
-
B
-
C
-
D
Q5
What will be the output of the following Python code? >>> a=(0,1,2,3,4) >>> b=slice(0,2) >>> a[b]
Q6
What will the following code output: my_tuple = (1, 2, 3) new_tuple = my_tuple.copy() print(new_tuple)
-
A
-
B
-
C
-
D
Q7
Tuples can't be made keys of a dictionary.
Q8
If a=(1,2,3,4), a[1:-1] is . . . . . . . .
Q9
Is the following Python code valid? >>> a=(1,2,3,4) >>> del a
Q10
What will be the output of the following Python code? >>> a=(1,2,3,4) >>> del(a[2])
Q11
What will be the output of the following Python code? >>> import collections >>> a=collections.namedtuple('a',['i','j']) >>> obj=a(i=4,j=7) >>> obj
Q12
What will be the output of the following Python code? >>> a=(2,3,4) >>> sum(a,3)
Q13
What will be the output of the following Python code? >>> a=[(2,4),(1,2),(3,9)] >>> a.sort() >>> a
-
A
-
B
-
C
-
D
Q14
What will be the output of the following Python code? d = {"john":40, "peter":45} d["john"]
Q15
What will be the output of the following Python code? >>>my_tuple = (1, 2, 3, 4) >>>my_tuple.append( (5, 6, 7) ) >>>print len(my_tuple)
Q16
What will be the output of the following Python code? >>>t = (1, 2) >>>2 * t
-
A
-
B
-
C
-
D
Q17
What will be the output of the following Python code? >>>t1 = (1, 2, 4, 3) >>>t2 = (1, 2, 3, 4) >>>t1 < t2
Q18
Is the following Python code valid? >>> a=(1,2,3) >>> b=('A','B','C') >>> c=tuple(zip(a,b))
-
A
-
B
-
C
-
D
Q19
What type of data is: a=[(1,1),(2,4),(3,9)]?
Q20
What will be the output of the following Python code? >>> a=("Check")*3 >>> a
Q21
Suppose t = (1, 2, 4, 3), which of the following is incorrect?
Q22
What will be the output of the following Python code? >>> a=(2,3,1,5) >>> a.sort() >>> a
Q23
What will be the output of the following Python code? >>>t=(1,2,4,3) >>>t[1:-1]
Q24
What will be the output of the following Python code? >>> a,b=6,7 >>> a,b=b,a >>> a,b
Q25
What is the output of the following code: my_list = [1, 2, 3, 4] my_list.remove(2) print(my_list)