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

Sanket
By Sanket

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

1.

image 85
Answer :- For Answers Click Hera 

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

  • 72
  • 111
  • 109
  • 110
Answer :- For Answers Click Hera 

3. Does transposing the magic square give us a new magic square ?

  • Yes
  • No
Answer :- 

4.

image 86
Answer :- 

5. What is the minimum number of people required to ensure that at least two 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 4×4 square, where all elements are distinct numbers from 1 to 16, is it same as the magic constant for Ramanujan’s magic square ?

Answer :- For Answers Click Hera 

7. What task does function1() perform ?

W4Q7
  • Calculate factorial of number n.
  • Calculate factors of number n.
  • Calculate prime factors of number n.
  • Calculate factors of number n excluding n.
Answer :- 

8. For what n1,n2 flag will the variable flag inside function2() be not equal to true ?

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

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

  • It will not print ”Completed” for any pair.
  • It will print ”Completed” only for pairs (2,3)(3,5),(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.
Answer :- 

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

  • Yes, we can change the logic for setting flag variable to True.
  • Yes, we can change/increase the threshold for length of list2 in the last if block.
  • No, it is logically not possible.
  • Yes, we can change the initial value of flag to True, instead of False.
Answer :- For Answers Click Hera 
Share This Article
Leave a comment