# NPTEL Social Networks Week 1 Assignment Answers 2024

NPTEL Social Networks Week 1 Assignment Answers 2024

## NPTEL Social Networks Week 1 Assignment Answers 2024

1. Which of the following is the output of the given code segment?

l=[]

l.append (5)

l.append (”AAA”)

l.append ([2,3])

print(l)

• [5, AAA, [2, 3]]
• [5,‘AAA’,[2, 3]]
• [5,‘AAA’,2,3]
• error
`Answer :- b`

2. Assume you have to roll a dice with six faces. Choose the statement to simulate the same.

• random.randint(1, 6)
• random.randrange(1, 8)
• random.randint(1, 7)
• random.randrange(1,6)
`Answer :- a`

3. Select the code to create the given dictionary:
{1 : 2, 2 : 4, 3 : 6, 4 : 8, 5 : 10, 6 : 12, 7 : 14, 8 : 16, 9 : 18}

• d={x:x**2 for x in range(1,10)}print(d)
• d={x:x*2 for x in range(1,9)}print(d)
• d={x:x*2 for x in range(1,10)}print(d)
• d={x:x**2 for x in range(1,9)}print(d)
`Answer :- For Answer Click Here`

4. What does the G(n,p) random graph model in Networkx library represent?

• A graph with n nodes and p edges
• A graph with n nodes and p is the probability of an edge between any two nodes
• A graph with n nodes and p-1 edges
• A graph with n nodes and p is the probability of a path of any length between every two nodes
`Answer :- For Answer Click Here`

5. What is the output of the following code snippet?

import networkx
G = networkx.Graph( )
G.remove node ( 2 )
print(len(G.edges( )))

• 0
• 1
• 2
• 3
`Answer :- For Answer Click Here`

6.

Which of the following functions is used to find the shortest path length?

• networkx.dijkstra_path_length(G,‘node a’)
• networkx.dijkstra_path_length(‘node a’,‘node b’)
• networkx.dijkstra_path_length(‘node a’,‘node b’,G)
• networkx.dijkstra_path_length(G,‘node a’,‘node b’)
`Answer :- For Answer Click Here`

7. What does the Page Rank algorithm measure?

• The number of friends a person has in the social network
• The person who is more important in the network
• The person who is very frequently posting content on the social network
• The total number of connections in the network
`Answer :- `

8. The code inside the ‘try’ block is monitored for any exceptions. The ‘except’ block contains the code to handle the exception, providing an alternative path for the program to continue execution. Find the output for the given code snippet:

x=[5,2,7,3,8]

try :

a=x[3]

if(a%2==0):

print(”It is an even number”)

else:

print(”It is an odd number”)

except:
print(”Element does not exist”)

• Element does not exist
• It is an even number
• It is an odd number
• error
`Answer :- `

9. What is the maximum number of graphs possible from 70 nodes?

• 270
• 2(702)
• (702)
• 702
`Answer :- `

10. Which algorithm or concept should be used to suggest connections on LinkedIn?

`Answer :- `