The Joy Of Computing Using Python Week 10 : Assignment 10 | NPTEL | Answers Jan 2023

The Joy of Computing using Python Week 10 - Assignment 10 | NPTEL | Answer with Explanation

The Joy Of Computing Using Python Week 10   Assignment 10   NPTEL  Answers Jan 2023

The Joy of Computing using Python - Course | NPTEL - All assignment

"Discover the Excitement of Computing with Python | Week 10 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!"

Which math problem flames is related to?

a. kadane's problem
b. Josephus problem
c. Conjecture Collatz
d. Dijkstra Problem
Answer

b. Josephus problem

What will be the output of the following list slicing.

s = 'The Joy of Computing'
print(s[3:12])
a. 'Joy of C'
b. ' Joy of C'
c. 'Joy of Co'
d. ' Joy of Co'
Answer

b. ' Joy of C'

What will be the output of the following program?

s = 'I am amazed'
s.replace('a','z')
print(s)
a. I zm zmzzed
b. I zm zmazed
c. I am zmzzed
d. I am amazed
Answer

d. I am amazed

This is because although the replace() method is used to replace all occurrences of the substring 'a' with the substring 'z' in the string s, the replace() method doesn't modify the original string s. Instead, it returns a new string with the replaced characters. Therefore, the original string s remains unchanged.
If you want to see the modified string, you should assign the result of the replace() method to a new variable

What are the consequences of image compression?

a. Less size
b. Lower quality
c. More size
d. Higher quality
Answer

a. Less size
b. Lower quality

Image compression is the process of reducing the size of an image file while maintaining an acceptable level of visual quality. The consequences of image compression are a. Less size and b. Lower quality. Compressing an image reduces its size, which can make it easier to store, transmit, and share. However, compression can also reduce the quality of the image, as some information is lost during the process. The extent to which the quality is affected depends on the compression method used and the degree of compression applied.

what is the output of the following code?

import numpy as np
a = np.array([1,2,3,4,5,6,7,8,9,10,11,12])
print(a.reshape(3,4))

a.
[[ 1 2 3 4]
[ 5 6 7 8]
[ 9 10 11 12]]

b.
[[ 1 2 3]
[ 4 5 6]
[ 7 8 9]
[10 11 12]]
 
c. Error

d.
[[1,2,3,4,5,6]
[7, 8, 9, 10, 11, 12]]
Answer
a.
[[ 1 2 3 4]
[ 5 6 7 8]
[ 9 10 11 12]]

The given code creates a NumPy array a with elements ranging from 1 to 12, and then reshapes it into a 3-by-4 array.
import numpy as np: This line imports the NumPy library and renames it as np for convenience.
a = np.array([1,2,3,4,5,6,7,8,9,10,11,12]): This line creates a NumPy array a with elements ranging from 1 to 12.
a.reshape(3,4): This line reshapes the array a into a 3-by-4 array.
The reshape method returns a new array with the same data but a different shape. The first argument specifies the number of rows and the second argument specifies the number of columns.

Support by installing "Computer Courses - All in One" android app its free

What will be the output of the following code?

important numpy as np

b = np.array([[1,2],[3,4]])

print(np.sum(b, axis = 1))
a. [4 6]
b. [3 7]
c. [3 4]
d. None of the above
Answer

b. [3 7]

Amongst which of the following is / are the method of list?

a. append()
b. extend()
c. insert()
d. All of the mentioned above
Answer

d. All of the mentioned
above of the methods mentioned (append(), extend(), and insert()) are methods of the list data type in Python.

The output of the following program will be?

 word = 'Python'
word[2] = 'n'

print(word) 
a. Pynhon
b. Pnthon
c. Python
d. Error
Answer

d. Error
This code will result in an error because strings in Python are immutable, meaning you cannot change individual characters within a string once it has been created.

Which of the following is not a method in string?

a. lower()
b. upper()
c. isalpha()
d. insert()
Answer

d. insert()

The lower() method returns a new string with all the characters in lowercase. The upper() method returns a new string with all the characters in uppercase. The isalpha() method returns True if all the characters in the string are alphabetic characters (letters), and False otherwise.

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

The Joy of Computing using Python - Course | NPTEL - All assignment

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."

The Joy of Computing using Python Week 10,NPTEL ,Assignment 10 [Jan 2023],noc23_cs20

Post a Comment

0 Comments