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.

Sorry, you do not have permission to ask a question, You must login to ask a question.

SIKSHAPATH Latest Articles

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

The Joy of Computing Using Python NPTEL Assignment Answers Sikshapath

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

NPTEL The Joy of Computing using Python Assignment Answers Week 6

Q1. In the list L = [4,6,7,4,6,2,1], What is the index of element ‘7’?

a. 0

b. 1
c. 2
d. 3

Answer: c. 2

900+ Students helped through instant notifications on telegram.


Q2. Which of the following is true about recursion?

a. Recursion always performs better than non-recursive code.

b. Recursive code is easier to debug

c. The base case is necessary for recursion.

d. Recursive code can be shorter than non-recursive code.

Answer: Option B, C and D.


Q3. What will be the output of the following program?

s = 'AbrakaDabra'
print(s[1:6])

a. No output

b. braKa

c. Abra

d. rak

Answer: b. braKa


Q4. What will be the output of the following program?

def recursive(a):
if a == 0: 
    return 0
  return a+recursive(a−1)
print(recursive(10))

a. Sum of first 10 natural numbers.

b. Sum of first 9 natural numbers.

c. The program will never end.

d. Sum of numbers from 2-10(Both inclusive).

Answer: a. Sum of first 10 natural numbers.


Q5. What’s the correct code for Binary search?

a. def Binary(L, find, start, end):
mid = int((start+end)/2)
if(start < end):
if(L[end] == find):
return end
else:
return -100
if(L[mid] == find): return mid
elif(find > L[mid]):
return Binary(L, find, mid + 1, end)
else:
return Binary(L, find, start, mid-1)

b. def Binary(L, find, start, end):
mid = int((start+end)/2)
if(start == end):
if(L[end] == find):
return end
else:
return -100
if(L[mid] == find):
return mid
elif(find > L[mid]):
return Binary(L, find, start, mid 1)
else:
return Binary(L, find, mid + 1, end)

c. def Binary(L, find, start, end):
mid = int((start+end)/2)
if(start == end):
if(L[end] == find):
return end
else:
return -100
if(L[mid] == find): return mid
elif(find > L[mid]):
return Binary(L, find, mid + 1, end)
else:
return Binary(L, find, start, mid-1)

d. def Binary(L, find, start, end):
mid = int((start+end)/2)
if(start >= end):
if(L[end] == find):
return end
else:
return -100
if(L[mid] != find):
return mid
elif(find > L[mid]):
return Binary(L, find, mid + 1, end)
else:
return Binary(L, find, start, mid-1)

Answer: Option C.


Q6. Which of the following can be used to see the dimension of a NumPy array named ‘arr’?

a. dim(arr)

b. shape(arr)

c. arr.shape

d. arr.shape()

Answer: c. arr.shape


Q7. If PYTHON is encoded by TCXLSR then DIAMOND will be encoded as?

a. EJBNPOE

b. FKCORPF

c. HMERTSH

d. HMEQSRH

Answer: d. HMEQSRH


Q8. Select the correct statement

i. print(‘9a’.isalnum()) will return True.

ii. ‘9a’ contains both alphabetic and numeric parts.

a. Option 1 is correct, option 2 is correct. Option 2 is the correct explanation for option 1.

b. Option 1 is correct, option 2 is incorrect.

c. Option 1 is correct, option 2 is correct. Option 2 is not the correct explanation for option 1.

d. Option 1 is incorrect, option 2 is incorrect.

Answer: a. Option 1 is correct, option 2 is correct. Option 2 is the correct explanation for option 1.


Q9. What will be the output of the following program?

s = 'Fusce id odio leo In quis laoreet nulla'
d = {}
for i in s:
d[i]+=1
print(d)

a. A dictionary with the count of each character in s.

b. A dictionary with the count of each special character in s.

c. A dictionary with the count of letters in s.

d. Error

Answer: d. Error


Q10. Let L be a list containing different names of movies. Which statement is correct to select a random movie name from that list L?

a. random.choices(L)

b. random.select(L)

c. random.movie(L)

d. random.random(L)

Answer: a. random.choices(L)


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 5

NPTEL The Joy of Computing using Python Assignment Answers Week 7

Related Posts