Answer: The study of linguistic style in written texts

2. What are the different attributes that can be checked in addition to average word length to identify the style of a particular author? (MSQ)

- Punctuation usage

- Word Frequency

- Usage of Stylistic Devices like Metaphors, Similes, etc

- Average Sentence Length

Answer: Punctuation usage, Word Frequency, Usage of Stylistic Devices like Metaphors, Similes, etc, Average Sentence Length

3. The following code tries to perform natural language analysis for a small piece of text without using the nltk (Natural Language Toolkit) library.

NPTEL The Joy of Computing using Python Week 9 Assignment Answers 2024

Select all the correct statements (MSQ)

- y represents the sum of length of words in text

- z represents the average word length of text

- x represents a list where each index of the list corresponds to the length of the corresponding word in text

- The output of the code is: 36 7.2

Answer: y represents the sum of length of words in text, z represents the average word length of text

4. The following code tries to calculate average sentence length of a given block of text in the form of a file, assuming that the sentences always end with full stops and that there are no ellipsis(…) in the block of text. But the code might contain errors. Identify the line number corresponding to the error. In the absence of an error input your answer as -1(NAT)

NPTEL The Joy of Computing using Python Week 9 Assignment Answers 2024

Answer:

5. What does the following code do?

NPTEL The Joy of Computing using Python Week 9 Assignment Answers 2024

- A graph having 5 nodes which are integers from 1 to 5 and 10 edges in total is created and the edges and nodes of the graph are printed

- A graph having 6 nodes which are integers from 1 to 6 and 10 edges in total is created and the edges and nodes of the graph are printed

- A graph having 5 nodes which are integers from 1 to 5 and 9 edges in total is created and the edges and nodes of the graph are printed

- A graph having 6 nodes which are integers from 1 to 6 and 9 edges in total is created and the edges and nodes of the graph are printed

Answer:

6. You are analysing a social network where individuals are represented as nodes, and friendships are represented as edges. What would be the most appropriate graph property to study to identify influential individuals in the network?

- Node degree

- Graph density

- Graph diameter

- Edge weight

Answer: Node degree

7. In the “small world experiment” conducted by Stanley Milgram, participants were asked to send a letter to a target person through acquaintances. What was the average number of intermediaries required for the letters to reach the target?

- 1 degree

- 3 degrees

- 6 degrees

- 10 degrees

Answer: 6 degrees

8. Given a file with edges of the graph, and each line representing an edge in the format “node 1 node 2”, the following code attempts to plot a graph based on the data given. But the code might contain errors. Identify the line number corresponding to the error. In the absence of an error type your answer as -1.

NPTEL The Joy of Computing using Python Week 9 Assignment Answers 2024

Answer:

9. Using the ideas from Area Calculation discussed in the lecture, we are trying to estimate the area of a quarter circle embedded in a square. Identify the line number corresponding to the error(if any) in the absence of error type your answer as -1

NPTEL The Joy of Computing using Python Week 9 Assignment Answers 2024

Answer:

10. Select the correct statements regarding area calculation using the method discussed in the lecture (MSQ)

- The main advantage of the method is that it can handle area calculation even for irregular shapes

- The main advantage of the method is that it is computationally efficient for all scenarios

- Increasing the number of random points reduces the impact of random variations and provides a more stable and accurate estimate of area

- Increasing the number of random points improves accuracy of estimation as it converges the average value to the true value according to law of large numbers

Answer: The main advantage of the method is that it can handle area calculation even for irregular shapes, Increasing the number of random points reduces the impact of random variations and provides a more stable and accurate estimate of area, Increasing the number of random points improves accuracy of estimation as it converges the average value to the true value according to law of large numbers

11. Select the correct statement regarding the PIL library