ProgrammingHardGATE CS · Product-company placement

What is printed?

What is printed?
d = {"a": 1, "b": 2}
items = d.items()
print(("a", 1) in items, ("a", 2) in items, items & {("b", 2), ("c", 3)} == {("b", 2)}, len(dict.fromkeys("hello")))
  1. A. True False True 5
  2. B. False False True 4
  3. C. True False True 4
  4. D. True True True 4

Correct answer: C. True False True 4

An items view supports membership by (key, value) pair and set operations. dict.fromkeys keeps one key per distinct character of 'hello' (h, e, l, o), preserving first-seen order.

More Python Programming questions

Exams that ask this topic