The Joy Of Computing Using Python Week 8 : Assignment 8 | NPTEL | Answers Jan 2023

The Joy of Computing using Python Week 8 - Assignment 8 | NPTEL | Answer with Explanation

The Joy of Computing using Python Week 8 - Assignment 8  NPTEL  Answer with Explanation
"Discover the Excitement of Computing with Python | Week 8 Multiple Choice Questions - Get ready to enhance your programming skills and deepen your understanding of the Python language with this week 6 MCQ on 'The Joy of Computing using Python'. Test your knowledge and boost your confidence as a Python programmer today!"

The Joy of Computing using Python - Course | NPTEL - All assignment

Which of the following is not true about Stylometry Analysis?

a. It is the quantitative study of literature style
b. It is based on the observation that the authors tend to write in relatively consistent and recognizable ways
c. any two people may have the same vocabulary
d. It is a tool to study a variety of questions involving style of writing
Answer

c. any two people may have the same vocabulary
The statement "any two people may have the same vocabulary" is not true about stylometry analysis. Stylometry analysis can detect differences in the vocabulary used by different authors and can be used to identify the author of a text based on their distinctive vocabulary and writing style.

Which of the following is not true about tuples in python?

a. Tuple consumes less memory
b. Tuples are immutable
c. Tuple supports item deletion
d. Tuples does not support modification
Answer

c. Tuple supports item deletion
The statement "Tuple supports item deletion" is not true about tuples in Python. Tuples are immutable, meaning once a tuple is created, it cannot be modified. This means that you cannot add, remove, or change items in a tuple. Additionally, because tuples are fixed in size, they can be more memory-efficient than lists, especially for large data sets. However, because tuples are immutable, you cannot delete individual items from a tuple. The only way to remove a tuple from memory is to delete the entire tuple object using the del keyword.

What is the output of the following code snippet in python?

name =(’kiran’,’bhushan’,’madan’)
print (name[-1])
a. invalid syntax
b. tuple index out of range
c. prints nothing
d. madan
Answer

d. madan
The code defines a tuple named "name" with three values: "kiran", "bhushan", and "madan". The line "print(name[-1])" prints the last element of the tuple, which is "madan", because in Python, the index -1 represents the last element of a sequence (like a tuple or list). So, the output of the program will be "madan".

Strings in python can be created using

a. single quotes
b. double quotes
c. triple quotes
d. only A and B
e. A, B and C
Answer

e. A, B and C
Strings in Python can be created using single quotes, double quotes, and triple quotes. Therefore, the answer is "A, B and C".
Single quotes and double quotes can be used to create a string with a single line of text, while triple quotes are used for multi-line strings. For example:

Example: 
single_quote_string = 'This is a string created using single quotes.'
double_quote_string = "This is a string created using double quotes."
triple_quote_string = """This is a string
created using triple quotes,
which allows for multiple lines of text."""
All three of these strings are valid in Python and will produce the expected output.

Networkx in python is used for which of the following operation(s)?

a. Visualizing social network
b. Analyzing social networks
c. Generate social network
d. All of the above
e. None of the above
Answer

All of the above
Networkx in Python can be used for all of the above operations: visualizing, analyzing, and generating social networks. In addition to social networks, Networkx can also be used for modeling other types of networks such as biological networks, transportation networks, and more.

Which of the following will generate a complete graph in python using the networkx package?

a. Graph = nx.gnp random graph(25,0.5)
b. Graph = nx.gnp random graph(25,1.0)
c. Graph = nx.gnp random graph(25,0.25)
d. Graph = nx.gnp random graph(25,0.75)
Answer

b. Graph = nx.gnp random graph(25,1.0)

Which of the following method will return the RBG value of a pixel in python?

a. getpixel()
b. RBGvalue()
c. pixelValue()
d. none of the above
Answer

a. getpixel()

You May Like to Learn - Python - Scripting Language

The degree of separation of a complete graph with n nodes is always

a. n
b. n-1
c. 1
d. 6
Answer

c. 1
The degree of separation of a complete graph with n nodes is always 1.
In a complete graph, every node is connected to every other node, so there are no disconnected pairs of nodes. Therefore, the shortest path between any two nodes is always just one edge, which means the degree of separation is one.

Which of the following is true about six degrees of separation?

a. the minimum degree of separation of any node in the network is 6
b. the maximum degree of separation of any node in the network is 6
c. the average degree of separation of the nodes in the network is 6
d. the degree of separation of every node in the network is 6
Answer

c. the average degree of separation of the nodes in the network is 6
This means that on average, any two people in the world can be connected by a chain of six or fewer social connections. This theory was first proposed in the 1920s and has been supported by various studies since then. However, it's important to note that this is an average value and not every node in the network will have exactly six degrees of separation. Some nodes may have fewer, while others may have more.

What is the output of the following code?

import nltk
nltk.download('punkt')
From nltk.tokenize import sent_tokenize

mytext = "Have nice day, my friend !!! Programming in Python is fun"
print(sent_tokenize(mytext))
a. ['Have nice day, my friend!!! Programming in Python is fun']
b. ['Have nice day, my friend!!!', 'Programming in Python is fun']
c. 'Have nice day, my friend!!!'
'Programming in Python is fun'
d. Error
Answer

b. ['Have nice day, my friend!!!', 'Programming in Python is fun']
The code imports the nltk library and downloads the punkt package, which is necessary for sentence tokenization. Then, it imports the sent_tokenize function from the nltk.tokenize module.
After that, the code defines a string variable mytext which contains the text "Have nice day, my friend !!! Programming in Python is fun".
Finally, the code prints the result of calling the sent_tokenize function with mytext as the input. The sent_tokenize function breaks the input text into a list of sentences, and the resulting output is a list with two sentences: "Have nice day, my friend !!!" and "Programming in Python is fun".

Disclaimer:
"This page contains multiple choice questions (MCQs) related to The Joy of Computing using Python . The answers to these questions are provided for educational and informational purposes only.These answers are provided only for the purpose to help students to take references. This website does not claim any surety of 100% correct answers. So, this website urges you to complete your assignment yourself."

The Joy of Computing using Python Week 8,NPTEL ,Assignment 8 [Jan 2023],noc23_cs20

The Joy of Computing using Python - Course | NPTEL - All assignment

Post a Comment

0 Comments