# NPTEL The Joy Of Computing Using Python Week 4 Assignment Answer 2023

NPTEL The Joy Of Computing Using Python Week 4 Assignment Answer

## NPTEL The Joy Of Computing Using Python Week 4 Assignment Answer 2023

1. What is a magic square?

A square grid of letters
A square grid of numbers where the sum of the rows, columns, & diagonals are equal
A special kind of card trick
A term used in cryptography

`Answer :- For Answer Click Here`

2. In a 3×3 magic square, what is the magic constant?

• 3
• 6
• 9
• 15
`Answer :- For Answer Click Here`

3. Which of the following is NOT a property of a magic square?

• The sum of each row is equal
• The sum of each column is equal
• The sum of each diagonal is equal
• The sum of each individual element is equal
`Answer :- For Answer Click Here`

4. What will be the output of the following code?

• A magic square of size 2.
• A magic square of size n.
• A magic square of an even size.
• A magic square of an odd size.
`Answer :- For Answer Click Here`

5. What will be the output of the following code? • Sorted List(L) containing random elements between 0-10 in descending order.
• Sorted List containing random elements between 0-10 in ascending order.
• Sorted List containing elements between 0-10.
• Sorted List containing elements between 0-9 in ascending order.
`Answer :- For Answer Click Here`

6. Which code will generate all prime numbers between 0-100?

`Answer :- For Answer Click Here`

7. In the birthday paradox, as the number of people in a group increases, what happens to the probability that two people share a birthday?

• It increases
• It decreases
• It stays the same
• It becomes impossible
`Answer :- For Answer Click Here`

8. Which module is used to generate random numbers in Python?

• math
• random
• stats
• numpy
`Answer :- For Answer Click Here`

9. Which function is used to shuffle a list in Python?

• random.shuffle()
• shuffle()
• list.shuffle()
• random_list()
`Answer :- For Answer Click Here`

10. What is the output of the following code?

import random
nums = [1, 2, 3, 4, 5]
random.shuffle(nums)
print(nums)

• [1, 2, 3, 4, 5]
• [5, 4, 3, 2, 1]
• A random ordering of the numbers 1 through 5
• An error
`Answer :- For Answer Click Here`