NPTEL The Joy Of Computing Using Python Assignment 5 Answers (Week 5)
Q1. What is the syntax to create a dictionary?
a. D = []
b. D = {}
c. D = ()
d. D = dictionary()
Answer: b. D = {}
Q2. What is the correct statement about dictionaries?
a. There can be multiple same keys.
b. Every value must be unique.
c. Every key must be unique.
d. We can’t get every key from the dictionary.
Answer: c. Every key must be unique.
Q3. What is the correct syntax to get all the keys only from a dictionary d?
a. d.key()
b. d.item()
c. d.value()
d. d.keys()
Answer: d. d.keys()
Q4. What will be the output of the following code?

a. 20 ‘30’
b. ‘20’ ‘30’
c. 20 30
d. a b
Answer: a. 20 ‘30’
Q5. What will be the output of the following code?

a. ‘a’ ‘b’ ‘c’
b. 20 30 50
c. (‘a’, 20), (‘b’, 30), (‘c’, 50)
d. (‘a’, ‘b’, ‘c’) (20, 30, 50)
Answer: c. (‘a’, 20), (‘b’, 30), (‘c’, 50)
Q6. What will be the output of the following code?

a. Creates a dictionary with keys in range 0-19 and values 0
b. Creates a dictionary with keys in range a-t and values 0.
c. Creates a dictionary with keys in range a-z and values in range 0-19.
d. Creates a dictionary with keys in range a-t and values in range 0-19.
Answer: b. Creates a dictionary with keys in range a-t and values 0.
Q7. What does the following code mimics?

a. Distribute 1000 marbles evenly in every bag.
b. Distribute 500 marbles randomly in every bag.
c. Distribute 1000 marbles randomly in every bag.
d. Throws an error.
Answer: c. Distribute 1000 marbles randomly in every bag.
Q8. What is the correct code to choose rock, paper, or scissors correctly?
a.

b.

c.

d.

Answer: d.

Q9.Binary search is applicable in?
a. Unsorted list.
b. Only in the list which is sorted in ascending order.
c. Only in the list which is sorted in descending order.
d. Any sorted list.
Answer: d. Any sorted list.
Q10. What will be the output of the following code?

a. The first element of the initial list.
b. The largest element of the list.
c. The smallest element of the list.
d. Throws an error.
Answer: b. The largest element of the list.
Disclaimer: These answers are provided only for the purpose to help students to take references. This website does not claim any surety of 100% correct answers. So, this website urges you to complete your assignment yourself.
Also Available: