This set of MCQ(multiple choice questions) focuses on the **The Joy of Computing using Python Week 4 Solutions**.

The course carries programming to your work area with stories, similarities and distinguished models. Going reflections to experiences and designing to engineering, the course concentrates fundamentally to rouse the student’s psyche to automatically think intelligently and show up at an answer. As a feature of the course, you will figure out how to practice and culture the craft of programming with Python as a language.

### Course layout

*Answers COMING SOON! Kindly Wait!*

**Week 0: Assignment answers**

Week 1:

**Assignment answers**

Week 2:

**Assignment answers**

Week 3:

**Assignment answers**

Week 4: Assignment answers

Week 5:

**Assignment answers**

Week 6:

**Assignment answers**

Week 7:

**Assignment answers**

Week 8:

**Assignment answers**

Week 9:

**Assignment answers**

Week 10:

**Assignment answers**

Week 11:

**Assignment answers**

Week 12:

**Assignment answers**

**NOTE:** You can check your answer immediately by clicking show answer button. **The Joy of Computing using Python **NPTEL 2022 Week 4 Assignment Solution” contains 10 questions.

Now, start attempting the quiz.

**The Joy of Computing using Python** NPTEL 2023 Week 4 Assignment Solutions

**Q1.** What is a magic square?

a) A square grid of letters

b) A square grid of numbers where the sum of the rows, columns, & diagonals are equal

c) A special kind of card trick

d) A term used in cryptography

**Answer:** b)

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

a) 3

b) 6

c) 9

d) 15

**Answer:** d) 15

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

a) The sum of each row is equal

b) The sum of each column is equal

c) The sum of each diagonal is equal

d) The sum of each individual element is equal

**Answer:** d) The sum of each individual element is equal

**Q4.** What will be the output of the following code?

a) A magic square of size 2.

b) A magic square of size n.

c) A magic square of an even size.

d) A magic square of an odd size.

**Answer:** b) A magic square of size n.

**Q5.** What will be the output of the following code?

a) Sorted List(L) containing random elements between 0-10 in descending order.

b) Sorted List containing random elements between 0-10 in ascending order.

c) Sorted List containing elements between 0-10.

d) Sorted List containing elements between 0-9 in ascending order.

**Answer:** a)

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

**Answer:** b)

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

a) It increases

b) It decreases

c) It stays the same

d) It becomes impossible

**Answer:** a)

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

a) math

b) random

c) stats

d) numpy

**Answer:** b) random

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

a) random.shuffle()

b) shuffle()

c) list.shuffle()

d) random_list()

**Answer:** a) random.shuffle()

**Q10.** What is the output of the following code?

import random

nums = [1, 2, 3, 4, 5]

random.shuffle(nums)

print(nums)

a) [1, 2, 3, 4, 5]

b) [5, 4, 3, 2, 1]

c) A random ordering of the numbers 1 through 5

d) An error

**Answer:** c) A random ordering of the numbers 1 through 5

**The Joy of Computing using Python** NPTEL 2023 Week 4 Assignment Solutions

**Q1.** Which of the following statements are true with regards to magic square?

a) The sum of each row should be m.

b) The sum of each column should be m.

c) The sum of each diagonal should be m.

d) None of the above.

**Answer:** a), b), c)

**Q2.** Which of the following statements hold true about N in the magic square? N denotes the number of rows and columns in the square.

a) N should be even.

b) N should be odd.

c) N can be even or odd.

d) N can take any value.

**Answer:** b)

**Q3.** Which of the following statements are true regarding the Magic Squares? (N = Number of rows or columns)

a) A Magic Square is always a square matrix.

b) A Magic Square can or cannot be a square matrix.

c) The Sum of each row and each column is N(N+1)/2

d) The Sum of each row and each column is N(N^{2}+1 )/2.

**Answer:** a), d)

**Q4.** What will be the output of the following code?

”’

This is a sentence

”’

a) This is a sentence

b) Error

c) No output

d) The program will not run

**Answer:** c)

**Q5.** Which of the following operator is used to raise the exponent to a number?

a) ^

b) *

c) **

d) ***

