The Joy of Computing using Python Week 12 - Assignment 12 | NPTEL | Answer with Explanation
The Joy of Computing using Python - Course | NPTEL - All assignment
"Discover the Excitement of Computing with Python | Week 11 Multiple Choice Questions - Get ready to enhance your programming skills and deepen your understanding of the Python language with this week 12 MCQ on 'The Joy of Computing using Python'. Test your knowledge and boost your confidence as a Python programmer today!"
NLTK ________.
a. Helps to work with human language data.b. Helps to convert machine data into human language.
c. Helps to work on gibberish language.
d. Helps to translate dog language into human language
Answer
a. Helps to work with human language data.
The following code will return:
def test(word): new_word = '' for ch in word: if ch>='a' and ch<='z": temp = ord(ch) temp = temp - 32 temp = chr(temp) new_word = new_word + temp return new_worda. Converting lower case letters into upper case.
b. Converting upper case letters into lower case.
c. Return the same word
d. Error
Answer
a. Converting lower case letters into upper case.
The test function takes a string word as input and returns a new string new_word that is the uppercase version of word.
The function achieves this by iterating over each character ch in word. If ch is a lowercase letter (as determined by the condition ch >= 'a' and ch <= 'z'), the function converts it to uppercase by subtracting 32 from its ASCII code using the ord function, then converting the resulting code back to a character using the chr function. The uppercase letter is then appended to new_word.
If ch is not a lowercase letter, it is ignored and not added to new_word. Finally, the function returns new_word.
It's worth noting that the function only works correctly for ASCII-encoded characters. If word contains non-ASCII characters, the behavior of the function is undefined.
A complete graph will have a degree of separation.
a. 2b. 1
c. 3
d. Depends on the number of nodes.
Answer
b. 1
What is the output of the following code?
import networkx as nx import matplotlib.pyplot as plt G = nx.Graph() G.add_nodes_from([1, 2, 3, 4]) G.add_edges_ from([(1, 2), (2, 1), (2, 3), (3, 4), (4,1), (3,1)]) nx.draw(G,with_labels=True) plt.show()
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)
Which is the following graph?
a. Triangle Graphb. Directed Graph
c. Barbell Graph
d. Wheel graph
Answer
c. Barbell Graph
What will be the G.out_degree(3) for the following graph(G)?
a. 4b. 6
c. 3
d. None of the above
Answer
d. None of the above
5
What should we do when encountered a sink?
a. Stop the algorithm.b. Start with the last node.
c. Randomly choose a node from all nodes.
d. Randomly choose a node from neighbor nodes.
Answer
c. Randomly choose a node from all nodes.
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."
0 Comments