SortedCoding
1.2K subscribers
185 photos
38 videos
194 files
140 links
Learn to code with clarity and precision
Download Telegram
How do you access the value associated with a key 'k' in a dictionary 'd'?
Anonymous Quiz
0%
d['k']
38%
d.get('k')
50%
Both A and B
13%
None of the above
🔥1
In python, What happens if you try to access a non-existent key 'k' in a dictionary 'd' using d[k]?
Anonymous Quiz
0%
Returns None
13%
Returns an empty string
88%
Raises a KeyError
0%
Creates a new key 'k' with value None
🔥1
In Python 3.7 and later, how are elements in a dictionary ordered?
Anonymous Quiz
63%
By the order they were added
0%
In ascending order of keys
38%
In descending order of keys
0%
Randomly
🔥1
What is a function in Python?
Anonymous Quiz
29%
A variable
29%
A module
43%
A block of code
0%
An operator
🔥1
🔥1
What is the difference between arguments and parameters in Python functions?
Anonymous Quiz
0%
No difference
100%
Parameters define, arguments call
0%
Arguments define, parameters call
0%
Based on data type
🔥1
Which exception is raised by Python when a file you try to open does not exist?
Anonymous Quiz
80%
FileNotFoundError
20%
IOError
0%
OSError
0%
ValueError
🔥1
🔥1
🔥1
What will this list comprehension produce:

[x**2 for x in range(5)]
Anonymous Quiz
0%
[0, 1, 2, 3, 4]
17%
[1, 4, 9, 16, 25]
83%
[0, 1, 4, 9, 16]
0%
[1, 2, 3, 4, 5]
🔥1
🔥1
How is a lambda function different from a regular function defined using def in Python?
Anonymous Quiz
60%
Lambda can only have one expression
0%
Lambda can return multiple values
20%
Lambda functions are faster
20%
Lambda functions can't have arguments
🔥1
What is the output of the following lambda expression?

(lambda x, y: x * y)(3, 4)
Anonymous Quiz
17%
7
67%
12
0%
0
17%
Error
🔥1
What will this list comprehension produce:

[x**2 for x in range(5)]
Anonymous Quiz
0%
[0, 1, 2, 3, 4]
29%
[1, 4, 9, 16, 25]
57%
[0, 1, 4, 9, 16]
14%
[1, 2, 3, 4, 5]
🔥1
🔥1