# NPTEL The Joy Of Computing Using Python Week 8 Assignment 1 July 2023 | NPTEL

## What is the correct initialisation of tuples?

a. Dates = [12,23,3,4]
b. Dates = (12,23,3,4)
c. Dates = {12,23,3,4}
d. Both B and C

b. Dates = (12,23,3,4)

## What operations can be done on tuples?

a. Tuples are appendable.
b. We can delete a value from tuples.
c. Both A and B.
d. We can count the number of instances of an element.

d. We can count the number of instances of an element.

Tuples do support the operation to count the number of instances of an element using the count() method.

## What will be the output of the following code?

```t = (1,2,3,4,5)
for i in range(-1,-len(t),-1):
print(t[i])```
a. 1,2,3,4,5
b. 5,4,3,2,1
c. 5,4,3,2
d. 1,2,3,4

c. 5,4,3,2

## What will be the output of the following code?

```word = 'facebook'
new = ''

for w in word:
i = ord(w)

j = (((i+26) - 97 ) % 26 ) + 97

new = new + chr(j)

print(new)```
b. gbdfcppl
c. ezbdannj
d. ytvxuhhd

## When the following program will clap?

```print('Enter a letter between a-z')

player1 = str(input())
player2 = str(input())

while(True):

if(ord(player1.lower())+1 == ord(player2.lower())):
print('clap')
break
else:
player1 = str(input())
player2 = str(input())```
a. When both players will enter the same letters.
b. When player 2 will enter the next letter with respect to player 1.
c. When player 1 will enter the next letter with respect to player 2.
d. It will never clap.

b. When player 2 will enter the next letter with respect to player 1.

```output:
Enter a letter between a-z
p
q
clap```

## Which statement is correct about the following program?

```import random
import matplotlib.pyplot as plt

l = []
count = 0

for i in range(10):
guess = random.randint(1,10)
pick = random.randint(1,10)

if(guess != pick):
count+=1
l.append(count)

else:
count-=1
l.append(count)

plt.plot(l)
plt.show()```
a. The graph will go up when guess and pick are the same.
b. The graph will go down when guess and pick are the same.
c. The graph will go up when guess and pick are not the same.
d. Both B and C

d. Both B and C

## What does NLTK do?

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.

a. Helps to work with human language data.

NLTK (Natural Language Toolkit) is a Python library specifically designed to work with human language data. It provides tools and resources for various natural language processing (NLP) tasks, such as tokenization, stemming, lemmatization, parsing, semantic reasoning, and more.

## What is the output of the following code?

```string = 'hey!there'
a = sorted(string)
a.reverse()
print(a)```
a. ['!', 'e', 'e', 'e', 'h', 'h', 'r', 't', 'y']
b. ['h', 'e', 'y', '!', 't', 'h', 'e', 'r', 'e']
c. ['y', 't', 'r', 'h', 'h', 'e', 'e', 'e', '!']
d. None of the above

c. ['y', 't', 'r', 'h', 'h', 'e', 'e', 'e', '!']

## While converting an image into black and white during enhancement you cannot convert it back into a colored image.

a. True
b. False

a. True.

When an image is converted into black and white during enhancement, the color information is lost, and it cannot be recovered. Therefore, it cannot be converted back into a colored image

## How does vader help in sentiment analysis?

a. It calculates whether the statement is negative, positive or neutral.
b. It takes care of the intensity of a statement.
c. Both A and B
d. None of the above

c. Both A and B

VADER (Valence Aware Dictionary and sEntiment Reasoner) is a sentiment analysis tool that is specifically designed to analyze sentiments expressed in social media. It is a rule-based model that uses a sentiment lexicon, which is a list of lexical features (e.g., words) that are labeled according to their semantic orientation as either positive, negative, or neutral. VADER makes fine-tuned distinctions between varying degrees of positivity and negativity and takes care of the intensity of a statement. It calculates the polarity of a statement, whether it is negative, positive, or neutral.

### |All Assignment: The Joy of Computing using Python - Course | NPTEL

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."