The Joy of Computing using Python Week 3 NPTEL Assignment Answers 2025

NPTEL The Joy of Computing using Python Week 3 Assignment Answers 2024

1. Consider the following code snippet:

What does the code do?
Options:
(a) Takes a list of numbers as input, appends each number to a list, and prints the list of numbers
(b) Takes a list of elements as input, appends each element to a list, and prints the list of elements
(c) Takes the count of elements followed by the same number of elements as input, appends each element to a list, and prints the list of elements
(d) Takes the count of elements, appends each element to a list, and prints the count of elements entered.

Answer :- b ✅
Explanation: The code likely loops through a sequence of inputs and appends them to a list, regardless of type (numbers, strings), which matches option (b).


2. Which of the following statements are true about List Data Structure? [MSQ]

Options:
(a) It is a flexible Data Structure
(b) Elements could be added to a list
(c) Elements could be subtracted from a list
(d) This_is_not_List = [ ] is an empty list

Answer :- a, b, c, d ✅
Explanation: All statements are correct. Python lists are dynamic, support adding/subtracting elements, and [] creates an empty list.


3. What does the above code print?

Options:
(a) Amar, Akbar, Anthony
(b) amar is brother of anthony and akbar
(c) Amar is brother of Anthony and Akbar
(d) Anthony is brother of Akbar and Amar

Answer :- d
Explanation: The print order in the code is likely print(anthony, akbar, amar) format, thus matching option (d).


4. What does the code do?

Options:
(a) Takes a list of numbers, multiplies each number by 2, and prints the updated list
(b) Takes a list of numbers, appends each number to the list twice, and prints the updated list
(c) Takes a list of numbers, removes even numbers from the list, and prints the updated list
(d) Takes a list of numbers, divides each number by 2, and prints the updated list

Answer :- a
Explanation: Code most likely uses list comprehension or a loop to double each element.


5. What will be the output of the following Python code?

Options:
(a) “1111111111”
(b) “0000000000”
(c) A string with some 1s and some 0s
(d) The function will raise an error

Answer :- c
Explanation: The output depends on logic that randomly assigns 0 or 1 based on a condition, so (c) is correct.


6. What does the code do?

Options:
(a) Takes a list of numbers as input, computes the sum of the numbers, and prints the sum along with the average
(b) Takes the count of elements, computes the sum of the elements, and prints the sum along with the average
(c) Takes a list of numbers as input, computes the average of the numbers, and prints the average along with the sum
(d) None of the above

Answer :- a
Explanation: Code computes both sum and average, and prints them — typical input-processing-output format.


7. What will be the output of the following Python code?

Options:
(a) “Python”
(b) A random permutation of the letters in “python”
(c) “random”
(d) The function will raise an error

Answer :- b ✅
Explanation: Likely uses random.shuffle() or similar function to randomly rearrange the characters of “python”.


8. What does the code do? [MSQ]

Options:
(a) Reverses the numbers list and stores it in new_numbers.
(b) Creates an empty list named new_numbers and appends elements from numbers to it in reverse order.
(c) Produces an error due to an invalid function used for list manipulation.
(d) Generates a new list new_numbers with elements from numbers in the same order as numbers.

Answer :- b
Explanation: The logic describes manually reversing a list using a loop and appending elements in reverse order.


9. Which of the following are examples of Social Computing/Crowd Computing: [MSQ]

Options:
(a) Wikipedia
(b) Stack Exchange
(c) Quora
(d) Facebook

Answer :- a, b, c
Explanation: Wikipedia, Stack Exchange, and Quora rely on user-generated content and collaboration. Facebook is more social networking, not primarily crowd computing.


10. What does the code do?

Options:
(a) Prints numbers from 1 to 20, replacing multiples of 3 with “Fizz”, multiples of 5 with “Buzz”, and multiples of both 3 and 5 with “FizzBuzz”.
(b) Prints numbers from 1 to 20, replacing multiples of 3 and 5 with “FizzBuzz”, multiples of 3 with “Fizz”, and multiples of 5 with “Buzz”.
(c) Prints numbers from 1 to 20, replacing multiples of 3 with “Fizz”, multiples of 5 with “Buzz”, and numbers divisible by both 3 and 5 with their product.
(d) Prints numbers from 1 to 20, replacing multiples of 3 with “Buzz”, multiples of 5 with “Fizz”, and numbers divisible by both 3 and 5 with “FizzBuzz”.

Answer :- b
Explanation: Standard FizzBuzz logic where 15 is replaced with “FizzBuzz”, 3 with “Fizz”, 5 with “Buzz”.