Sign Up

Sign In

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

You must login to ask a question.

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

The Joy of Computing Using Python NPTEL Assignment Answers Sikshapath

Are you looking for help in Joy of Computing using Python NPTEL week 4 Assignment Answers? So, here in this article, we have provided Joy of Computing using Python week 4 Assignment Answer’s hint.

NPTEL The Joy of Computing using Python Assignment Answers Week 4

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(N2 +1)/2

Answer: a. A Magic Square is always a square matrix

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

For instant notification of any updates, Join us on telegram.


Q2. 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. 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?

a. def perfect_number(num):

ans=0

for i in range(1,num):

if(num%i==0):

ans = ans + i

if(ans==num):

return True

else:

return False

b.  def perfect_number(num):
ans=0
for i in range(1, num):
if(num%i==0):
ans+=i
if(ans==num):
return False 
else:
return True
c.  def perfect_number(num):
ans=0
for i in range(3, num):
if(num%i==0):
ans = ans + i
if(ans==num):
return True 
else:
return False
d.  def perfect_number(num):
ans=0
for i in range(1, num):
if(num%i==0):
ans = ans + i
if(ans!=num):
return True 
else:
return False

Answer: Option (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?

import random
n = random.randint(0,100)
print(n%5)

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?

import random
L = ['harry potter', 'matrix', 'spiderman', 'terminator', 'karate ki']
movie = random.choice(L)
count = 0
for character in movie:
if(character == 'a' or character == 'A'):
 count = count+1elif(character == 'e' or character == 'E'):
 count = count+1elif(character == 'i' or character == 'I'):
 count = count+1elif(character == 'o' or character == '0'):
 count = count+1elif(character == 'U' or character == 'u'):
 count = count+1
print(count, movie)

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


TELEGRAM FOR NOTIFICATIONClick Here
Follow on Google News (in one click)Click Here

Disclaimer: These answers are provided only for the purpose to help students to take references. This website does not claim any surety of 100% correct answers. So, this website urges you to complete your assignment yourself.


Also Available:

NPTEL The Joy of Computing using Python Assignment Answers Week 3

NPTEL The Joy of Computing using Python Assignment Answers Week 5

Related Posts