Question 1
3
1
2
Good Job!
Oops!
The insert() function counts the number of occurrences of the val is inserted into the dictionary. There are only 2 keys present since the key ‘banana’ is repeated. Thus, the length of the dictionary is 2.
Please login to submit your explanation
You can check your performance of this question after Login/Signup
Start
Question 2
50
Error
The global statement is used to declare that num is a global variable – hence, when we assign a value to num inside the function, that change is reflected when we use the value of num in the main block.
Question 3
Infinite loop
infinity
inf
The output of the first function will be –inf
Question 4
2 2 1
True
False
8 4 2
The builtin function any() returns true if any or more of the elements of the iterable is true (non zero), If all the elements are zero, it returns false.
Question 5
3 0 4.2
7.2
The function all() returns ‘True’ if any one or more of the elements of the iterable are non zero. In the above case, the values are not iterable, hence an error is thrown.
Question 6
1
5
The function max() is being used to find the maximum value from among 3, 4 and false. Since false amounts to the value zero, hence we are left with min(0, 2, 7) Hence the output is 0 (false).
Question 7
(a%b, a//b)
(a//b, a*b)
(a//b, a%b)
(a/b, a%b)
The function divmod(a,b) is evaluated as a//b, a%b, if both ‘a’ and ‘b’ are integers.
Question 8
[(0, 3), (1, 2)]
[(0, 2), (1, 3)]
[(2, 3)]
The builtin function enumerate() accepts an iterable as an argument. The function is shown in the above case returns containing pairs of the numbers given, starting from 0. Hence the output will be: [(0, 3), (1, 2)].
Question 9
ord()
min()
chr()
any()
The function chr() accepts only integers as arguments. The function ord() accepts only strings. The functions min() and max() can accept floating point as well as integer arguments.
Question 10
8
4
13
6
The function len() returns the length of the number of elements in the iterable. Therefore the output of the function shown above is 4.
Please login to report
Login/Signup
Personalized Analytics only Availble for Logged in users
Analytics below shows your performance in various Mocks on PrepInsta
Your average Analytics for this Quiz
Rank

Percentile
0%
Completed
0/0
Accuracy
March 31, 2021
Login/Signup to comment
Login/Signup to comment