The Joy of Computing using Python Week 10 - Assignment | NPTEL | Answer with Explanation
"Discover the Excitement of Computing with Python | Week Multiple Choice Questions - Get ready to enhance your programming skills and deepen your understanding of the Python language with this week 10 MCQ on 'The Joy of Computing using Python'. Test your knowledge and boost your confidence as a Python programmer today!"
What is the output of the following code?
s = 'Hello Everyone' print(s.lower())a. HELLO EVERYONE
b. Hello Everyone
c. helloeveryone
d. hello everyone
Answer
d. hello everyone
In flames game when we will stop the iteration over FLAMES?
a. When only one letter is left in flames.b. Only once.
c. Only the letter remaining times.
d. None of the above.
Answer
a. When only one letter is left in flames.
Output of the following code will be?
a = ['','h','e','l','','l','o'] print('',join(a))a. hello
b. h.e.l.l.o
c .h.e.l..l.o
d .h.e.l.l.o
Answer
c .h.e.l..l.o
Which code snippet represents replacing all vowels with ‘_’ in a string?
Answer
s='The joy of Computing' s = s.replace('a', '-') s = s.replace('e', '-') s = s.replace('i', '-') s = s.replace('o', '-') s = s.replace('u', '-') print(s)
What will be the output of the following list slicing.
s = 'The Joy of Computing' print(s[3:12])
Answer
‘ Joy of C’
What does the following code represent?
s = 'Sheher mein' a = 'aeiouAEIOU' for i in range(len(s)): if(s.index(s[i])%2 == 0): print(i) if(s[i] in a): s = s.replace(s[i], '_') print(s)
Answer
Replacing all vowels at even index with ‘_’.
What will be the output of the following code?
import numpy as np b = np.array([[1,2,[3,4]]) print(np.sum(b,axix = 1))
Answer
[3 7]
What is the correct way to display the transpose of a matrix?
Answer
import numpy as np b = np.array([[1,2],[3,4]]) print(b.transpose())
import numpy as np b = np.array([[1,2],[3,4]]) print(b.T)
Are Lossy and Lossless compressions the same?
a. Yes, they are identical.b. No, they are different.
c. It depends on the context.
D. Not enough information provided.
Answer
b. No, they are different.
What is the shape of the following numpy array? numpy.array([ [1,2,3], [4,5,6] ])
a. (2,3)b. (3,2)
c. (3,3)
d. (2,2)
Answer
a. (2,3)
What will be the output of the following code?
import numpy as np a = np.array([[8,9,20],[10,31,22]]) b = np.array([[1,2,3],[4,5,6]]) print(a-b)
Answer
[[ 7 7 17] [ 6 26 16]]
| The Joy Of Computing Using Python Week 9 : Programming Assignment | NPTEL | Answers
|All Assignment: The Joy of Computing using Python - Course | NPTEL
Disclaimer:
"This page contains multiple choice questions (MCQs) related to The Joy of Computing using Python. The answers to these questions are provided for educational and informational purposes only.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."
0 Comments