NPTEL Joy Of Computing Using Python Week 9 Assignment 2025

Hey Folks, This article features NPTEL Joy Of Computing using Python Week 9 Assignment 2025 with 100% answers. In Previous articles, we had discussed the Week 8 Assignment. All answers are solved with proofs.

Also Read: NPTEL Joy Of Computing Using Python Week 8 Assignment 2025 Answers 

Also, Join us on Telegram 👉 CLICK HERE

NPTEL Joy Of Computing Using Python Week 9 Assignment 2025


NPTEL Joy Of Computing Using Python Week 9 Assignment 2025

In this article the following topics are discussed: 

  • Natural language Processing - Author Stylometry
  • Introduction to networkx
  • Six Degrees of Separation
  • Area of Calculation - Don't Measure
Last Date: 26-03-2025

Q1. How can we identify which book is written by which author?

A. By matching handwriting.
B. By analyzing word length with previous books.
C. By analyzing the number of pages in a book.
D. By analyzing the book’s preface.

Answer: [ B ]  
               By analyzing word length with previous books.

How can we identify which book is written by which author?


Q2. What is the key difference between lists and tuples in Python, and when would you choose one over the other?

A. Lists are immutable and can be used when elements need to be modified, while tuples are mutable and best for storing fixed data.
B. Lists are mutable and can be used for dynamic data manipulation, while tuples are immutable and used to store fixed collections of items.
C. Both lists and tuples are mutable and can be used interchangeably for any purpose.
D. Tuples are used only for string data, while lists can store any data type.

Answer: [ B ] 

Lists are mutable and can be used for dynamic data manipulation, while tuples are immutable and used to store fixed collections of items.


Q3. Will the following piece of code always return True?


import networkx as nx
G=nx.gnp_random_graph(10,0.5)
print(nx.is_connected(G)) {codeBox}

A. True
B. False

Answer: [ B ] False

Will the following piece of code always return True?


Q4. 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() {codeBox}

Answer: [ D ] 

What is the output of the following code?

Q5. What is the total degree of the given graph?


What is the total degree of the given graph?

A. 10
B. 8
C. 6
D. 4

Answer: [ B ]  8 
                 
 
Node 1 is connected to Node 2 and Node 4, so degree will be 2. 
 Node 2 is connected to Node 3 and Node 1, so degree will be 2. 
 Node 3 is connected to Node 4 and Node 2, so degree will be 2. 
 Node 4 is connected to Node 1 and Node 3, so degree will be 2. 
So, Total Degree is 2+2+2+2 = 8


Q6. Which of the following is always true for a connected undirected graph with at least one edge?

A. Every node has an even degree
B. The sum of all node degrees is even
C. The graph contains an Eulerian path
D. The graph contains a Hamiltonian cycle

Answer: [ B ] The sum of all node degrees is even

Q7. What is the primary difference between using single quotes, double quotes, and triple quotes to create strings in Python?


A. Single and double quotes can only be used for single-line strings, while triple quotes are used for multi-line strings
B. Single quotes are used for strings with one word, while double quotes are for strings with multiple words
C. Double quotes are more efficient than single quotes for creating strings
D. There is no difference in how Python interprets single quotes, double quotes, or triple quotes for strings

Answer: [ A ] Single and double quotes can only be used for single-line strings, while triple quotes are used for multi-line strings

Q8. How many nodes and edges does the following graph have?


How many nodes and edges does the following graph have?


A. 10,6
B. 10,5
C. 8,6
D. 8,5

Answer:  [ A ] 10, 6 
                There are 10 nodes, and 6 edges in the following graph.

Q9. A complete graph will have a degree of separation?

A. 1
B. 2
C. 3
D. Depends on the number of nodes

Answer: [ A ] 1 

A complete graph will have a degree of separation?


Q10. What will be the output of the following code?

s = "hello"
s[0] = "H" {codeBox}

A. It will print ”Hello”
B. It will raise a TypeError
C. The string will be updated to ”Hello”
D. It will change the first character to uppercase and print ”Hello”

Answer: [ B ] It will raise a TypeError

What will be the output of the following code?


Conclusion:

Join us on Telegram 👉 CLICK HERE



One Comment Please !

Post a Comment (0)
Previous Post Next Post