Q8Multiple correct3 Marks18 Dec 2025
Consider the following snippet:
```
f = open('employees.csv', 'r')
D = dict()
for line in f:
name, department, salary = line.strip().split(',')
salary = int(salary)
if name not in D:
D[name] = dict()
D[name][department] = salary
print(D)
```
This code produces the given output:
{'Alice': {'HR': 70000, 'IT': 80000}, 'Bob': {'Finance': 65000, 'IT': 72000}}
Which of the following could be the contents of the file employees.csv? Select all possible answers. Note that dictionaries store keys from left to right in the order in which they are inserted. Once a key has been inserted into a dictionary, its order with respect to other keys doesn't change, unless it is deleted and reinserted.