Nptel Social Networks Week 1 Assignment Answer

Week 1 : Assignment 1

Due date: 2025-02-05, 23:59 IST.
Assignment not submitted

1 point
Which Python code correctly computes the sum of even numbers in the list L = [3, 5, 8, 2, 6]?

  • sum([x for x in L if x % 2 == 0])
  • sum([x for x in L if x % 2 != 0])
  • sum([x for x in L if x > 2])
  • sum(L)

1 point
You are given a dictionary d = {'A': 10, 'B': 20, 'C': 30}. Which Python code snippet correctly adds a new key D with value 40 to the dictionary?

  • d['D'] = 40
  • d.add('D', 40)
  • d.update('D', 40)
  • d.append({'D': 40})

1 point
Given the following Python code snippet, what will be the output?

import matplotlib.pyplot as plt  

x = [1, 2, 3, 4]  
y = [1, 4, 9, 16]  

plt.plot(x, y)  
plt.show()  
  • A bar chart displaying the values in x and y.
  • A line graph connecting the points (1,1), (2,4), (3,9), (4,16).
  • A scatter plot with points (1,1), (2,4), (3,9), (4,16).
  • A histogram displaying the values of x and y.

1 point
Using the NetworkX library, how would you create an undirected graph with three nodes (A, B, C) and two edges (A-B and B-C)?

  • G = nx.Graph()
    G.add_edges_from([('A', 'B'), ('B', 'C')])
  • G = nx.DiGraph()
    G.add_edges_from([('A', 'B'), ('B', 'C')])
  • G = nx.Graph()
    G.add_nodes_from(['A', 'B', 'C'])
  • G = nx.Graph()
    G.add_edges_from([('A', 'B'), ('B', 'C')], directed=True)

1 point
In the PageRank algorithm, what is the primary assumption regarding the link structure of the web?

  • Pages that are linked to more often are likely more important.
  • Pages that are less frequently linked are likely more important.
  • Pages with more content are likely more important.
  • Pages without links are considered equally important as those with links.

1 point
In a social network, you are tasked with finding the shortest path between two individuals, A and B. Which of the following algorithms would be most suitable?

  • Dijkstra’s Algorithm
  • A* Search Algorithm
  • Breadth-First Search (BFS)
  • Depth-First Search (DFS)

1 point
Which of the following methods is commonly used for link prediction in a social network?

  • Collaborative Filtering
  • K-means Clustering
  • Matrix Factorization
  • Jaccard Similarity Index

1 point
In models of contagion in social networks, what does the term “threshold” specifically refer to?

  • The minimum number of links required to spread an infection in a network.
  • The fraction of neighbors a node needs to be influenced by to adopt a new behavior.
  • The time it takes for an infection to spread from one node to another.
  • The maximum number of nodes that can be infected at any given time.

1 point
Which centrality measure would you use to find the individuals who have the shortest average path length to all other nodes in the network?

  • Degree Centrality
  • Closeness Centrality
  • Betweenness Centrality
  • Eigenvector Centrality

1 point
Which of the following NetworkX functions can be used to predict potential links in a network based on node similarity indices?

  • nx.resource_allocation_index(G)
  • nx.shortest_path_length(G)
  • nx.closeness_centrality(G)
  • nx.betweenness_centrality(G)

#buttons=(Ok, Go it!) #days=(20)

Our website uses cookies to enhance your experience. Learn More
Ok, Go it!