What will be the output of the following Python code?
count={} count[(1,2,4)] = 5 count[(4,2,1)] = 7 count[(1,2)] = 6 count[(4,2,1)] = 2 tot = 0 for i in count: tot=tot+count[i] print(len(count)+tot)
25
17
16
Tuples can’t be made keys of a dictionary
a={} a[2]=1 a[1]=[2,3,4] print(a[1][1])
[2,3,4]
3
2
An exception is thrown
a={'B':5,'A':9,'C':7} print(sorted(a))
[‘A’,’B’,’C’]
[‘B’,’C’,’A’]
[5,7,9]
[9,5,7]
Returns True if any key of the dictionary is true
Returns False if dictionary is empty
Returns True if all keys of the dictionary are true
Method any() doesn’t exist for dictionary
a=dict() print(a[1])
An exception is thrown since the dictionary is empty
‘ ‘
1
0
seed()
sqrt()
factorial()
print()
What will be the output of the following Python expression?
print(round(4.576))
4.5
5
4
4.6
(x**y)**z
(x**y) / z
(x**y) % z
(x**y)*z
print(round(4.5676,2))
4.57
4.56
What will be the output of the following Python function?
import math print(abs(math.sqrt(25)))
Error
-5
5.0
sum(2,4,6) sum([1,2,3])
Error, 6
12, Error
12, 6
Error, Error
min(max(False,-3,-4), 2,7)
False
-3
-4
(a%b, a//b)
(a//b, a%b)
(a//b, a*b)
(a/b, a%b)
enumerate()
all()
chr()
max()
ord()
min()
any()
reverse(l)
list(reverse[(l)])
reversed(l)
list(reversed(l))
divmod()
float()
ord(‘ ‘)
ord(”)
ord(“”)
len(["hello",2, 4, 6])
6
number of arguments
number of arguments + 1
number of arguments – 1
none of the mentioned