The Joy of Computing using Python | Week 12
Session: JULY-DEC 2023
Course Name: The Joy of Computing using Python
Course Link: Click Here
These are answers of The Joy of Computing using Python Assignment 12 Answers
Q1. What is a sink?
A node with no incoming edges.
A node with maximum incoming edges.
A node with maximum outgoing edges.
A node with no outgoing edges.
Answer: A node with no outgoing edges.
Q2. What should we do when encountering a sink in the case of page rank algorithm?
Stop the algorithm.
Start with the last node.
Randomly choose a node from all nodes.
Randomly choose a node from neighbor nodes.
Answer: Randomly choose a node from all nodes.
Q3. In the page rank algorithm
We randomly travel from node to node without any relationship.
We randomly travel from node to neighbor node.
The maximum visited node will be the leader.
B and C
A and C
Answer: B and C
These are answers of The Joy of Computing using Python Assignment 12 Answers
Q4. If we perform the page rank algorithm on the web as a graph, which of the following is true?
Websites are nodes and hyperlinks in websites are edges.
Hyperlinks in websites are nodes and websites are edges.
Websites will work as nodes and edges.
Hyperlinks will work as nodes and edges.
Answer: Websites are nodes and hyperlinks in websites are edges.
Q5. Identify the type of graph:
Triangle Graph
Directed Graph
Barbell Graph
Wheel graph
Answer: Barbell Graph
Q6. Which of the following python function will return random floating point number between 0 and 1?
random.float()
random.randomfloat()
random.frandom()
random.random()
Answer: random.random()
These are answers of The Joy of Computing using Python Assignment 12 Answers
Q7. What will be the G.out_degree(3) for the following graph(G) ?
4
5
3
6
Answer: 5
Q8. In the page rank algorithm the leader is decided by?
A node(person) with maximum number of outgoing edges.
A node(person) with maximum number of incoming edges.
A node(person) which is visited maximum times.
Can not decide.
Answer: A node(person) which is visited maximum times.
These are answers of The Joy of Computing using Python Assignment 12 Answers
Q9. Which of the following is true about directed graphs?
One can come back and forth from one node to another using a single edge.
One can only go forward from one node to another using a single edge.
One can go to any node from one node using one edge.
None of the above.
Answer: One can only go forward from one node to another using a single edge.
These are answers of The Joy of Computing using Python Assignment 12 Answers
Q10. What will be the output of the following code?
[‘Hey’, ‘there’, ‘!’]
[‘Hey’, ‘there’, ‘ ‘, ‘!’]
[‘H’, ‘e’, ‘y’, ‘ ‘, ‘t’, ‘h’, ‘e’, ‘r’, ‘e’, ‘!’]
[‘H’, ‘e’, ‘y’, ‘t’, ‘h’, ‘e’, ‘r’, ‘e’, ‘!’]
Answer: ‘H’, ‘e’, ‘y’, ‘ ‘, ‘t’, ‘h’, ‘e’, ‘r’, ‘e’, ‘!’]
These are answers of The Joy of Computing using Python Assignment 12 Answers
The Joy of Computing using Python Programming Assignmnet
Question 1
Write a program to an integer as an input and reverse that integer.
Input:
A single integer.
Output:
Reverse number of that integer.
Example:
Input:
54321
Output:
12345
Solution:
print(int("".join(list(input())[::-1])),end="")
pass
These are answers of The Joy of Computing using Python Assignment 12 Answers
Question 2
Given a list of strings, write a program to write sort the list of strings on the basis of last character of each string.
Input:
L = [‘ram’, ‘shyam’, ‘lakshami’]
Output:
[‘lakshami’, ‘ram’, ‘shyam’]
Solution:
Ll=input().split()
M=list()
for i in Ll:
M.append("".join(list(i)[::-1]))
ans=[]
for i in sorted(M):
ans.append("".join(list(i)[::-1]))
print(ans,end="")
These are answers of The Joy of Computing using Python Assignment 12 Answers
Question 3
Given a student’s roll number in the following format rollNumber@institute.edu.in, write a program to find the roll number and institute name of the student.
Input:
roll@institute.edu.in
Output:
roll institute
Solution:
roll146=input()
print(roll146.split('@')[0],roll146.split('@')[1].split(".")[0],end="")
These are answers of The Joy of Computing using Python Assignment 12 Answers
More Weeks of The Joy of Computing Using Python: Click here
More Nptel Courses: Click here
Session Jan-Apr 2023
Course Name: The Joy of Computing using Python
Course Link: Click Here
These are answers of The Joy of Computing using Python Assignment 12 Answers
Q1. 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.
Q2. The following code will return:

a. 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.
These are answers of The Joy of Computing using Python Assignment 12 Answers
Q3. How many edges are there in the following graph?

a. Three
b. Five
c. Four
d. Two
Answer: c. Four
Q4. A complete graph will have a degree of separation.
a. 2
b. 1
c. 3
d. Depends on the number of nodes.
Answer: b. 1
These are answers of The Joy of Computing using Python Assignment 12 Answers
Q5. What is the output of the following code?


a.

b.

c.

d.

Answer: c
Q6. 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)
These are answers of The Joy of Computing using Python Assignment 12 Answers
Q7. Which is the following graph?

a. Triangle Graph
b. Directed Graph
c. Barbell Graph
d. Wheel graph
Answer: c. Barbell Graph
Q8. What will be the G.out_degree(3) for the following graph(G)?

a. 4
b. 6
c. 3
d. None of the above
Answer: d. None of the above
These are answers of The Joy of Computing using Python Assignment 12 Answers
Q9. 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.
Q10. Which of the following is a star graph of node 5?
a.

b.

c.

d.

Answer: a
These are answers of The Joy of Computing using Python Assignment 12 Answers
The Joy of Computing using Python Programming Assignmnet
Question 1
Write a program to an integer as an input and reverse that integer.
Input:
A single integer.
Output:
Reverse number of that integer.
Example:
Input:
54321
Output:
12345
Solution:
n = int(input())
rev = 0
while(n > 0):
a = n % 10
rev = rev * 10 + a
n = n // 10
print(rev)
These are answers of The Joy of Computing using Python Assignment 12 Answers
Question 2
Given a list of strings, write a program to write sort the list of strings on the basis of last character of each string.
Input:
L = [‘ram’, ‘shyam’, ‘lakshami’]
Output:
[‘lakshami’, ‘ram’, ‘shyam’]
Solution:
L = input().split()
M = []
for i in L:
M.append("".join(list(i)[::-1]))
ans = []
for i in sorted(M):
ans.append("".join(list(i)[::-1]))
print(ans,end="")
These are answers of The Joy of Computing using Python Assignment 12 Answers
Question 3
Given a student’s roll number in the following format rollNumber@institute.edu.in, write a program to find the roll number and institute name of the student.
Input:
roll@institute.edu.in
Output:
roll institute
Solution:
a = input()
b = a.split('.')
r = b[0].split('@')[0]
i = b[0].split('@')[1]
print(r, i)
These are answers of The Joy of Computing using Python Assignment 12 Answers
More Weeks of The Joy of Computing using Python: Click Here
More Nptel courses: http://13.235.254.184/nptel/