**Answer:** c)

**Q6.** Suppose there is a movie with 3 letters, how many combinations of names are possible?

a) 26

b) 676

c) 17576

d) 456976

**Answer:** c)

**Q7.** What should be the value of a, b, c, d respectively?

a) 1, 3, 9, 7

b) 9, 3, 7, 1

c) 1, 7, 3, 9

d) 7, 3, 9, 1

**Answer:** c)

**Q8.** What will be the output of the following code?

a) Print unique movies of list L1

b) Print unique movies of list L2

c) Print unique movies of list L1 and L2

d) Shows an error

**Answer:** a)

**Q9.** What will be the output of the following code?

a) Print all perfect squares with square roots between 5-20 and divisible by 5.

b) Print all perfect squares with square roots between 5-20 and not divisible by 5.

c) Print all perfect squares with square roots between 5-19 and not divisible by 5.

d) Print all perfect squares with square roots between 5-19 and divisible by 5.

**Answer:** d)

**Q10.** A perfect number is a positive integer that is equal to the sum of its positive divisors, excluding the number itself. For example, 6 is a perfect number as the sum of its divisors 1,2,3 is equal to 6.

Which function will return True if the number is a perfect number?

**Answer:** a)

**The Joy of Computing using Python** NPTEL 2022 Week 4 Assignment Solutions

**Q1.** Which of the following statements are true regarding the Magic Squares? (N = Number of rows or columns)

a) A Magic Square is always a square matrix.

b) A Magic Square can or cannot be a square matrix.

c) The Sum of each row and each column is N(N+1)/2

d) The Sum of each row and each column is N(N^{2} +1)/2.

**Answer:** a), d)

**Q2.** What will be the output of the following code?

a) This is a sentence.

b) Error

c) No output

d) The program will not run

**Answer:** c) No output

**Q3.** A perfect number is a number in which the sum of its proper divisors is equal to that number. For example, 6 is a perfect number as the sum of its divisors 1,2,3 is equal to 6. Which function returns True if the number is perfect?

**Answer:** a)

**Q4.** Suppose there is a movie with 3 letters, how many combinations of names are possible?

a) 26

b) 676

c) 17576

d) 456976

**Answer:** c) 17576

**Q5.** What are the possible outputs of the following program?

a) Any number in the range between 0,4 (Both inclusive).

b) Any number in the range between 1,4 (Both inclusive).

c) Any number in the range between 0,5 (Both inclusive).

d) Any number in the range between 1,5 (Both inclusive).

**Answer:** a) Any number in the range between 0,4 (Both inclusive).

**Q6.** Birthday Paradox can be simulated with approximately __________ people.

a) 365

b) 100

c) 40

d) 20

**Answer:** c) 40

**Q7.** What is the command to print the last result of the ipython console?

a) ‘’

b) –

c) _

d) \\

**Answer:** c) _

**Q8.** What will be the output of the following program?

a) Passenger, Starwars

b) spiderman, jumanji

c) spiderman, jumanji, Passenger, Starwars

d) spiderman, Starwars

**Answer:** b) spiderman, jumanji

**Q9.** In the ‘Dobble Game’, if there are 8 objects on 1 card and 10 objects on another, how many comparisons are possible?

a) 8

b) 10

c) 18

d) 80

**Answer:** d) 80

**Q10.** What will be the output of the following code?

a) Display the number of consonants and name of the movie.

b) Display the number of letters and name of the movie.

c) Display the number of vowels and name of the movie.

d) Display the number of special characters and name of the movie.

**Answer:** c) Display the number of vowels and name of the movie.

**<< Prev- The Joy of Computing using Python Week 3 Assignment Solutions**

**>> Next- The Joy of Computing using Python Week 5 Assignment Solutions**

DISCLAIMER:Use these answers only for the reference purpose. Quizermania doesn't claim these answers to be 100% correct. So, make sure you submit your assignments on the basis of your knowledge.

*For discussion about any question, join the below comment section. And get the solution of your query.* Also, try to share your thoughts about the topics covered in this particular quiz.

Checkout for more NPTEL Courses: *Click Here!*