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

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

1. Which of the following options provides the general formula for the magic constant of a magic square of size n, where all elements are distinct numbers from 1 to n2?

Answer :- For Answers Click Here 

2. What would the magic constant be for a magic square of size 7, given that all elements in the square are distinct numbers from 1 to 49?

  • 260
  • 111
  • 175
  • 165
Answer :- 

3. Does transposing any magic square change the sum across some rows/columns/diagonal?

  • Yes
  • No
Answer :- 

4. Which of the following are valid magic squares ?

Answer :- 

5. What is the minimum number of people required to ensure that at least three of them share the same 30-minute birth interval? The intervals start from 12:00 AM and each interval lasts for half an hour.

Answer :- 

6. Calculate the magic constant for 5×5 square, where all elements are distinct numbers from 1 to 25, is it same as the magic constant for Ramanujan’s magic square ?

Answer :- For Answers Click Here 

7. What task does mystery1() perform?

  • Calculate factorial of number n.
  • Calculate factors of number n.
  • Calculate factors of number n+1 excluding n.
  • Calculate factors of number n excluding n.
Answer :- 

8. For what n1, n2 will the variable flag inside mystery2() be equal to True?

  • 1,2
  • 2,3
  • 3,4
  • 0,0
Answer :- 

9. If all possible pairs of prime numbers between 0 and 10, are given to n1 and n2, for how many pairs would 2 print ”Completed” ?

  • It will print ”Completed” only for pairs (2,3)(7,2),(2,5), and for the remaining it would not print ”Completed”.
  • It will print ”Completed” only for pair (2,3), and for the remaining other pairs of primes it would not print ”Completed”.
  • It will print ”Completed” for all pairs of primes between 0 and 20.
  • It will not print ”Completed” for any pair.
Answer :- 

10. If numbers of pairs of primes which result in mystery2 to print ”Completed” are lesser than 1, Can we edit the code in mystery2() so that ”Completed” is always printed for any pair of primes ?

  • Yes, we can change the logic for setting flag variable to False.
  • No, it is logically not possible.
  • Yes, we can change/decrease the threshold for length of list2 in the last if block.
  • Yes, we can change the initial value of flag to False, instead of True.
Answer :- For Answers Click Here 
Scroll to Top