The Joy of Computing using Python | Week 12

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:

image 45

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?

image 46

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?

image 47
image 48

a.

image 49

b.

image 50

c.

image 51

d.

image 52

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?

image 53

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)?

image 54

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.

image 55

b.

image 56

c.

image 57

d.

image 58

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: https://progiez.com/nptel/



These are answers of The Joy of Computing using Python Assignment 12 Answers